COIN-OR::LEMON - Graph Library

Changeset 1518:f8efed98d6a3 in lemon-0.x for demo/lp_maxflow_demo.cc


Ignore:
Timestamp:
06/27/05 17:25:33 (19 years ago)
Author:
athos
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2003
Message:

Only added comments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • demo/lp_maxflow_demo.cc

    r1435 r1518  
    3535  typedef typename G::InEdgeIt InEdgeIt;
    3636 
     37  //Define a map on the edges for the variables of the LP problem
    3738  typename G::template EdgeMap<LpDefault::Col> x(g);
    3839  lp.addColSet(x);
    3940 
     41  //Nonnegativity and capacity constraints
    4042  for(EdgeIt e(g);e!=INVALID;++e) {
    4143    lp.colUpperBound(x[e],cap[e]);
     
    4345  }
    4446
     47
     48  //Flow conservation constraints for the nodes (except for 's' and 't')
    4549  for(NodeIt n(g);n!=INVALID;++n) if(n!=s&&n!=t) {
    4650    LpDefault::Expr ex;
     
    4953    lp.addRow(ex==0);
    5054  }
     55 
     56  //Objective function: the flow value entering 't'
    5157  {
    5258    LpDefault::Expr ex;
     
    5561    lp.setObj(ex);
    5662  }
     63
     64  //Maximization
    5765  lp.max();
    5866
     
    6270#endif
    6371
     72  //Solve with the underlying solver
    6473  lp.solve();
    6574
Note: See TracChangeset for help on using the changeset viewer.