# HG changeset patch # User athos # Date 1153127419 0 # Node ID 73e0c8207e116f87cd7f1dc4d8d04c32a7b26c42 # Parent cd8897f67c2641b31234de88752a21235d73b335 Sorry, mistake diff -r cd8897f67c26 -r 73e0c8207e11 demo/mip_test.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/demo/mip_test.cc Mon Jul 17 09:10:19 2006 +0000 @@ -0,0 +1,50 @@ +#include +//#include + +using namespace lemon; + +int main(){ + + //MipGlpk ilp; + + Mip ilp; + + + typedef Mip::Row Row; + typedef Mip::Col Col; + + ilp.max(); + + Col x1 = ilp.addCol(); + Col x2 = ilp.addCol(); + Col x3 = ilp.addCol(); + + ilp.integer(x1,true); + ilp.integer(x2,true); + ilp.integer(x3,true); + + ilp.addRow(x1+x2+x3 <=100); + ilp.addRow(10*x1+4*x2+5*x3<=600); + ilp.addRow(2*x1+2*x2+6*x3<=300); + + ilp.colLowerBound(x1, 0); + ilp.colLowerBound(x2, 0); + ilp.colLowerBound(x3, 0); + //Objective function + ilp.setObj(10*x1+6*x2+4*x3); + + //Call the routine of the underlying LP solver + ilp.solve(); + + //Print results + if (ilp.primalStatus()==LpSolverBase::OPTIMAL){ + std::cout<<"Optimal solution found!"<