27 #ifndef LSAPE_SOLVER_HPP 28 #define LSAPE_SOLVER_HPP 1 30 #include "../env/common_types.hpp" 31 #include "../env/matrix.hpp" 126 std::size_t
get_assigned_col(std::size_t row, std::size_t solution_id = 0)
const;
134 std::size_t
get_assigned_row(std::size_t col, std::size_t solution_id = 0)
const;
142 double get_slack(std::size_t row, std::size_t col)
const;
217 bool solve_optimally_;
219 double minimal_cost_;
221 std::vector<std::vector<std::size_t>> row_to_col_assignments_;
223 std::vector<std::vector<std::size_t>> col_to_row_assignments_;
225 std::vector<double> dual_var_rows_;
227 std::vector<double> dual_var_cols_;
230 std::vector<std::size_t> construct_col_to_row_asignment_(
const std::vector<std::size_t>
row_to_col_assignment)
const;
232 void compute_cost_from_assignments_();
234 void compute_cost_from_dual_vars_();
void set_model(const Model &model)
Makes the solver use a specific model for optimal solving.
Reduction to compact LSAP instance for quasimetric costs.
double get_dual_var_col(std::size_t col) const
Returns the dual variable of a column.
Reduction to compact LSAP instance for quasimetric costs.
std::size_t total_num_rows() const
Returns the total number of rows of the LSAPE problem instance.
This class solves LSAPE instances by calling the library lsape available at https://bougleux.users.greyc.fr/lsape/.
Reduction to compact LSAP instance without cost constraints.
std::size_t num_cols() const
Returns the number of real columns of the LSAPE problem instance, i.e, the number of columns of the i...
LSAPESolver()
Constructs empty solver.
GreedyMethod
Selects a greedy method.
void solve(int num_solutions=1)
Solves the LSAPE problem instance.
Reduction to extended LSAP instance without cost constraints.
double get_dual_var_row(std::size_t row) const
Returns the dual variable of a row.
double get_slack(std::size_t row, std::size_t col) const
Returns the slack of a cell.
void clear_solution()
Clears a previously computed solution.
ged::LSAPESolver class definition.
const DMatrix * cost_matrix() const
Returns the LSAPE problem instance.
Adaption of Hungarian Algorithm to LSAPE.
const std::vector< std::size_t > & col_to_row_assignment(std::size_t solution_id=0) const
Returns the assignment from columns to rows.
See https://doi.org/10.1007/978-3-319-18224-7_1.
double minimal_cost() const
Returns the cost of the computed solutions.
std::size_t get_assigned_row(std::size_t col, std::size_t solution_id=0) const
Returns the assigned row.
std::size_t total_num_cols() const
Returns the total number of columns of the LSAPE problem instance.
const std::vector< std::size_t > & row_to_col_assignment(std::size_t solution_id=0) const
Returns the assignment from rows to columns.
std::size_t num_rows() const
Returns the number of real rows of the LSAPE problem instance, i.e, the number of rows of the interna...
Reduction to compact LSAP instance for quasimetric costs.
std::size_t get_assigned_col(std::size_t row, std::size_t solution_id=0) const
Returns the assigned column.
Global namespace for GEDLIB.
See https://doi.org/10.1007/978-3-319-18224-7_1.
See https://doi.org/10.1007/978-3-319-18224-7_1.
void set_problem(const DMatrix *cost_matrix)
Sets the LSAPE problem instance.
Reduction to compact LSAP instance for quasimetric costs.
std::size_t num_solutions() const
Returns the number of solutions.
Model
Selects a model for solving LSAPE with the Hungarian algorithm.
See https://doi.org/10.1007/978-3-319-18224-7_1.
void set_greedy_method(const GreedyMethod &greedy_method)
Makes the solver use a greedy method.
See https://doi.org/10.1007/978-3-319-18224-7_1.