![]() |
PandA-2024.02
|
Autoheader include. More...
#include <glpk_solver.hpp>


Public Member Functions | |
| glpk_solver () | |
| ~glpk_solver () override | |
| void | make (int nvars) override |
| ??? More... | |
| int | solve () override |
| Solve the linear problem. More... | |
| int | solve_ilp () override |
| Solve the integer linear problem. More... | |
| void | add_row (std::map< int, double > &i_coeffs, double i_rhs, ilp_sign i_sign, const std::string &name) override |
| Add a constraint to the ilp formulation. More... | |
| void | objective_add (std::map< int, double > &i_coeffs, ilp_dir dir) override |
| Set the objective function. More... | |
| void | set_int (int i) override |
| Set a variable to have only integer values. More... | |
| void | get_vars_solution (std::map< int, double > &vars) const override |
| Return the solution of the problem. More... | |
| int | get_number_constraints () const override |
| Return the number of constraints. More... | |
| int | get_number_variables () const override |
| Return the number of variables. More... | |
| void | set_col_name (int var, const std::string &name) override |
| Set name of a variable (column) More... | |
| std::string | get_col_name (int var) override |
| Get name of a variable (column) More... | |
| int | add_empty_column () override |
| Add an empty column ??? More... | |
| void | print_to_file (const std::string &file_name) override |
| Print the problem. More... | |
Public Member Functions inherited from meilp_solver | |
| virtual | ~meilp_solver () |
| virtual destructor More... | |
| virtual void | set_binary (int i) |
| Set a variable to have only binary values. More... | |
| virtual void | set_bnds (int var, double lowbo, double upbo) |
| Set lower and upper bound of a variable. More... | |
| virtual void | set_lowbo (int var, double bound) |
| Set lower bound of a variable. More... | |
| virtual void | set_upbo (int var, double bound) |
| Set upper bound of a variable. More... | |
| void | setMaximumSeconds (int MAX_t) |
| ??? More... | |
| void | set_debug_level (int dl) |
| Set the verbosity (debug_level) More... | |
| void | set_priority (const std::map< int, int > &_priority) |
| Set the variable priority. More... | |
Private Member Functions | |
| void | set_all_bounds () override |
| Set the lower and upper of the variables using lower_bounds and upper_bounds. More... | |
| void | set_all_bounds_new () |
| Set the lower and upper of the variables using lower_bounds and upper_bounds. More... | |
| void | print (std::ostream &os) override |
| Print the problem. More... | |
Private Attributes | |
| glp_prob * | lp |
| glp_smcp * | scp |
| simplex_control_params More... | |
| glp_iocp * | iocp |
| integer solver control parameter More... | |
| glp_bfcp * | bfcp |
| basis factorization control parameters More... | |
| bool | mip_solution |
| it is true when solve_ilp() has been executed, false otherwise More... | |
Additional Inherited Members | |
Public Types inherited from meilp_solver | |
| enum | ilp_sign { G, L, E } |
| Possible operator in constraints. More... | |
| enum | supported_solvers |
| List of currently supported solvers. More... | |
| enum | ilp_dir { min, max } |
| Type of objective function. More... | |
Static Public Member Functions inherited from meilp_solver | |
| static meilp_solverRef | create_solver (supported_solvers solver_type) |
| Factory static member function. More... | |
Protected Member Functions inherited from meilp_solver | |
| meilp_solver () | |
| Constructor. More... | |
| void | resize (size_t count) |
| virtual void | copy (const std::map< int, double > &i_coeffs) |
Protected Attributes inherited from meilp_solver | |
| double * | real_buffer |
| values in the constraint buffer More... | |
| int * | int_buffer |
| indexes in the constraint buffer More... | |
| int | unique_column_id |
| unique column identifier More... | |
| int | MAX_time |
| Time-out value. More... | |
| int | debug_level |
| debug_level More... | |
| std::map< int, int > | priority |
| variables priority More... | |
| CustomUnorderedMap< int, double > | lower_bounds |
| The lower bound of the variables. They will be really set by solve method. More... | |
| CustomUnorderedMap< int, double > | upper_bounds |
| The upper bound of the variables. They will be really set by solve method. More... | |
Autoheader include.
Definition at line 63 of file glpk_solver.hpp.
| glpk_solver::glpk_solver | ( | ) |
Definition at line 70 of file glpk_solver.cpp.
|
override |
|
overridevirtual |
Add an empty column ???
Implements meilp_solver.
Definition at line 729 of file glpk_solver.cpp.
References lp.
|
overridevirtual |
Add a constraint to the ilp formulation.
| i_coeffs | are the coefficients of the variables in the left part |
| i_rhs | is the constant in the right part |
| i_sign | is the operator in the constraints |
| name | is the name of the constraint |
Implements meilp_solver.
Definition at line 608 of file glpk_solver.cpp.
References meilp_solver::copy(), meilp_solver::E, meilp_solver::G, meilp_solver::int_buffer, meilp_solver::L, lp, meilp_solver::real_buffer, THROW_ASSERT, and THROW_UNREACHABLE.

|
overridevirtual |
Get name of a variable (column)
| var | is the index of the variables return the name of the variable |
Implements meilp_solver.
Definition at line 724 of file glpk_solver.cpp.
References lp.
|
overridevirtual |
Return the number of constraints.
Implements meilp_solver.
Definition at line 642 of file glpk_solver.cpp.
References lp.
|
overridevirtual |
Return the number of variables.
Implements meilp_solver.
Definition at line 647 of file glpk_solver.cpp.
References lp.
|
overridevirtual |
Return the solution of the problem.
| vars | is where solution are stored |
Implements meilp_solver.
Definition at line 701 of file glpk_solver.cpp.
References lp, and mip_solution.
|
overridevirtual |
???
| nvars |
Implements meilp_solver.
Definition at line 97 of file glpk_solver.cpp.
References bfcp, meilp_solver::debug_level, DEBUG_LEVEL_MINIMUM, DEBUG_LEVEL_PEDANTIC, iocp, lp, meilp_solver::MAX_time, scp, and THROW_ERROR.
Set the objective function.
| I_coeffs | are the coefficients of the variables in the objective function |
| dir | is the type of objective function |
Implements meilp_solver.
Definition at line 652 of file glpk_solver.cpp.
References lp, meilp_solver::max, meilp_solver::min, THROW_ASSERT, and THROW_ERROR.
|
overrideprivatevirtual |
Print the problem.
| os | is the stream on which problem has to be printed |
Setting the bounds
Implements meilp_solver.
Definition at line 674 of file glpk_solver.cpp.
References lp, and set_all_bounds().
Referenced by solve(), and solve_ilp().


|
overridevirtual |
Print the problem.
| file_name | is the name of the file to be written |
Setting the bounds
Implements meilp_solver.
Definition at line 685 of file glpk_solver.cpp.
References lp, and set_all_bounds().

|
overrideprivatevirtual |
Set the lower and upper of the variables using lower_bounds and upper_bounds.
Implements meilp_solver.
Definition at line 734 of file glpk_solver.cpp.
References meilp_solver::lower_bounds, lp, THROW_ASSERT, THROW_ERROR, and meilp_solver::upper_bounds.
Referenced by print(), print_to_file(), solve(), and solve_ilp().

|
private |
Set the lower and upper of the variables using lower_bounds and upper_bounds.
|
overridevirtual |
Set name of a variable (column)
| var | is the index of the variables |
| name | is the name of the variable |
Implements meilp_solver.
Definition at line 718 of file glpk_solver.cpp.
References lp.
|
overridevirtual |
Set a variable to have only integer values.
| i | is the variables |
Implements meilp_solver.
Definition at line 696 of file glpk_solver.cpp.
References lp.
|
overridevirtual |
Solve the linear problem.
Setting the bounds
Printing the problem
Implements meilp_solver.
Definition at line 153 of file glpk_solver.cpp.
References meilp_solver::debug_level, DEBUG_LEVEL_VERBOSE, INT_MAX, lp, mip_solution, print(), PRINT_MSG, scp, and set_all_bounds().

|
overridevirtual |
Solve the integer linear problem.
Setting the bounds
Printing the problem
Implements meilp_solver.
Definition at line 376 of file glpk_solver.cpp.
References bfcp, meilp_solver::debug_level, DEBUG_LEVEL_VERBOSE, iocp, lp, mip_solution, print(), PRINT_MSG, scp, and set_all_bounds().

|
private |
basis factorization control parameters
Definition at line 81 of file glpk_solver.hpp.
Referenced by make(), solve_ilp(), and ~glpk_solver().
|
private |
integer solver control parameter
Definition at line 76 of file glpk_solver.hpp.
Referenced by make(), solve_ilp(), and ~glpk_solver().
|
private |
Definition at line 66 of file glpk_solver.hpp.
Referenced by add_empty_column(), add_row(), get_col_name(), get_number_constraints(), get_number_variables(), get_vars_solution(), make(), objective_add(), print(), print_to_file(), set_all_bounds(), set_col_name(), set_int(), solve(), solve_ilp(), and ~glpk_solver().
|
private |
it is true when solve_ilp() has been executed, false otherwise
Definition at line 86 of file glpk_solver.hpp.
Referenced by get_vars_solution(), solve(), and solve_ilp().
|
private |
simplex_control_params
Definition at line 71 of file glpk_solver.hpp.
Referenced by make(), solve(), solve_ilp(), and ~glpk_solver().
1.8.13