MCPcopy Create free account
hub / github.com/davisking/dlib / do_test2

Function do_test2

dlib/test/find_max_factor_graph_nmplp.cpp:722–747  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 9

print_spinnerFunction · 0.85
find_total_scoreFunction · 0.85
index_of_maxFunction · 0.85
absFunction · 0.85
rowmFunction · 0.50
transFunction · 0.50
matFunction · 0.50
resizeMethod · 0.45

Tested by

no test coverage detected