1.1 --- a/test/matching_test.cc Tue Dec 20 17:44:38 2011 +0100
1.2 +++ b/test/matching_test.cc Tue Dec 20 18:15:14 2011 +0100
1.3 @@ -2,7 +2,7 @@
1.4 *
1.5 * This file is a part of LEMON, a generic C++ optimization library.
1.6 *
1.7 - * Copyright (C) 2003-2009
1.8 + * Copyright (C) 2003-2010
1.9 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
1.10 * (Egervary Research Group on Combinatorial Optimization, EGRES).
1.11 *
1.12 @@ -134,7 +134,7 @@
1.13 mat_test.startSparse();
1.14 mat_test.startDense();
1.15 mat_test.run();
1.16 -
1.17 +
1.18 const_mat_test.matchingSize();
1.19 const_mat_test.matching(e);
1.20 const_mat_test.matching(n);
1.21 @@ -143,7 +143,7 @@
1.22 e = mmap[n];
1.23 const_mat_test.mate(n);
1.24
1.25 - MaxMatching<Graph>::Status stat =
1.26 + MaxMatching<Graph>::Status stat =
1.27 const_mat_test.status(n);
1.28 const MaxMatching<Graph>::StatusMap& smap =
1.29 const_mat_test.statusMap();
1.30 @@ -170,7 +170,7 @@
1.31 mat_test.init();
1.32 mat_test.start();
1.33 mat_test.run();
1.34 -
1.35 +
1.36 const_mat_test.matchingWeight();
1.37 const_mat_test.matchingSize();
1.38 const_mat_test.matching(e);
1.39 @@ -179,7 +179,7 @@
1.40 const_mat_test.matchingMap();
1.41 e = mmap[n];
1.42 const_mat_test.mate(n);
1.43 -
1.44 +
1.45 int k = 0;
1.46 const_mat_test.dualValue();
1.47 const_mat_test.nodeValue(n);
1.48 @@ -207,7 +207,7 @@
1.49 mat_test.init();
1.50 mat_test.start();
1.51 mat_test.run();
1.52 -
1.53 +
1.54 const_mat_test.matchingWeight();
1.55 const_mat_test.matching(e);
1.56 const_mat_test.matching(n);
1.57 @@ -215,7 +215,7 @@
1.58 const_mat_test.matchingMap();
1.59 e = mmap[n];
1.60 const_mat_test.mate(n);
1.61 -
1.62 +
1.63 int k = 0;
1.64 const_mat_test.dualValue();
1.65 const_mat_test.nodeValue(n);
1.66 @@ -401,22 +401,46 @@
1.67 graphReader(graph, lgfs).
1.68 edgeMap("weight", weight).run();
1.69
1.70 - MaxMatching<SmartGraph> mm(graph);
1.71 - mm.run();
1.72 - checkMatching(graph, mm);
1.73 + bool perfect;
1.74 + {
1.75 + MaxMatching<SmartGraph> mm(graph);
1.76 + mm.run();
1.77 + checkMatching(graph, mm);
1.78 + perfect = 2 * mm.matchingSize() == countNodes(graph);
1.79 + }
1.80
1.81 - MaxWeightedMatching<SmartGraph> mwm(graph, weight);
1.82 - mwm.run();
1.83 - checkWeightedMatching(graph, weight, mwm);
1.84 + {
1.85 + MaxWeightedMatching<SmartGraph> mwm(graph, weight);
1.86 + mwm.run();
1.87 + checkWeightedMatching(graph, weight, mwm);
1.88 + }
1.89
1.90 - MaxWeightedPerfectMatching<SmartGraph> mwpm(graph, weight);
1.91 - bool perfect = mwpm.run();
1.92 + {
1.93 + MaxWeightedMatching<SmartGraph> mwm(graph, weight);
1.94 + mwm.init();
1.95 + mwm.start();
1.96 + checkWeightedMatching(graph, weight, mwm);
1.97 + }
1.98
1.99 - check(perfect == (mm.matchingSize() * 2 == countNodes(graph)),
1.100 - "Perfect matching found");
1.101 + {
1.102 + MaxWeightedPerfectMatching<SmartGraph> mwpm(graph, weight);
1.103 + bool result = mwpm.run();
1.104
1.105 - if (perfect) {
1.106 - checkWeightedPerfectMatching(graph, weight, mwpm);
1.107 + check(result == perfect, "Perfect matching found");
1.108 + if (perfect) {
1.109 + checkWeightedPerfectMatching(graph, weight, mwpm);
1.110 + }
1.111 + }
1.112 +
1.113 + {
1.114 + MaxWeightedPerfectMatching<SmartGraph> mwpm(graph, weight);
1.115 + mwpm.init();
1.116 + bool result = mwpm.start();
1.117 +
1.118 + check(result == perfect, "Perfect matching found");
1.119 + if (perfect) {
1.120 + checkWeightedPerfectMatching(graph, weight, mwpm);
1.121 + }
1.122 }
1.123 }
1.124