Changeset 918:8583fb74238c in lemon-main for test
- Timestamp:
- 01/08/11 15:52:07 (14 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
test/max_clique_test.cc
r904 r918 59 59 // Check with general graphs 60 60 template <typename Param> 61 void checkMaxCliqueGeneral( int max_sel,Param rule) {61 void checkMaxCliqueGeneral(Param rule) { 62 62 typedef ListGraph GR; 63 63 typedef GrossoLocatelliPullanMc<GR> McAlg; … … 69 69 GR::NodeMap<bool> map(g); 70 70 McAlg mc(g); 71 check(mc.run(max_sel, rule) == 0, "Wrong clique size"); 71 mc.iterationLimit(50); 72 check(mc.run(rule) == McAlg::SIZE_LIMIT, "Wrong termination cause"); 72 73 check(mc.cliqueSize() == 0, "Wrong clique size"); 73 74 check(CliqueIt(mc) == INVALID, "Wrong CliqueNodeIt"); 74 75 75 76 GR::Node u = g.addNode(); 76 check(mc.run( max_sel, rule) == 1, "Wrong clique size");77 check(mc.run(rule) == McAlg::SIZE_LIMIT, "Wrong termination cause"); 77 78 check(mc.cliqueSize() == 1, "Wrong clique size"); 78 79 mc.cliqueMap(map); … … 83 84 84 85 GR::Node v = g.addNode(); 85 check(mc.run( max_sel, rule) == 1, "Wrong clique size");86 check(mc.run(rule) == McAlg::ITERATION_LIMIT, "Wrong termination cause"); 86 87 check(mc.cliqueSize() == 1, "Wrong clique size"); 87 88 mc.cliqueMap(map); … … 91 92 92 93 g.addEdge(u, v); 93 check(mc.run( max_sel, rule) == 2, "Wrong clique size");94 check(mc.run(rule) == McAlg::SIZE_LIMIT, "Wrong termination cause"); 94 95 check(mc.cliqueSize() == 2, "Wrong clique size"); 95 96 mc.cliqueMap(map); … … 111 112 112 113 McAlg mc(g); 113 check(mc.run(max_sel, rule) == 4, "Wrong clique size"); 114 mc.iterationLimit(50); 115 check(mc.run(rule) == McAlg::ITERATION_LIMIT, "Wrong termination cause"); 114 116 check(mc.cliqueSize() == 4, "Wrong clique size"); 115 117 mc.cliqueMap(map); … … 128 130 // Check with full graphs 129 131 template <typename Param> 130 void checkMaxCliqueFullGraph( int max_sel,Param rule) {132 void checkMaxCliqueFullGraph(Param rule) { 131 133 typedef FullGraph GR; 132 134 typedef GrossoLocatelliPullanMc<FullGraph> McAlg; … … 137 139 GR::NodeMap<bool> map(g); 138 140 McAlg mc(g); 139 check(mc.run( max_sel, rule) == size, "Wrong clique size");141 check(mc.run(rule) == McAlg::SIZE_LIMIT, "Wrong termination cause"); 140 142 check(mc.cliqueSize() == size, "Wrong clique size"); 141 143 mc.cliqueMap(map); … … 151 153 // Check with grid graphs 152 154 template <typename Param> 153 void checkMaxCliqueGridGraph( int max_sel,Param rule) {155 void checkMaxCliqueGridGraph(Param rule) { 154 156 GridGraph g(5, 7); 155 157 GridGraph::NodeMap<char> map(g); 156 158 GrossoLocatelliPullanMc<GridGraph> mc(g); 157 check(mc.run(max_sel, rule) == 2, "Wrong clique size"); 159 160 mc.iterationLimit(100); 161 check(mc.run(rule) == mc.ITERATION_LIMIT, "Wrong termination cause"); 162 check(mc.cliqueSize() == 2, "Wrong clique size"); 163 164 mc.stepLimit(100); 165 check(mc.run(rule) == mc.STEP_LIMIT, "Wrong termination cause"); 166 check(mc.cliqueSize() == 2, "Wrong clique size"); 167 168 mc.sizeLimit(2); 169 check(mc.run(rule) == mc.SIZE_LIMIT, "Wrong termination cause"); 158 170 check(mc.cliqueSize() == 2, "Wrong clique size"); 159 171 } … … 161 173 162 174 int main() { 163 checkMaxCliqueGeneral( 50,GrossoLocatelliPullanMc<ListGraph>::RANDOM);164 checkMaxCliqueGeneral( 50,GrossoLocatelliPullanMc<ListGraph>::DEGREE_BASED);165 checkMaxCliqueGeneral( 50,GrossoLocatelliPullanMc<ListGraph>::PENALTY_BASED);175 checkMaxCliqueGeneral(GrossoLocatelliPullanMc<ListGraph>::RANDOM); 176 checkMaxCliqueGeneral(GrossoLocatelliPullanMc<ListGraph>::DEGREE_BASED); 177 checkMaxCliqueGeneral(GrossoLocatelliPullanMc<ListGraph>::PENALTY_BASED); 166 178 167 checkMaxCliqueFullGraph( 50,GrossoLocatelliPullanMc<FullGraph>::RANDOM);168 checkMaxCliqueFullGraph( 50,GrossoLocatelliPullanMc<FullGraph>::DEGREE_BASED);169 checkMaxCliqueFullGraph( 50,GrossoLocatelliPullanMc<FullGraph>::PENALTY_BASED);179 checkMaxCliqueFullGraph(GrossoLocatelliPullanMc<FullGraph>::RANDOM); 180 checkMaxCliqueFullGraph(GrossoLocatelliPullanMc<FullGraph>::DEGREE_BASED); 181 checkMaxCliqueFullGraph(GrossoLocatelliPullanMc<FullGraph>::PENALTY_BASED); 170 182 171 checkMaxCliqueGridGraph( 50,GrossoLocatelliPullanMc<GridGraph>::RANDOM);172 checkMaxCliqueGridGraph( 50,GrossoLocatelliPullanMc<GridGraph>::DEGREE_BASED);173 checkMaxCliqueGridGraph( 50,GrossoLocatelliPullanMc<GridGraph>::PENALTY_BASED);183 checkMaxCliqueGridGraph(GrossoLocatelliPullanMc<GridGraph>::RANDOM); 184 checkMaxCliqueGridGraph(GrossoLocatelliPullanMc<GridGraph>::DEGREE_BASED); 185 checkMaxCliqueGridGraph(GrossoLocatelliPullanMc<GridGraph>::PENALTY_BASED); 174 186 175 187 return 0;
Note: See TracChangeset
for help on using the changeset viewer.