test/min_cost_flow_test.cc
changeset 708 5d313b76f323
parent 664 cc61d09f053b
child 818 bc75ee2ad082
equal deleted inserted replaced
8:7f1e238a1cf3 9:01fff1bd3558
    91 
    91 
    92   template <typename MCF>
    92   template <typename MCF>
    93   struct Constraints {
    93   struct Constraints {
    94     void constraints() {
    94     void constraints() {
    95       checkConcept<concepts::Digraph, GR>();
    95       checkConcept<concepts::Digraph, GR>();
    96 
    96       
    97       MCF mcf(g);
    97       const Constraints& me = *this;
       
    98 
       
    99       MCF mcf(me.g);
    98       const MCF& const_mcf = mcf;
   100       const MCF& const_mcf = mcf;
    99 
   101 
   100       b = mcf.reset()
   102       b = mcf.reset()
   101              .lowerMap(lower)
   103              .lowerMap(me.lower)
   102              .upperMap(upper)
   104              .upperMap(me.upper)
   103              .costMap(cost)
   105              .costMap(me.cost)
   104              .supplyMap(sup)
   106              .supplyMap(me.sup)
   105              .stSupply(n, n, k)
   107              .stSupply(me.n, me.n, me.k)
   106              .run();
   108              .run();
   107 
   109 
   108       c = const_mcf.totalCost();
   110       c = const_mcf.totalCost();
   109       x = const_mcf.template totalCost<double>();
   111       x = const_mcf.template totalCost<double>();
   110       v = const_mcf.flow(a);
   112       v = const_mcf.flow(me.a);
   111       c = const_mcf.potential(n);
   113       c = const_mcf.potential(me.n);
   112       const_mcf.flowMap(fm);
   114       const_mcf.flowMap(fm);
   113       const_mcf.potentialMap(pm);
   115       const_mcf.potentialMap(pm);
   114     }
   116     }
   115 
   117 
   116     typedef typename GR::Node Node;
   118     typedef typename GR::Node Node;
   118     typedef concepts::ReadMap<Node, Value> NM;
   120     typedef concepts::ReadMap<Node, Value> NM;
   119     typedef concepts::ReadMap<Arc, Value> VAM;
   121     typedef concepts::ReadMap<Arc, Value> VAM;
   120     typedef concepts::ReadMap<Arc, Cost> CAM;
   122     typedef concepts::ReadMap<Arc, Cost> CAM;
   121     typedef concepts::WriteMap<Arc, Value> FlowMap;
   123     typedef concepts::WriteMap<Arc, Value> FlowMap;
   122     typedef concepts::WriteMap<Node, Cost> PotMap;
   124     typedef concepts::WriteMap<Node, Cost> PotMap;
   123 
   125   
   124     const GR &g;
   126     GR g;
   125     const VAM &lower;
   127     VAM lower;
   126     const VAM &upper;
   128     VAM upper;
   127     const CAM &cost;
   129     CAM cost;
   128     const NM &sup;
   130     NM sup;
   129     const Node &n;
   131     Node n;
   130     const Arc &a;
   132     Arc a;
   131     const Value &k;
   133     Value k;
       
   134 
   132     FlowMap fm;
   135     FlowMap fm;
   133     PotMap pm;
   136     PotMap pm;
   134     bool b;
   137     bool b;
   135     double x;
   138     double x;
   136     typename MCF::Value v;
   139     typename MCF::Value v;