| ... | ... |
@@ -589,25 +589,27 @@ |
| 589 | 589 |
// A cycle is found |
| 590 | 590 |
length = _data[u][level[u].second].dist - _data[u][j].dist; |
| 591 | 591 |
size = level[u].second - j; |
| 592 | 592 |
if (!_curr_found || length * _curr_size < _curr_length * size) {
|
| 593 | 593 |
_curr_length = length; |
| 594 | 594 |
_curr_size = size; |
| 595 | 595 |
_curr_node = u; |
| 596 | 596 |
_curr_level = level[u].second; |
| 597 | 597 |
_curr_found = true; |
| 598 | 598 |
} |
| 599 | 599 |
} |
| 600 | 600 |
level[u] = Pair(i, j); |
| 601 |
|
|
| 601 |
if (j != 0) {
|
|
| 602 |
u = _gr.source(_data[u][j].pred); |
|
| 603 |
} |
|
| 602 | 604 |
} |
| 603 | 605 |
} |
| 604 | 606 |
|
| 605 | 607 |
// If at least one cycle is found, check the optimality condition |
| 606 | 608 |
LargeValue d; |
| 607 | 609 |
if (_curr_found && k < n) {
|
| 608 | 610 |
// Find node potentials |
| 609 | 611 |
for (int i = 0; i < n; ++i) {
|
| 610 | 612 |
u = (*_nodes)[i]; |
| 611 | 613 |
pi[u] = INF; |
| 612 | 614 |
for (int j = 0; j <= k; ++j) {
|
| 613 | 615 |
if (_data[u][j].dist < INF) {
|
0 comments (0 inline)