| 720 | |
| 721 | template <typename map_problem> |
| 722 | void do_test2( |
| 723 | ) |
| 724 | { |
| 725 | print_spinner(); |
| 726 | std::vector<unsigned long> map_assignment1, map_assignment2; |
| 727 | map_problem prob; |
| 728 | find_max_factor_graph_nmplp(prob, map_assignment1, 10, 1e-8); |
| 729 | |
| 730 | const double score1 = find_total_score(prob, map_assignment1); |
| 731 | |
| 732 | map_assignment2.resize(6); |
| 733 | map_assignment2[0] = index_of_max(rowm(prob.numbers,0)); |
| 734 | map_assignment2[1] = index_of_max(rowm(prob.numbers,1)); |
| 735 | map_assignment2[2] = index_of_max(rowm(prob.numbers,2)); |
| 736 | map_assignment2[3] = index_of_max(rowm(prob.numbers,3)); |
| 737 | map_assignment2[4] = index_of_max(rowm(prob.numbers,4)); |
| 738 | map_assignment2[5] = 1; |
| 739 | const double score2 = find_total_score(prob, map_assignment2); |
| 740 | |
| 741 | dlog << LINFO << "score NMPLP: " << score1; |
| 742 | dlog << LINFO << "score MAP: " << score2; |
| 743 | dlog << LINFO << "MAP assignment: "<< trans(mat(map_assignment1)); |
| 744 | |
| 745 | DLIB_TEST(std::abs(score1 - score2) < 1e-10); |
| 746 | DLIB_TEST(mat(map_assignment1) == mat(map_assignment2)); |
| 747 | } |
| 748 | |
| 749 | // ---------------------------------------------------------------------------------------- |
| 750 |
nothing calls this directly
no test coverage detected