src/work/athos/lp/lp_test.cc
changeset 1263 a490938ad0aa
parent 1259 11a09f1319b3
child 1264 92ba3e62825d
equal deleted inserted replaced
2:2f3bdc3eaac8 3:c76ad79ec316
     1 #include"lp_solver_skeleton.h"
     1 #include"lp_solver_skeleton.h"
       
     2 #include"lp_glpk.h"
     2 
     3 
     3 using namespace lemon;
     4 using namespace lemon;
     4 
     5 
     5 int main()
     6 void lpTest(LpSolverBase & lp)
     6 {
     7 {
     7   typedef LpSolverSkeleton LP;
     8   typedef LpSolverBase LP;
     8   LP lp;
       
     9 
     9 
    10   std::vector<LP::Col> x;
    10   std::vector<LP::Col> x;
    11   for(int i=0;i<10;i++) x.push_back(lp.addCol());
    11   for(int i=0;i<10;i++) x.push_back(lp.addCol());
    12 
    12 
    13   std::vector<LP::Col> y(10);
    13   std::vector<LP::Col> y(10);
    35   lp.addRow(LP::INF,3.0*(p1+p2)-p3,23);
    35   lp.addRow(LP::INF,3.0*(p1+p2)-p3,23);
    36   lp.addRow(LP::INF,3.0*(x[1]+x[2]/2)-x[3],23);
    36   lp.addRow(LP::INF,3.0*(x[1]+x[2]/2)-x[3],23);
    37   lp.addRow(LP::INF,3.0*(p1+p2*2-5*p3+12-p4/3)+2*p4-4,23);
    37   lp.addRow(LP::INF,3.0*(p1+p2*2-5*p3+12-p4/3)+2*p4-4,23);
    38   lp.addRow(LP::INF,3.0*(x[1]+x[2]*2-5*x[3]+12-x[4]/3)+2*x[4]-4,23);
    38   lp.addRow(LP::INF,3.0*(x[1]+x[2]*2-5*x[3]+12-x[4]/3)+2*x[4]-4,23);
    39 }
    39 }
       
    40 
       
    41 
       
    42 int main() 
       
    43 {
       
    44   LpSolverSkeleton lp_skel;
       
    45   LpGlpk lp_glpk;
       
    46 
       
    47   lpTest(lp_skel);
       
    48   lpTest(lp_glpk);
       
    49 }