Changeset 1518:f8efed98d6a3 in lemon-0.x for demo/lp_maxflow_demo.cc
- Timestamp:
- 06/27/05 17:25:33 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2003
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
demo/lp_maxflow_demo.cc
r1435 r1518 35 35 typedef typename G::InEdgeIt InEdgeIt; 36 36 37 //Define a map on the edges for the variables of the LP problem 37 38 typename G::template EdgeMap<LpDefault::Col> x(g); 38 39 lp.addColSet(x); 39 40 41 //Nonnegativity and capacity constraints 40 42 for(EdgeIt e(g);e!=INVALID;++e) { 41 43 lp.colUpperBound(x[e],cap[e]); … … 43 45 } 44 46 47 48 //Flow conservation constraints for the nodes (except for 's' and 't') 45 49 for(NodeIt n(g);n!=INVALID;++n) if(n!=s&&n!=t) { 46 50 LpDefault::Expr ex; … … 49 53 lp.addRow(ex==0); 50 54 } 55 56 //Objective function: the flow value entering 't' 51 57 { 52 58 LpDefault::Expr ex; … … 55 61 lp.setObj(ex); 56 62 } 63 64 //Maximization 57 65 lp.max(); 58 66 … … 62 70 #endif 63 71 72 //Solve with the underlying solver 64 73 lp.solve(); 65 74
Note: See TracChangeset
for help on using the changeset viewer.