| 311 | |
| 312 | template <typename potts_model> |
| 313 | void brute_force_potts_model ( |
| 314 | potts_model& g |
| 315 | ) |
| 316 | { |
| 317 | potts_model m(g); |
| 318 | |
| 319 | const unsigned long num = (unsigned long)std::pow(2.0, (double)m.number_of_nodes()); |
| 320 | |
| 321 | double best_score = -std::numeric_limits<double>::infinity(); |
| 322 | for (unsigned long i = 0; i < num; ++i) |
| 323 | { |
| 324 | for (unsigned long j = 0; j < m.number_of_nodes(); ++j) |
| 325 | { |
| 326 | unsigned long T = (1)<<j; |
| 327 | T = (T&i); |
| 328 | if (T != 0) |
| 329 | m.set_label(j,SINK_CUT); |
| 330 | else |
| 331 | m.set_label(j,SOURCE_CUT); |
| 332 | } |
| 333 | |
| 334 | |
| 335 | double score = potts_model_score(m); |
| 336 | if (score > best_score) |
| 337 | { |
| 338 | best_score = score; |
| 339 | g = m; |
| 340 | } |
| 341 | } |
| 342 | } |
| 343 | |
| 344 | // ---------------------------------------------------------------------------------------- |
| 345 |
no test coverage detected