[Lemon-user] Executing one aglortihm multiple times

Ben Strasser mail at ben-strasser.net
Sat Mar 13 14:12:23 CET 2010


Hello,

I'm having problems understanding how the init/start/run functions of 
the algorithm classes such as MaxWeightedPerfectMatching are supposed to 
be used. At which points am I allowed to change which parameters of the 
algorithm? How do I rerun the algorithm after changing a few paramters?

Unfortunately the documenation of this subject is pretty sparse. :(

I have a graph and several weights and I want to calculate a matching 
for each. What usage pattern am I supposed to employ?

=== Version 1 ===

Graph g;
Graph::EdgeMap<int>w(g);
// fill g and w
{
 MaxWeightedPerfectMatching mm(g, w);
 mm.run();
 // extract matching
}
// modify w
{
 MaxWeightedPerfectMatching mm(g, w);
 mm.run();
 // extract matching
}

(Works be seems suboptimal)

=== Version 2 ===

Graph g;
Graph::EdgeMap<int>w(g);
// fill g and w
MaxWeightedPerfectMatching mm(g, w);
mm.run();
// extract matching
// modify w
mm.run();
// extract matching

(Crashs in 1.1.2)

=== Version 3 ===

Graph g;
Graph::EdgeMap<int>w(g);
// fill g and w
MaxWeightedPerfectMatching mm(g, w);
mm.init();
mm.start();
// extract matching
// modify w
mm.start();
// extract matching

(Seems to work, meaning it doesn't crash.)

Thanks for your time,
Ben Strasser





More information about the Lemon-user mailing list