lemon/network_simplex.h
changeset 613 b1811c363299
parent 609 e6927fe719e6
child 618 b95898314e09
equal deleted inserted replaced
7:2a9d8e31081e 9:4c4adf9b26ef
  1142         art_cost = (art_cost + 1) * _node_num;
  1142         art_cost = (art_cost + 1) * _node_num;
  1143       }
  1143       }
  1144 
  1144 
  1145       // Run Circulation to check if a feasible solution exists
  1145       // Run Circulation to check if a feasible solution exists
  1146       typedef ConstMap<Arc, Flow> ConstArcMap;
  1146       typedef ConstMap<Arc, Flow> ConstArcMap;
       
  1147       ConstArcMap zero_arc_map(0), inf_arc_map(inf_cap);
  1147       FlowNodeMap *csup = NULL;
  1148       FlowNodeMap *csup = NULL;
  1148       bool local_csup = false;
  1149       bool local_csup = false;
  1149       if (_psupply) {
  1150       if (_psupply) {
  1150         csup = _psupply;
  1151         csup = _psupply;
  1151       } else {
  1152       } else {
  1162             Circulation<GR, FlowArcMap, FlowArcMap, FlowNodeMap>
  1163             Circulation<GR, FlowArcMap, FlowArcMap, FlowNodeMap>
  1163               circ(_graph, *_plower, *_pupper, *csup);
  1164               circ(_graph, *_plower, *_pupper, *csup);
  1164             circ_result = circ.run();
  1165             circ_result = circ.run();
  1165           } else {
  1166           } else {
  1166             Circulation<GR, FlowArcMap, ConstArcMap, FlowNodeMap>
  1167             Circulation<GR, FlowArcMap, ConstArcMap, FlowNodeMap>
  1167               circ(_graph, *_plower, ConstArcMap(inf_cap), *csup);
  1168               circ(_graph, *_plower, inf_arc_map, *csup);
  1168             circ_result = circ.run();
  1169             circ_result = circ.run();
  1169           }
  1170           }
  1170         } else {
  1171         } else {
  1171           if (_pupper) {
  1172           if (_pupper) {
  1172             Circulation<GR, ConstArcMap, FlowArcMap, FlowNodeMap>
  1173             Circulation<GR, ConstArcMap, FlowArcMap, FlowNodeMap>
  1173               circ(_graph, ConstArcMap(0), *_pupper, *csup);
  1174               circ(_graph, zero_arc_map, *_pupper, *csup);
  1174             circ_result = circ.run();
  1175             circ_result = circ.run();
  1175           } else {
  1176           } else {
  1176             Circulation<GR, ConstArcMap, ConstArcMap, FlowNodeMap>
  1177             Circulation<GR, ConstArcMap, ConstArcMap, FlowNodeMap>
  1177               circ(_graph, ConstArcMap(0), ConstArcMap(inf_cap), *csup);
  1178               circ(_graph, zero_arc_map, inf_arc_map, *csup);
  1178             circ_result = circ.run();
  1179             circ_result = circ.run();
  1179           }
  1180           }
  1180         }
  1181         }
  1181       } else {
  1182       } else {
  1182         // LEQ problem type
  1183         // LEQ problem type
  1189             Circulation<RevGraph, FlowArcMap, FlowArcMap, NegNodeMap>
  1190             Circulation<RevGraph, FlowArcMap, FlowArcMap, NegNodeMap>
  1190               circ(rgraph, *_plower, *_pupper, neg_csup);
  1191               circ(rgraph, *_plower, *_pupper, neg_csup);
  1191             circ_result = circ.run();
  1192             circ_result = circ.run();
  1192           } else {
  1193           } else {
  1193             Circulation<RevGraph, FlowArcMap, ConstArcMap, NegNodeMap>
  1194             Circulation<RevGraph, FlowArcMap, ConstArcMap, NegNodeMap>
  1194               circ(rgraph, *_plower, ConstArcMap(inf_cap), neg_csup);
  1195               circ(rgraph, *_plower, inf_arc_map, neg_csup);
  1195             circ_result = circ.run();
  1196             circ_result = circ.run();
  1196           }
  1197           }
  1197         } else {
  1198         } else {
  1198           if (_pupper) {
  1199           if (_pupper) {
  1199             Circulation<RevGraph, ConstArcMap, FlowArcMap, NegNodeMap>
  1200             Circulation<RevGraph, ConstArcMap, FlowArcMap, NegNodeMap>
  1200               circ(rgraph, ConstArcMap(0), *_pupper, neg_csup);
  1201               circ(rgraph, zero_arc_map, *_pupper, neg_csup);
  1201             circ_result = circ.run();
  1202             circ_result = circ.run();
  1202           } else {
  1203           } else {
  1203             Circulation<RevGraph, ConstArcMap, ConstArcMap, NegNodeMap>
  1204             Circulation<RevGraph, ConstArcMap, ConstArcMap, NegNodeMap>
  1204               circ(rgraph, ConstArcMap(0), ConstArcMap(inf_cap), neg_csup);
  1205               circ(rgraph, zero_arc_map, inf_arc_map, neg_csup);
  1205             circ_result = circ.run();
  1206             circ_result = circ.run();
  1206           }
  1207           }
  1207         }
  1208         }
  1208       }
  1209       }
  1209       if (local_csup) delete csup;
  1210       if (local_csup) delete csup;