|
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 47 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 97 of file hungarian.cpp.
| void fawkes::HungarianMethod::free | ( | ) |
Free space alloacted by method.
Definition at line 223 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 571 of file hungarian.cpp.
References p.
| int fawkes::HungarianMethod::get_column_assignment | ( | const int & | col | ) |
Get column assignment.
| col | column index |
col is out of bounds. Definition at line 533 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 547 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 147 of file hungarian.cpp.
References p.
| bool fawkes::HungarianMethod::is_available | ( | ) |
Check if data is available.
solve done and not freed yet.
Definition at line 561 of file hungarian.cpp.
| void fawkes::HungarianMethod::print_assignment | ( | ) |
Print the assignment matrix.
Definition at line 112 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 122 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 73 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 133 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 248 of file hungarian.cpp.
| hungarian_problem_t* fawkes::HungarianMethod::p |
our problem instance member.
Definition at line 72 of file hungarian.h.
Referenced by free(), get_assignment(), HungarianMethod(), init(), print_assignment(), print_cost_matrix(), solve(), and ~HungarianMethod().