Changeset 2147:63d293ff1bef in lemon0.x
 Timestamp:
 07/17/06 11:31:41 (14 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@2861
 Files:

 1 edited
 1 copied
Legend:
 Unmodified
 Added
 Removed

demo/Makefile.am
r2119 r2147 25 25 26 26 if HAVE_GLPK 27 noinst_PROGRAMS += demo/lp_demo demo/lp_maxflow_demo 27 noinst_PROGRAMS += demo/lp_demo demo/lp_maxflow_demo demo/mip_demo 28 28 else !HAVE_GLPK 29 29 if HAVE_CPLEX … … 63 63 demo_lp_demo_CXXFLAGS = $(GLPK_CFLAGS) $(CPLEX_CFLAGS) 64 64 65 demo_mip_demo_SOURCES = demo/mip_demo.cc 66 demo_mip_demo_CXXFLAGS = $(GLPK_CFLAGS) $(CPLEX_CFLAGS) 67 65 68 demo_lp_maxflow_demo_SOURCES = demo/lp_maxflow_demo.cc 66 69 demo_lp_maxflow_demo_CXXFLAGS = $(GLPK_CFLAGS) $(CPLEX_CFLAGS) 
test/mip_test.cc
r2146 r2147 1 1 #include <lemon/lp.h> 2 //#include <lemon/ilp_glpk.h>3 2 4 3 using namespace lemon; … … 6 5 int main(){ 7 6 8 //MipGlpk ilp;9 7 10 Mip ilp; 8 #ifdef HAVE_GLPK 9 //This needs some thinking 10 #endif 11 11 12 13 typedef Mip::Row Row; 14 typedef Mip::Col Col; 15 16 ilp.max(); 17 18 Col x1 = ilp.addCol(); 19 Col x2 = ilp.addCol(); 20 Col x3 = ilp.addCol(); 21 22 ilp.integer(x1,true); 23 ilp.integer(x2,true); 24 ilp.integer(x3,true); 25 26 ilp.addRow(x1+x2+x3 <=100); 27 ilp.addRow(10*x1+4*x2+5*x3<=600); 28 ilp.addRow(2*x1+2*x2+6*x3<=300); 29 30 ilp.colLowerBound(x1, 0); 31 ilp.colLowerBound(x2, 0); 32 ilp.colLowerBound(x3, 0); 33 //Objective function 34 ilp.setObj(10*x1+6*x2+4*x3); 35 36 //Call the routine of the underlying LP solver 37 ilp.solve(); 38 39 //Print results 40 if (ilp.primalStatus()==LpSolverBase::OPTIMAL){ 41 std::cout<<"Optimal solution found!"<<std::endl; 42 printf("optimum value = %g; x1 = %g; x2 = %g; x3 = %g\n", 43 ilp.primalValue(), 44 ilp.primal(x1), ilp.primal(x2), ilp.primal(x3)); 45 } 46 else{ 47 std::cout<<"Optimal solution not found!"<<std::endl; 48 } 12 return 0; 49 13 50 14 }
Note: See TracChangeset
for help on using the changeset viewer.