[Lemon-commits] [lemon_svn] deba: r2850 - hugo/trunk/lemon
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 21:50:48 CET 2006
Author: deba
Date: Fri Jul 14 11:37:48 2006
New Revision: 2850
Modified:
hugo/trunk/lemon/bipartite_matching.h
Log:
Bug fix in MinCostMaxBipartiteMatching
The augmenting phase have not changed the
unreached nodes' potential which caused invalid
dual solution in some cases
Modified: hugo/trunk/lemon/bipartite_matching.h
==============================================================================
--- hugo/trunk/lemon/bipartite_matching.h (original)
+++ hugo/trunk/lemon/bipartite_matching.h Fri Jul 14 11:37:48 2006
@@ -1325,6 +1325,7 @@
_heap->push(it, 0);
}
}
+ Value bdistMax = 0;
while (!_heap->empty()) {
Node anode = _heap->top();
@@ -1339,6 +1340,9 @@
bdist[bnode] = bvalue;
bpred[bnode] = jt;
}
+ if (bvalue > bdistMax) {
+ bdistMax = bvalue;
+ }
if (bnode_matching[bnode] != INVALID) {
Node newanode = graph->aNode(bnode_matching[bnode]);
switch (_heap->state(newanode)) {
@@ -1373,6 +1377,8 @@
for (BNodeIt it(*graph); it != INVALID; ++it) {
if (bpred[it] != INVALID) {
bnode_potential[it] += bdist[it];
+ } else {
+ bnode_potential[it] += bdistMax;
}
}
for (ANodeIt it(*graph); it != INVALID; ++it) {
@@ -1380,6 +1386,8 @@
Node bnode = graph->bNode(anode_matching[it]);
if (bpred[bnode] != INVALID) {
anode_potential[it] += bdist[bnode];
+ } else {
+ anode_potential[it] += bdistMax;
}
}
}
More information about the Lemon-commits
mailing list