-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathmain.cpp
More file actions
34 lines (23 loc) · 851 Bytes
/
main.cpp
File metadata and controls
34 lines (23 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <iostream>
#include "Miller.h"
using namespace std;
int main()
{
// use cols > rows!
MurtyMiller<double>::WeightMatrix c_ij(20, 30);
typedef MurtyMiller<double>::Edges Edges;
c_ij = MurtyMiller<double>::WeightMatrix::Random(20, 30);
for ( size_t r = 0; r < c_ij.rows(); ++r )
for ( size_t c = 0; c < c_ij.cols(); ++c )
if ( c_ij(r, c) < 0 ) c_ij(r, c) = -c_ij(r, c);
c_ij /= c_ij.maxCoeff();
std::cerr << "c_ij = \n" << c_ij << std::endl;
std::vector<Edges> solutions = MurtyMiller<double>::getMBestAssignments(c_ij, 100);
for ( const auto & s : solutions )
{
for ( const auto & e : s )
std::cerr << "(" << e.x << ", " << e.y << ") ";
std::cerr << "sum = " << MurtyMiller<double>::objectiveFunctionValue(s) << std::endl;
}
return 0;
}