test/mip_test.cc
changeset 2213 2c094dfa176d
parent 2149 b437bdee6fd0
child 2218 50f1a780a5ff
     1.1 --- a/test/mip_test.cc	Fri Sep 08 08:55:07 2006 +0000
     1.2 +++ b/test/mip_test.cc	Fri Sep 08 15:51:32 2006 +0000
     1.3 @@ -12,7 +12,7 @@
     1.4    buf << "Primalstatus should be: " << int(stat)<<" and it is "<<int(lp.primalStatus());
     1.5  
     1.6    //  itoa(stat,buf1, 10);
     1.7 -  check(lp.primalStatus()==stat, buf.str());
     1.8 +  check(lp.mipStatus()==stat, buf.str());
     1.9  
    1.10    if (stat ==  LpSolverBase::OPTIMAL) {
    1.11      std::ostringstream buf;
    1.12 @@ -35,6 +35,19 @@
    1.13  
    1.14  
    1.15  
    1.16 +
    1.17 +
    1.18 +
    1.19 +  //Objective function
    1.20 +  mip.setObj(x1);
    1.21 +
    1.22 +  mip.max();
    1.23 +
    1.24 +
    1.25 +  //Unconstrained optimization
    1.26 +  mip.solve();
    1.27 +  //Check it out!
    1.28 +
    1.29    //Constraints
    1.30    mip.addRow(2*x1+x2 <=2);  
    1.31    mip.addRow(x1-2*x2 <=0);  
    1.32 @@ -44,14 +57,8 @@
    1.33  
    1.34  
    1.35  
    1.36 -  //Objective function
    1.37 -  mip.setObj(x1);
    1.38 -
    1.39 -  mip.max();
    1.40 -
    1.41 -
    1.42    //Maximization of x1
    1.43 -  //over the triangle with vertices
    1.44 +  //over the triangle with vertices 
    1.45    double expected_opt=4.0/5.0;
    1.46    solveAndCheck(mip, Mip::OPTIMAL, expected_opt);
    1.47