... | ... |
@@ -1068,25 +1068,25 @@ |
1068 | 1068 |
} |
1069 | 1069 |
} else { |
1070 | 1070 |
for (int i = 0; i != _arc_num; ++i) { |
1071 | 1071 |
_cap[i] = _upper[i]; |
1072 | 1072 |
} |
1073 | 1073 |
} |
1074 | 1074 |
|
1075 | 1075 |
// Initialize artifical cost |
1076 | 1076 |
Cost ART_COST; |
1077 | 1077 |
if (std::numeric_limits<Cost>::is_exact) { |
1078 | 1078 |
ART_COST = std::numeric_limits<Cost>::max() / 2 + 1; |
1079 | 1079 |
} else { |
1080 |
ART_COST = |
|
1080 |
ART_COST = 0; |
|
1081 | 1081 |
for (int i = 0; i != _arc_num; ++i) { |
1082 | 1082 |
if (_cost[i] > ART_COST) ART_COST = _cost[i]; |
1083 | 1083 |
} |
1084 | 1084 |
ART_COST = (ART_COST + 1) * _node_num; |
1085 | 1085 |
} |
1086 | 1086 |
|
1087 | 1087 |
// Initialize arc maps |
1088 | 1088 |
for (int i = 0; i != _arc_num; ++i) { |
1089 | 1089 |
_flow[i] = 0; |
1090 | 1090 |
_state[i] = STATE_LOWER; |
1091 | 1091 |
} |
1092 | 1092 |
|
... | ... |
@@ -1580,25 +1580,25 @@ |
1580 | 1580 |
if (c != 0) { |
1581 | 1581 |
_flow[i] += c; |
1582 | 1582 |
_supply[_source[i]] += c; |
1583 | 1583 |
_supply[_target[i]] -= c; |
1584 | 1584 |
} |
1585 | 1585 |
} |
1586 | 1586 |
} |
1587 | 1587 |
|
1588 | 1588 |
// Shift potentials to meet the requirements of the GEQ/LEQ type |
1589 | 1589 |
// optimality conditions |
1590 | 1590 |
if (_sum_supply == 0) { |
1591 | 1591 |
if (_stype == GEQ) { |
1592 |
Cost max_pot = std::numeric_limits<Cost>:: |
|
1592 |
Cost max_pot = -std::numeric_limits<Cost>::max(); |
|
1593 | 1593 |
for (int i = 0; i != _node_num; ++i) { |
1594 | 1594 |
if (_pi[i] > max_pot) max_pot = _pi[i]; |
1595 | 1595 |
} |
1596 | 1596 |
if (max_pot > 0) { |
1597 | 1597 |
for (int i = 0; i != _node_num; ++i) |
1598 | 1598 |
_pi[i] -= max_pot; |
1599 | 1599 |
} |
1600 | 1600 |
} else { |
1601 | 1601 |
Cost min_pot = std::numeric_limits<Cost>::max(); |
1602 | 1602 |
for (int i = 0; i != _node_num; ++i) { |
1603 | 1603 |
if (_pi[i] < min_pot) min_pot = _pi[i]; |
1604 | 1604 |
} |
0 comments (0 inline)