1.1 --- a/demo/mip_test.cc Mon Jul 17 09:10:19 2006 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,50 +0,0 @@
1.4 -#include <lemon/lp.h>
1.5 -//#include <lemon/ilp_glpk.h>
1.6 -
1.7 -using namespace lemon;
1.8 -
1.9 -int main(){
1.10 -
1.11 - //MipGlpk ilp;
1.12 -
1.13 - Mip ilp;
1.14 -
1.15 -
1.16 - typedef Mip::Row Row;
1.17 - typedef Mip::Col Col;
1.18 -
1.19 - ilp.max();
1.20 -
1.21 - Col x1 = ilp.addCol();
1.22 - Col x2 = ilp.addCol();
1.23 - Col x3 = ilp.addCol();
1.24 -
1.25 - ilp.integer(x1,true);
1.26 - ilp.integer(x2,true);
1.27 - ilp.integer(x3,true);
1.28 -
1.29 - ilp.addRow(x1+x2+x3 <=100);
1.30 - ilp.addRow(10*x1+4*x2+5*x3<=600);
1.31 - ilp.addRow(2*x1+2*x2+6*x3<=300);
1.32 -
1.33 - ilp.colLowerBound(x1, 0);
1.34 - ilp.colLowerBound(x2, 0);
1.35 - ilp.colLowerBound(x3, 0);
1.36 - //Objective function
1.37 - ilp.setObj(10*x1+6*x2+4*x3);
1.38 -
1.39 - //Call the routine of the underlying LP solver
1.40 - ilp.solve();
1.41 -
1.42 - //Print results
1.43 - if (ilp.primalStatus()==LpSolverBase::OPTIMAL){
1.44 - std::cout<<"Optimal solution found!"<<std::endl;
1.45 - printf("optimum value = %g; x1 = %g; x2 = %g; x3 = %g\n",
1.46 - ilp.primalValue(),
1.47 - ilp.primal(x1), ilp.primal(x2), ilp.primal(x3));
1.48 - }
1.49 - else{
1.50 - std::cout<<"Optimal solution not found!"<<std::endl;
1.51 - }
1.52 -
1.53 -}