|
GEDLIB
1.0
|
This class solves LSAP instances by calling the library lsape available at https://bougleux.users.greyc.fr/lsape/. More...
#include <lsap_solver.hpp>
Public Types | |
| enum | GreedyMethod { BASIC =0, REFINED =1, LOSS =2, BASIC_SORT =3, INT_BASIC_SORT =4 } |
| Selects a greedy method. More... | |
Public Member Functions | |
| LSAPSolver (const DMatrix *cost_matrix) | |
| Constructs solver for LSAP problem instance. More... | |
| LSAPSolver () | |
| Constructs empty solver. | |
| void | solve (int num_solutions=1) |
| Solves the LSAP problem instance. More... | |
| void | set_problem (const DMatrix *cost_matrix) |
| Sets the LSAP problem instance. More... | |
| void | set_greedy_method (const GreedyMethod &greedy_method) |
| Makes the solver use a greedy method. More... | |
| void | set_hungarian_algorithm () |
| Makes the solver use the Hungarian algorithm for optimal solving. | |
| void | clear_solution () |
| Clears a previously computed solution. | |
| double | minimal_cost () const |
| Returns the cost of the computed solutions. More... | |
| std::size_t | get_assigned_col (std::size_t row, std::size_t solution_id=0) const |
| Returns the assigned column. More... | |
| std::size_t | get_assigned_row (std::size_t col, std::size_t solution_id=0) const |
| Returns the assigned row. More... | |
| double | get_slack (std::size_t row, std::size_t col) const |
| Returns the slack of a cell. More... | |
| double | get_dual_var_row (std::size_t row) const |
| Returns the dual variable of a row. More... | |
| double | get_dual_var_col (std::size_t col) const |
| Returns the dual variable of a column. More... | |
| const DMatrix * | cost_matrix () const |
| Returns the LSAP problem instance. More... | |
| std::size_t | num_rows () const |
| Returns the number of rows of the LSAP problem instance. More... | |
| std::size_t | num_cols () const |
| Returns the number of columns of the LSAP problem instance. More... | |
| const std::vector< std::size_t > & | row_to_col_assignment (std::size_t solution_id=0) const |
| Returns the assignment from rows to columns. More... | |
| const std::vector< std::size_t > & | col_to_row_assignment (std::size_t solution_id=0) const |
| Returns the assignment from columns to rows. More... | |
| std::size_t | num_solutions () const |
| Returns the number of solutions. More... | |
This class solves LSAP instances by calling the library lsape available at https://bougleux.users.greyc.fr/lsape/.
Definition at line 39 of file lsap_solver.hpp.
Selects a greedy method.
The different greedy methods are described in:
| Enumerator | |
|---|---|
| BASIC | |
| REFINED | |
| LOSS | |
| BASIC_SORT | |
| INT_BASIC_SORT | |
Definition at line 50 of file lsap_solver.hpp.
| ged::LSAPSolver::LSAPSolver | ( | const DMatrix * | cost_matrix | ) |
Constructs solver for LSAP problem instance.
| [in] | cost_matrix | Pointer to the LSAP problem instance that should be solved. |
Definition at line 33 of file lsap_solver.ipp.
| const std::vector< std::size_t > & ged::LSAPSolver::col_to_row_assignment | ( | std::size_t | solution_id = 0 | ) | const |
Returns the assignment from columns to rows.
| [in] | solution_id | The ID of the solutions whose assignment should be returned. |
solution_id. Definition at line 155 of file lsap_solver.ipp.
| const DMatrix * ged::LSAPSolver::cost_matrix | ( | ) | const |
Returns the LSAP problem instance.
Definition at line 161 of file lsap_solver.ipp.
| std::size_t ged::LSAPSolver::get_assigned_col | ( | std::size_t | row, |
| std::size_t | solution_id = 0 |
||
| ) | const |
Returns the assigned column.
| [in] | row | Row whose assigned column should be returned. |
| [in] | solution_id | ID of the solution where the assignment should be looked up. |
row is assigned to in solution with ID solution_id or ged::undefined() if row is not assigned to any column. Definition at line 119 of file lsap_solver.ipp.
| std::size_t ged::LSAPSolver::get_assigned_row | ( | std::size_t | col, |
| std::size_t | solution_id = 0 |
||
| ) | const |
Returns the assigned row.
| [in] | col | Column whose assigned row should be returned. |
| [in] | solution_id | ID of the solution where the assignment should be looked up. |
col is assigned to in solution with ID solution_id or ged::undefined() if col is not assigned to any row. Definition at line 125 of file lsap_solver.ipp.
| double ged::LSAPSolver::get_dual_var_col | ( | std::size_t | col | ) | const |
Returns the dual variable of a column.
| [in] | col | The column. |
col. Definition at line 143 of file lsap_solver.ipp.
| double ged::LSAPSolver::get_dual_var_row | ( | std::size_t | row | ) | const |
Returns the dual variable of a row.
| [in] | row | The row. |
row. Definition at line 137 of file lsap_solver.ipp.
| double ged::LSAPSolver::get_slack | ( | std::size_t | row, |
| std::size_t | col | ||
| ) | const |
Returns the slack of a cell.
| [in] | row | Row of the cell. |
| [in] | col | Column of the cell. |
row, col). Definition at line 131 of file lsap_solver.ipp.
| double ged::LSAPSolver::minimal_cost | ( | ) | const |
Returns the cost of the computed solutions.
Definition at line 113 of file lsap_solver.ipp.
| std::size_t ged::LSAPSolver::num_cols | ( | ) | const |
Returns the number of columns of the LSAP problem instance.
Definition at line 173 of file lsap_solver.ipp.
| std::size_t ged::LSAPSolver::num_rows | ( | ) | const |
Returns the number of rows of the LSAP problem instance.
Definition at line 167 of file lsap_solver.ipp.
| std::size_t ged::LSAPSolver::num_solutions | ( | ) | const |
Returns the number of solutions.
num_solutions. Definition at line 179 of file lsap_solver.ipp.
| const std::vector< std::size_t > & ged::LSAPSolver::row_to_col_assignment | ( | std::size_t | solution_id = 0 | ) | const |
Returns the assignment from rows to columns.
| [in] | solution_id | The ID of the solutions whose assignment should be returned. |
solution_id. Definition at line 149 of file lsap_solver.ipp.
| void ged::LSAPSolver::set_greedy_method | ( | const GreedyMethod & | greedy_method | ) |
Makes the solver use a greedy method.
| [in] | greedy_method | The greedy method that should be sued. |
Definition at line 63 of file lsap_solver.ipp.
| void ged::LSAPSolver::set_problem | ( | const DMatrix * | cost_matrix | ) |
Sets the LSAP problem instance.
| [in] | cost_matrix | Pointer to the LSAP problem instance that should be solved. |
Definition at line 56 of file lsap_solver.ipp.
| void ged::LSAPSolver::solve | ( | int | num_solutions = 1 | ) |
Solves the LSAP problem instance.
| [in] | num_solutions | The maximal number of solutions that should be computed. |
Definition at line 88 of file lsap_solver.ipp.
1.8.13