# HG changeset patch # User Balazs Dezso # Date 2010-03-17 12:35:52 # Node ID 7f6e2bd76654d649dadebceb30a84fe937f02728 # Parent 07ec2b52e53d88b75130f02f246b156a1a7c38c0 Fix multiple executions in matchings (fract. mathcings) (#356) 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::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::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::max());