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

Function brute_force_max_cost_assignment

dlib/test/max_cost_assignment.cpp:64–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62
63 template <typename T>
64 std::vector<long> brute_force_max_cost_assignment (
65 matrix<T> cost
66 )
67 {
68 if (cost.size() == 0)
69 return std::vector<long>();
70
71 const std::vector<std::vector<long> >& perms = permutations(range(0,cost.nc()-1));
72
73 T best_cost = std::numeric_limits<T>::min();
74 unsigned long best_idx = 0;
75 for (unsigned long i = 0; i < perms.size(); ++i)
76 {
77 const T temp = assignment_cost(cost, perms[i]);
78 if (temp > best_cost)
79 {
80 best_idx = i;
81 best_cost = temp;
82 }
83 }
84
85 return perms[best_idx];
86 }
87
88// ----------------------------------------------------------------------------------------
89// ----------------------------------------------------------------------------------------

Callers 1

test_hungarianMethod · 0.85

Calls 6

permutationsFunction · 0.85
assignment_costFunction · 0.85
rangeFunction · 0.50
minFunction · 0.50
sizeMethod · 0.45
ncMethod · 0.45

Tested by

no test coverage detected