[Lemon-commits] [lemon_svn] athos: r2861 - in hugo/trunk: demo test

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 21:50:51 CET 2006


Author: athos
Date: Mon Jul 17 11:31:41 2006
New Revision: 2861

Added:
   hugo/trunk/test/mip_test.cc
      - copied, changed from r2860, /hugo/trunk/demo/mip_demo.cc
Modified:
   hugo/trunk/demo/Makefile.am

Log:
mip_test file went to mip_demo.

Modified: hugo/trunk/demo/Makefile.am
==============================================================================
--- hugo/trunk/demo/Makefile.am	(original)
+++ hugo/trunk/demo/Makefile.am	Mon Jul 17 11:31:41 2006
@@ -24,7 +24,7 @@
 	demo/strongly_connected_orientation
 
 if HAVE_GLPK
-noinst_PROGRAMS += demo/lp_demo demo/lp_maxflow_demo
+noinst_PROGRAMS += demo/lp_demo demo/lp_maxflow_demo demo/mip_demo
 else !HAVE_GLPK
 if HAVE_CPLEX
 noinst_PROGRAMS += demo/lp_demo demo/lp_maxflow_demo
@@ -62,6 +62,9 @@
 demo_lp_demo_SOURCES = demo/lp_demo.cc
 demo_lp_demo_CXXFLAGS = $(GLPK_CFLAGS) $(CPLEX_CFLAGS)
 
+demo_mip_demo_SOURCES = demo/mip_demo.cc
+demo_mip_demo_CXXFLAGS = $(GLPK_CFLAGS) $(CPLEX_CFLAGS)
+
 demo_lp_maxflow_demo_SOURCES = demo/lp_maxflow_demo.cc
 demo_lp_maxflow_demo_CXXFLAGS = $(GLPK_CFLAGS) $(CPLEX_CFLAGS)
 

Copied: hugo/trunk/test/mip_test.cc (from r2860, /hugo/trunk/demo/mip_demo.cc)
==============================================================================
--- /hugo/trunk/demo/mip_demo.cc	(original)
+++ hugo/trunk/test/mip_test.cc	Mon Jul 17 11:31:41 2006
@@ -1,50 +1,14 @@
 #include <lemon/lp.h>
-//#include <lemon/ilp_glpk.h>
 
 using namespace lemon;
 
 int main(){
 
-  //MipGlpk ilp;
 
-   Mip ilp;
+#ifdef HAVE_GLPK
+  //This needs some thinking
+#endif
 
-    
-  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!"<<std::endl;
-    printf("optimum value = %g; x1 = %g; x2 = %g; x3 = %g\n", 
-           ilp.primalValue(), 
-           ilp.primal(x1), ilp.primal(x2), ilp.primal(x3));
-  }
-  else{
-    std::cout<<"Optimal solution not found!"<<std::endl;
-  }
+  return 0;
 
 }



More information about the Lemon-commits mailing list