lemon/network_simplex.h
changeset 623 7c1324b35d89
parent 612 0c8e5c688440
parent 613 b1811c363299
child 640 6c408d864fa1
equal deleted inserted replaced
8:302009ca647c 10:88ad3fc9dbe1
  1145         art_cost = (art_cost + 1) * _node_num;
  1145         art_cost = (art_cost + 1) * _node_num;
  1146       }
  1146       }
  1147 
  1147 
  1148       // Run Circulation to check if a feasible solution exists
  1148       // Run Circulation to check if a feasible solution exists
  1149       typedef ConstMap<Arc, Flow> ConstArcMap;
  1149       typedef ConstMap<Arc, Flow> ConstArcMap;
       
  1150       ConstArcMap zero_arc_map(0), inf_arc_map(inf_cap);
  1150       FlowNodeMap *csup = NULL;
  1151       FlowNodeMap *csup = NULL;
  1151       bool local_csup = false;
  1152       bool local_csup = false;
  1152       if (_psupply) {
  1153       if (_psupply) {
  1153         csup = _psupply;
  1154         csup = _psupply;
  1154       } else {
  1155       } else {
  1165             Circulation<GR, FlowArcMap, FlowArcMap, FlowNodeMap>
  1166             Circulation<GR, FlowArcMap, FlowArcMap, FlowNodeMap>
  1166               circ(_graph, *_plower, *_pupper, *csup);
  1167               circ(_graph, *_plower, *_pupper, *csup);
  1167             circ_result = circ.run();
  1168             circ_result = circ.run();
  1168           } else {
  1169           } else {
  1169             Circulation<GR, FlowArcMap, ConstArcMap, FlowNodeMap>
  1170             Circulation<GR, FlowArcMap, ConstArcMap, FlowNodeMap>
  1170               circ(_graph, *_plower, ConstArcMap(inf_cap), *csup);
  1171               circ(_graph, *_plower, inf_arc_map, *csup);
  1171             circ_result = circ.run();
  1172             circ_result = circ.run();
  1172           }
  1173           }
  1173         } else {
  1174         } else {
  1174           if (_pupper) {
  1175           if (_pupper) {
  1175             Circulation<GR, ConstArcMap, FlowArcMap, FlowNodeMap>
  1176             Circulation<GR, ConstArcMap, FlowArcMap, FlowNodeMap>
  1176               circ(_graph, ConstArcMap(0), *_pupper, *csup);
  1177               circ(_graph, zero_arc_map, *_pupper, *csup);
  1177             circ_result = circ.run();
  1178             circ_result = circ.run();
  1178           } else {
  1179           } else {
  1179             Circulation<GR, ConstArcMap, ConstArcMap, FlowNodeMap>
  1180             Circulation<GR, ConstArcMap, ConstArcMap, FlowNodeMap>
  1180               circ(_graph, ConstArcMap(0), ConstArcMap(inf_cap), *csup);
  1181               circ(_graph, zero_arc_map, inf_arc_map, *csup);
  1181             circ_result = circ.run();
  1182             circ_result = circ.run();
  1182           }
  1183           }
  1183         }
  1184         }
  1184       } else {
  1185       } else {
  1185         // LEQ problem type
  1186         // LEQ problem type
  1192             Circulation<RevGraph, FlowArcMap, FlowArcMap, NegNodeMap>
  1193             Circulation<RevGraph, FlowArcMap, FlowArcMap, NegNodeMap>
  1193               circ(rgraph, *_plower, *_pupper, neg_csup);
  1194               circ(rgraph, *_plower, *_pupper, neg_csup);
  1194             circ_result = circ.run();
  1195             circ_result = circ.run();
  1195           } else {
  1196           } else {
  1196             Circulation<RevGraph, FlowArcMap, ConstArcMap, NegNodeMap>
  1197             Circulation<RevGraph, FlowArcMap, ConstArcMap, NegNodeMap>
  1197               circ(rgraph, *_plower, ConstArcMap(inf_cap), neg_csup);
  1198               circ(rgraph, *_plower, inf_arc_map, neg_csup);
  1198             circ_result = circ.run();
  1199             circ_result = circ.run();
  1199           }
  1200           }
  1200         } else {
  1201         } else {
  1201           if (_pupper) {
  1202           if (_pupper) {
  1202             Circulation<RevGraph, ConstArcMap, FlowArcMap, NegNodeMap>
  1203             Circulation<RevGraph, ConstArcMap, FlowArcMap, NegNodeMap>
  1203               circ(rgraph, ConstArcMap(0), *_pupper, neg_csup);
  1204               circ(rgraph, zero_arc_map, *_pupper, neg_csup);
  1204             circ_result = circ.run();
  1205             circ_result = circ.run();
  1205           } else {
  1206           } else {
  1206             Circulation<RevGraph, ConstArcMap, ConstArcMap, NegNodeMap>
  1207             Circulation<RevGraph, ConstArcMap, ConstArcMap, NegNodeMap>
  1207               circ(rgraph, ConstArcMap(0), ConstArcMap(inf_cap), neg_csup);
  1208               circ(rgraph, zero_arc_map, inf_arc_map, neg_csup);
  1208             circ_result = circ.run();
  1209             circ_result = circ.run();
  1209           }
  1210           }
  1210         }
  1211         }
  1211       }
  1212       }
  1212       if (local_csup) delete csup;
  1213       if (local_csup) delete csup;