-
Notifications
You must be signed in to change notification settings - Fork 0
/
testMain.cpp
25 lines (19 loc) · 865 Bytes
/
testMain.cpp
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
#include <iostream>
#include "Hungarian.h"
#include "testMain.h"
int main(void)
{
//initializing costmatrix variable with the type vector of vectors matrix
vector< vector<double> > costMatrix = { { 82, 83, 69, 92 },
{ 77, 37, 49, 92},
{ 11, 69,5, 86},
{ 8, 9, 98, 23 } };
HungarianAlgorithm HungAlgo; // initializing hungalgo object from hungarianalgorithm class
vector<int> assignment;
//initializing assignment variable with the type vector matrix
double cost = HungAlgo.Solve(costMatrix, assignment); //calling solve function with passing costmatrix and assignment parameters to it
for (unsigned int x = 0; x < costMatrix.size(); x++)
std::cout << x << "," << assignment[x] << "\t"; // printing the the positions of zeros
std::cout << "\ncost: " << cost << std::endl; // printing the cost
return 0;
}