Changeset 811:fe80a8145653 in lemon-main for lemon/network_simplex.h
- Timestamp:
- 11/12/09 23:45:15 (14 years ago)
- Branch:
- default
- Phase:
- public
- Rebase:
- 35386664633435303433383038316635626132313231366463363862653565653936303733646463
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/network_simplex.h
r788 r811 165 165 166 166 typedef std::vector<int> IntVector; 167 typedef std::vector< bool> BoolVector;167 typedef std::vector<char> CharVector; 168 168 typedef std::vector<Value> ValueVector; 169 169 typedef std::vector<Cost> CostVector; … … 213 213 IntVector _last_succ; 214 214 IntVector _dirty_revs; 215 BoolVector _forward;216 IntVector _state;215 CharVector _forward; 216 CharVector _state; 217 217 int _root; 218 218 … … 222 222 int stem, par_stem, new_stem; 223 223 Value delta; 224 225 const Value MAX; 224 226 225 227 public: … … 243 245 const IntVector &_target; 244 246 const CostVector &_cost; 245 const IntVector&_state;247 const CharVector &_state; 246 248 const CostVector &_pi; 247 249 int &_in_arc; … … 295 297 const IntVector &_target; 296 298 const CostVector &_cost; 297 const IntVector&_state;299 const CharVector &_state; 298 300 const CostVector &_pi; 299 301 int &_in_arc; … … 334 336 const IntVector &_target; 335 337 const CostVector &_cost; 336 const IntVector&_state;338 const CharVector &_state; 337 339 const CostVector &_pi; 338 340 int &_in_arc; … … 407 409 const IntVector &_target; 408 410 const CostVector &_cost; 409 const IntVector&_state;411 const CharVector &_state; 410 412 const CostVector &_pi; 411 413 int &_in_arc; … … 510 512 const IntVector &_target; 511 513 const CostVector &_cost; 512 const IntVector&_state;514 const CharVector &_state; 513 515 const CostVector &_pi; 514 516 int &_in_arc; … … 632 634 NetworkSimplex(const GR& graph, bool arc_mixing = false) : 633 635 _graph(graph), _node_id(graph), _arc_id(graph), 636 MAX(std::numeric_limits<Value>::max()), 634 637 INF(std::numeric_limits<Value>::has_infinity ? 635 std::numeric_limits<Value>::infinity() : 636 std::numeric_limits<Value>::max()) 638 std::numeric_limits<Value>::infinity() : MAX) 637 639 { 638 640 // Check the value types … … 1021 1023 Value c = _lower[i]; 1022 1024 if (c >= 0) { 1023 _cap[i] = _upper[i] < INF? _upper[i] - c : INF;1025 _cap[i] = _upper[i] < MAX ? _upper[i] - c : INF; 1024 1026 } else { 1025 _cap[i] = _upper[i] < INF+ c ? _upper[i] - c : INF;1027 _cap[i] = _upper[i] < MAX + c ? _upper[i] - c : INF; 1026 1028 } 1027 1029 _supply[_source[i]] -= c; … … 1215 1217 e = _pred[u]; 1216 1218 d = _forward[u] ? 1217 _flow[e] : (_cap[e] == INF? INF : _cap[e] - _flow[e]);1219 _flow[e] : (_cap[e] >= MAX ? INF : _cap[e] - _flow[e]); 1218 1220 if (d < delta) { 1219 1221 delta = d; … … 1226 1228 e = _pred[u]; 1227 1229 d = _forward[u] ? 1228 (_cap[e] == INF? INF : _cap[e] - _flow[e]) : _flow[e];1230 (_cap[e] >= MAX ? INF : _cap[e] - _flow[e]) : _flow[e]; 1229 1231 if (d <= delta) { 1230 1232 delta = d; … … 1425 1427 findJoinNode(); 1426 1428 bool change = findLeavingArc(); 1427 if (delta >= INF) return UNBOUNDED;1429 if (delta >= MAX) return UNBOUNDED; 1428 1430 changeFlow(change); 1429 1431 if (change) {
Note: See TracChangeset
for help on using the changeset viewer.