![]() |
PandA-2024.02
|
Base class providing several methods to encapsulate the interface to several ilp solver. More...
#include <meilp_solver.hpp>

Public Types | |
| 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... | |
Public Member Functions | |
| virtual | ~meilp_solver () |
| virtual destructor More... | |
| virtual void | make (int nvars)=0 |
| ??? More... | |
| virtual int | solve ()=0 |
| Solve the linear problem. More... | |
| virtual int | solve_ilp ()=0 |
| Solve the integer linear problem. More... | |
| virtual void | add_row (std::map< int, double > &i_coeffs, double i_rhs, ilp_sign i_sign, const std::string &name)=0 |
| Add a constraint to the ilp formulation. More... | |
| virtual void | objective_add (std::map< int, double > &i_coeffs, ilp_dir dir)=0 |
| Set the objective function. More... | |
| virtual void | set_binary (int i) |
| Set a variable to have only binary values. More... | |
| virtual void | set_int (int i)=0 |
| Set a variable to have only integer 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... | |
| virtual void | get_vars_solution (std::map< int, double > &vars) const =0 |
| Return the solution of the problem. More... | |
| virtual int | get_number_constraints () const =0 |
| Return the number of constraints. More... | |
| virtual int | get_number_variables () const =0 |
| Return the number of variables. More... | |
| virtual void | set_col_name (int var, const std::string &name)=0 |
| Set name of a variable (column) More... | |
| virtual std::string | get_col_name (int var)=0 |
| Get name of a variable (column) More... | |
| virtual int | add_empty_column ()=0 |
| Add an empty column ??? 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... | |
| virtual void | print_to_file (const std::string &file_name)=0 |
| Print the problem. More... | |
Static Public Member Functions | |
| static meilp_solverRef | create_solver (supported_solvers solver_type) |
| Factory static member function. More... | |
Protected Member Functions | |
| meilp_solver () | |
| Constructor. More... | |
| void | resize (size_t count) |
| virtual void | copy (const std::map< int, double > &i_coeffs) |
| virtual void | set_all_bounds ()=0 |
| Set the lower and upper of the variables using lower_bounds and upper_bounds. More... | |
| virtual void | print (std::ostream &os)=0 |
| Print the problem. More... | |
Protected Attributes | |
| 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... | |
Private Attributes | |
| size_t | nel |
| number of elements in the constraint buffer More... | |
Base class providing several methods to encapsulate the interface to several ilp solver.
Definition at line 73 of file meilp_solver.hpp.
Type of objective function.
| Enumerator | |
|---|---|
| min | Minimization. |
| max | Maximization. |
Definition at line 163 of file meilp_solver.hpp.
Possible operator in constraints.
| Enumerator | |
|---|---|
| G | Greater then. |
| L | Less then. |
| E | Equal to. |
Definition at line 79 of file meilp_solver.hpp.
List of currently supported solvers.
Definition at line 147 of file meilp_solver.hpp.
|
protected |
Constructor.
Definition at line 64 of file meilp_solver.cpp.
|
virtual |
virtual destructor
Definition at line 69 of file meilp_solver.cpp.
References int_buffer, nel, and real_buffer.
|
pure virtual |
Add an empty column ???
Implemented in glpk_solver.
|
pure virtual |
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 |
Implemented in glpk_solver.
|
protectedvirtual |
| i_coeffs |
Definition at line 101 of file meilp_solver.cpp.
References index, int_buffer, real_buffer, and resize().
Referenced by glpk_solver::add_row().


|
static |
Factory static member function.
Given the supported enum create a specialization of meilp_solver
| solver_type | is the solver. |
Definition at line 113 of file meilp_solver.cpp.
References THROW_ERROR.
Referenced by SDCScheduling::InternalExec(), and setMaximumSeconds().

|
pure virtual |
Get name of a variable (column)
| var | is the index of the variables return the name of the variable |
Implemented in glpk_solver.
|
pure virtual |
|
pure virtual |
|
pure virtual |
Return the solution of the problem.
| vars | is where solution are stored |
Implemented in glpk_solver.
|
pure virtual |
|
pure virtual |
Set the objective function.
| I_coeffs | are the coefficients of the variables in the objective function |
| dir | is the type of objective function |
Implemented in glpk_solver.
|
protectedpure virtual |
Print the problem.
| os | is the stream on which problem has to be printed |
Implemented in glpk_solver.
|
pure virtual |
Print the problem.
| file_name | is the name of the file to be written |
Implemented in glpk_solver.
Referenced by setMaximumSeconds().

|
protected |
| count |
Definition at line 78 of file meilp_solver.cpp.
References int_buffer, nel, real_buffer, and THROW_ASSERT.
Referenced by copy().

|
protectedpure virtual |
Set the lower and upper of the variables using lower_bounds and upper_bounds.
Implemented in glpk_solver.
|
virtual |
Set a variable to have only binary values.
| i | is the variable |
Definition at line 136 of file meilp_solver.cpp.
References set_bnds(), and set_int().

|
virtual |
Set lower and upper bound of a variable.
| var | is the variables |
| lowbo | is the lower bound |
| upbo | is the upper bound |
Definition at line 142 of file meilp_solver.cpp.
References lower_bounds, and upper_bounds.
Referenced by set_binary().

|
pure virtual |
Set name of a variable (column)
| var | is the index of the variables |
| name | is the name of the variable |
Implemented in glpk_solver.
| void meilp_solver::set_debug_level | ( | int | dl | ) |
Set the verbosity (debug_level)
Definition at line 91 of file meilp_solver.cpp.
References debug_level, and dl.
Referenced by setMaximumSeconds().

|
pure virtual |
Set a variable to have only integer values.
| i | is the variables |
Implemented in glpk_solver.
Referenced by set_binary().

|
virtual |
Set lower bound of a variable.
| var | is the variable |
| bound | is the lower bound |
Definition at line 148 of file meilp_solver.cpp.
References lower_bounds.
| void meilp_solver::set_priority | ( | const std::map< int, int > & | _priority | ) |
Set the variable priority.
| _priority | is mapping between index variable and priority |
Definition at line 96 of file meilp_solver.cpp.
References priority.
Referenced by setMaximumSeconds().

|
virtual |
Set upper bound of a variable.
| var | is the variable |
| bound | is the upper bound |
Definition at line 153 of file meilp_solver.cpp.
References upper_bounds.
|
inline |
???
Definition at line 280 of file meilp_solver.hpp.
References create_solver(), dl, print_to_file(), set_debug_level(), and set_priority().

|
pure virtual |
Solve the linear problem.
Implemented in glpk_solver.
|
pure virtual |
Solve the integer linear problem.
Implemented in glpk_solver.
|
protected |
debug_level
Definition at line 104 of file meilp_solver.hpp.
Referenced by glpk_solver::make(), set_debug_level(), glpk_solver::solve(), and glpk_solver::solve_ilp().
|
protected |
indexes in the constraint buffer
Definition at line 95 of file meilp_solver.hpp.
Referenced by glpk_solver::add_row(), copy(), resize(), and ~meilp_solver().
|
protected |
The lower bound of the variables. They will be really set by solve method.
Definition at line 110 of file meilp_solver.hpp.
Referenced by glpk_solver::set_all_bounds(), set_bnds(), and set_lowbo().
|
protected |
|
private |
number of elements in the constraint buffer
Definition at line 88 of file meilp_solver.hpp.
Referenced by resize(), and ~meilp_solver().
|
protected |
|
protected |
values in the constraint buffer
Definition at line 92 of file meilp_solver.hpp.
Referenced by glpk_solver::add_row(), copy(), resize(), and ~meilp_solver().
|
protected |
unique column identifier
Definition at line 98 of file meilp_solver.hpp.
|
protected |
The upper bound of the variables. They will be really set by solve method.
Definition at line 113 of file meilp_solver.hpp.
Referenced by glpk_solver::set_all_bounds(), set_bnds(), and set_upbo().
1.8.13