[Lemon-commits] Balazs Dezso: Fix multiple executions in matchin...
Lemon HG
hg at lemon.cs.elte.hu
Wed Mar 17 13:47:13 CET 2010
details: http://lemon.cs.elte.hu/hg/lemon/rev/7f6e2bd76654
changeset: 955:7f6e2bd76654
user: Balazs Dezso <deba [at] inf.elte.hu>
date: Wed Mar 17 12:35:52 2010 +0100
description:
Fix multiple executions in matchings (fract. mathcings) (#356)
diffstat:
lemon/fractional_matching.h | 9 +++++++++
lemon/matching.h | 23 +++++++++++++++++++++++
2 files changed, 32 insertions(+), 0 deletions(-)
diffs (90 lines):
diff --git a/lemon/fractional_matching.h b/lemon/fractional_matching.h
--- a/lemon/fractional_matching.h
+++ b/lemon/fractional_matching.h
@@ -1166,6 +1166,11 @@
(*_delta3_index)[e] = _delta3->PRE_HEAP;
}
+ _delta1->clear();
+ _delta2->clear();
+ _delta3->clear();
+ _tree_set->clear();
+
for (NodeIt n(_graph); n != INVALID; ++n) {
Value max = 0;
for (OutArcIt e(_graph, n); e != INVALID; ++e) {
@@ -1905,6 +1910,10 @@
(*_delta3_index)[e] = _delta3->PRE_HEAP;
}
+ _delta2->clear();
+ _delta3->clear();
+ _tree_set->clear();
+
for (NodeIt n(_graph); n != INVALID; ++n) {
Value max = - std::numeric_limits<Value>::max();
for (OutArcIt e(_graph, n); e != INVALID; ++e) {
diff --git a/lemon/matching.h b/lemon/matching.h
--- a/lemon/matching.h
+++ b/lemon/matching.h
@@ -1675,6 +1675,9 @@
/// matching. This initialization is also called jumpstart heuristic.
void fractionalInit() {
createStructures();
+
+ _blossom_node_list.clear();
+ _blossom_potential.clear();
if (_fractional == 0) {
_fractional = new FractionalMatching(_graph, _weight, false);
@@ -1697,11 +1700,20 @@
_unmatched = 0;
+ _delta1->clear();
+ _delta2->clear();
+ _delta3->clear();
+ _delta4->clear();
+ _blossom_set->clear();
+ _tree_set->clear();
+
int index = 0;
for (NodeIt n(_graph); n != INVALID; ++n) {
Value pot = _fractional->nodeValue(n);
(*_node_index)[n] = index;
(*_node_data)[index].pot = pot;
+ (*_node_data)[index].heap_index.clear();
+ (*_node_data)[index].heap.clear();
int blossom =
_blossom_set->insert(n, std::numeric_limits<Value>::max());
@@ -3080,6 +3092,9 @@
/// matching. This initialization is also called jumpstart heuristic.
void fractionalInit() {
createStructures();
+
+ _blossom_node_list.clear();
+ _blossom_potential.clear();
if (_fractional == 0) {
_fractional = new FractionalMatching(_graph, _weight, false);
@@ -3102,11 +3117,19 @@
_unmatched = 0;
+ _delta2->clear();
+ _delta3->clear();
+ _delta4->clear();
+ _blossom_set->clear();
+ _tree_set->clear();
+
int index = 0;
for (NodeIt n(_graph); n != INVALID; ++n) {
Value pot = _fractional->nodeValue(n);
(*_node_index)[n] = index;
(*_node_data)[index].pot = pot;
+ (*_node_data)[index].heap_index.clear();
+ (*_node_data)[index].heap.clear();
int blossom =
_blossom_set->insert(n, std::numeric_limits<Value>::max());
More information about the Lemon-commits
mailing list