... | ... |
@@ -1036,26 +1036,26 @@ |
1036 | 1036 |
|
1037 | 1037 |
private: |
1038 | 1038 |
|
1039 | 1039 |
// Initialize internal data structures |
1040 | 1040 |
bool init() { |
1041 | 1041 |
if (_node_num == 0) return false; |
1042 | 1042 |
|
1043 | 1043 |
// Check the sum of supply values |
1044 | 1044 |
_sum_supply = 0; |
1045 | 1045 |
for (int i = 0; i != _node_num; ++i) { |
1046 | 1046 |
_sum_supply += _supply[i]; |
1047 | 1047 |
} |
1048 |
if ( !(_stype == GEQ && _sum_supply <= 0 || |
|
1049 |
_stype == LEQ && _sum_supply >= 0) ) return false; |
|
1048 |
if ( !((_stype == GEQ && _sum_supply <= 0) || |
|
1049 |
(_stype == LEQ && _sum_supply >= 0)) ) return false; |
|
1050 | 1050 |
|
1051 | 1051 |
// Remove non-zero lower bounds |
1052 | 1052 |
if (_have_lower) { |
1053 | 1053 |
for (int i = 0; i != _arc_num; ++i) { |
1054 | 1054 |
Value c = _lower[i]; |
1055 | 1055 |
if (c >= 0) { |
1056 | 1056 |
_cap[i] = _upper[i] < INF ? _upper[i] - c : INF; |
1057 | 1057 |
} else { |
1058 | 1058 |
_cap[i] = _upper[i] < INF + c ? _upper[i] - c : INF; |
1059 | 1059 |
} |
1060 | 1060 |
_supply[_source[i]] -= c; |
1061 | 1061 |
_supply[_target[i]] += c; |
0 comments (0 inline)