src/demo/lp_demo.cc
changeset 1360 4338e4280f67
parent 1322 cfc26d103bcf
equal deleted inserted replaced
1:990ac90810a2 2:2493f0f75bb8
    36     for(InEdgeIt  e(g,t);e!=INVALID;++e) ex+=x[e];
    36     for(InEdgeIt  e(g,t);e!=INVALID;++e) ex+=x[e];
    37     for(OutEdgeIt e(g,t);e!=INVALID;++e) ex-=x[e];
    37     for(OutEdgeIt e(g,t);e!=INVALID;++e) ex-=x[e];
    38     lp.setObj(ex);
    38     lp.setObj(ex);
    39   }
    39   }
    40   lp.max();
    40   lp.max();
       
    41 
       
    42   lp.presolver(true);
       
    43   
       
    44   lp.messageLevel(3);
       
    45 
    41   lp.solve();
    46   lp.solve();
    42 
    47 
    43   return lp.primalValue();
    48   return lp.primalValue();
    44 }
    49 }
    45 
    50 
    46 int main() 
    51 int main() 
    47 {
    52 {
    48   LpGlpk lp_glpk;
       
    49 
       
    50   ListGraph g;
    53   ListGraph g;
    51   ListGraph::Node s;
    54   ListGraph::Node s;
    52   ListGraph::Node t;
    55   ListGraph::Node t;
    53   
    56   
    54 
       
    55   ListGraph::EdgeMap<double> cap(g);
    57   ListGraph::EdgeMap<double> cap(g);
    56   
    58   
    57   GraphReader<ListGraph> reader(std::cin,g);
    59   GraphReader<ListGraph> reader(std::cin,g);
    58   reader.addNode("source",s).addNode("target",t)
    60   reader.addNode("source",s).addNode("target",t)
    59     .addEdgeMap("capacity",cap).run();
    61     .addEdgeMap("capacity",cap).run();