# HG changeset patch # User athos # Date 1153127760 0 # Node ID 5fcb6598276d369312892ed4dc9786750f3a55f0 # Parent 73e0c8207e116f87cd7f1dc4d8d04c32a7b26c42 Still not final. diff -r 73e0c8207e11 -r 5fcb6598276d demo/mip_demo.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/demo/mip_demo.cc Mon Jul 17 09:16:00 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!"< -//#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!"< -//#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!"<