Fawkes API
Fawkes Development Version
|
Hungarian method assignment solver. More...
#include <>>
Public Member Functions | |
HungarianMethod () | |
Constructor. More... | |
~HungarianMethod () | |
Destructor. More... | |
int | init (int **cost_matrix, int rows, int cols, int mode) |
Initialize hungarian method. More... | |
void | free () |
Free space alloacted by method. More... | |
void | solve () |
Solve the assignment problem. More... | |
bool | is_available () |
Check if data is available. More... | |
int | get_column_assignment (const int &col) |
Get column assignment. More... | |
int | get_row_assignment (const int &row) |
Get row assignment. More... | |
int * | get_assignment (int &size) |
Get assignment and size. More... | |
int ** | array_to_matrix (int *m, int rows, int cols) |
Convert an array to a matrix. More... | |
void | print_assignment () |
Print the assignment matrix. More... | |
void | print_cost_matrix () |
Print the cost matrix. More... | |
void | print_status () |
Print the current status. More... | |
Public Attributes | |
hungarian_problem_t * | p |
our problem instance member. More... | |
Protected Member Functions | |
void | print_matrix (int **C, int rows, int cols) |
Print matrix to stdout. More... | |
Hungarian method assignment solver.
Definition at line 49 of file hungarian.h.
fawkes::HungarianMethod::HungarianMethod | ( | ) |
fawkes::HungarianMethod::~HungarianMethod | ( | ) |
int ** fawkes::HungarianMethod::array_to_matrix | ( | int * | m, |
int | rows, | ||
int | cols | ||
) |
Convert an array to a matrix.
m | array to convert |
rows | number of rows in array |
cols | number of columns in array |
Definition at line 96 of file hungarian.cpp.
void fawkes::HungarianMethod::free | ( | ) |
Free space alloacted by method.
Definition at line 225 of file hungarian.cpp.
References p.
Referenced by solve(), and ~HungarianMethod().
int * fawkes::HungarianMethod::get_assignment | ( | int & | size | ) |
Get assignment and size.
size | number of rows/columns in quadratic matrix |
Definition at line 592 of file hungarian.cpp.
References p.
Referenced by TabletopObjectsThread::loop().
int fawkes::HungarianMethod::get_column_assignment | ( | const int & | col | ) |
Get column assignment.
col | column index |
col
is out of bounds. Definition at line 552 of file hungarian.cpp.
int fawkes::HungarianMethod::get_row_assignment | ( | const int & | row | ) |
Get row assignment.
row | row index |
row
is out of bounds. Definition at line 567 of file hungarian.cpp.
int fawkes::HungarianMethod::init | ( | int ** | cost_matrix, |
int | rows, | ||
int | cols, | ||
int | mode | ||
) |
Initialize hungarian method.
cost_matrix | initial cost matrix |
rows | number of rows in matrix |
cols | number of columns in matrix |
mode | One of HUNGARIAN_MODE_MINIMIZE_COST and HUNGARIAN_MODE_MAXIMIZE_UTIL |
Definition at line 148 of file hungarian.cpp.
References p.
Referenced by TabletopObjectsThread::loop().
bool fawkes::HungarianMethod::is_available | ( | ) |
Check if data is available.
solve done and not freed yet.
Definition at line 581 of file hungarian.cpp.
void fawkes::HungarianMethod::print_assignment | ( | ) |
Print the assignment matrix.
Definition at line 113 of file hungarian.cpp.
References p, and print_matrix().
Referenced by print_status().
void fawkes::HungarianMethod::print_cost_matrix | ( | ) |
Print the cost matrix.
Definition at line 123 of file hungarian.cpp.
References p, and print_matrix().
Referenced by print_status().
|
protected |
Print matrix to stdout.
C | values |
rows | number of rows |
cols | number of columns |
Definition at line 72 of file hungarian.cpp.
Referenced by print_assignment(), and print_cost_matrix().
void fawkes::HungarianMethod::print_status | ( | ) |
Print the current status.
Prints cost matrix followed by assignment.
Definition at line 134 of file hungarian.cpp.
References print_assignment(), and print_cost_matrix().
void fawkes::HungarianMethod::solve | ( | ) |
Solve the assignment problem.
This method computes the optimal assignment.
Definition at line 251 of file hungarian.cpp.
Referenced by TabletopObjectsThread::loop().
hungarian_problem_t* fawkes::HungarianMethod::p |
our problem instance member.
Definition at line 75 of file hungarian.h.
Referenced by free(), get_assignment(), HungarianMethod(), init(), print_assignment(), print_cost_matrix(), solve(), and ~HungarianMethod().