165 std::vector<MatchingType> &matchings) {
166 int const nRows = this->
costMatrix.size() - 1;
167 int const nCols = this->
costMatrix[0].size() - 1;
168 int const max_dim = std::max(nRows, nCols);
169 int const min_dim = std::min(nRows, nCols);
172 std::vector<std::vector<int>> allAsgn;
176 if(min_dim == 1 and max_dim == 1)
177 allAsgn = {{0}, {1, 0}};
178 else if(min_dim == 1 and max_dim == 2)
179 allAsgn = {{0, 1}, {2, 0, 1}, {1, 0}};
180 else if(min_dim == 1 and max_dim == 3)
181 allAsgn = {{0, 1, 2}, {3, 0, 1, 2}, {1, 0, 2}, {2, 0, 1}};
182 else if(min_dim == 1 and max_dim == 4)
183 allAsgn = {{0, 1, 2, 3},
188 else if(min_dim == 1 and max_dim == 5)
189 allAsgn = {{0, 1, 2, 3, 4}, {5, 0, 1, 2, 3, 4}, {1, 0, 2, 3, 4},
190 {2, 0, 1, 3, 4}, {3, 0, 1, 2, 4}, {4, 0, 1, 2, 3}};
191 else if(min_dim == 1 and max_dim == 6)
192 allAsgn = {{0, 1, 2, 3, 4, 5}, {6, 0, 1, 2, 3, 4, 5}, {1, 0, 2, 3, 4, 5},
193 {2, 0, 1, 3, 4, 5}, {3, 0, 1, 2, 4, 5}, {4, 0, 1, 2, 3, 5},
195 else if(min_dim == 2 and max_dim == 2)
196 allAsgn = {{0, 1}, {0, 2, 1}, {2, 1, 0}, {2, 2, 0, 1},
197 {1, 0}, {1, 2, 0}, {2, 0, 1}};
199 std::stringstream ss;
200 ss << min_dim <<
"_" << max_dim;
201 std::string
const asgnName = ss.str();
203 if(not saveAsgn or savedAsgn.find(asgnName) == savedAsgn.end()) {
208 savedAsgn[asgnName] = allAsgn;
209 std::stringstream ss2;
210 ss2 << allAsgn.size() <<
" done";
214 allAsgn = savedAsgn[asgnName];
218 dataType bestCost = std::numeric_limits<dataType>::max();
219 std::vector<MatchingType> bestMatching;
220 for(std::vector<int> &asgn : allAsgn) {
221 std::vector<MatchingType> tempMatching;
223 if(bestCost > cost) {
225 bestMatching = tempMatching;
228 matchings = bestMatching;