Antares Xpansion
Investment simulations for Antares studies
Loading...
Searching...
No Matches
SolverAbstract Class Referenceabstract
Inheritance diagram for SolverAbstract:
NOOPSolver Problem SolverCbc SolverClp SolverXpress

Public Types

typedef std::shared_ptr< SolverAbstractPtr
 

Public Member Functions

 SolverAbstract ()
 constructor of SolverAbstract class : does nothing
 
 SolverAbstract (const std::string &name, const SolverAbstract::Ptr toCopy)
 Copy constructor, copy the problem "toCopy" in memory and name it "name" if possible.
 
virtual ~SolverAbstract ()
 destructor of SolverAbstract class : does nothing
 
virtual int get_number_of_instances ()=0
 Returns number of instances of solver currently in memory.
 
virtual std::string get_solver_name () const =0
 Returns the solver used.
 
std::list< std::ostream * > & get_stream ()
 returns the list of streams used by the solver instance
 
void add_stream (std::ostream &stream)
 add a stream to the list of streams used by the solver instance
 
void set_fp (FILE *fp)
 
void zero_status_check (int status, const std::string &action_failed, const std::string &log_location) const
 Check if a status code is different to 0, throw InvalidStatusException if it occurs.
 
virtual void init ()=0
 Initializes a problem.
 
virtual void free ()=0
 Frees all the datas contained in the Solver environment.
 
virtual void write_prob_mps (const std::filesystem::path &filename)=0
 writes an optimization problem in a MPS file
 
virtual void write_prob_lp (const std::filesystem::path &filename)=0
 writes an optimization problem in a LP file
 
virtual void write_basis (const std::filesystem::path &filename)=0
 Writes the current basis to a file for later input into the optimizer.
 
virtual void read_prob_mps (const std::filesystem::path &filename)=0
 reads an optimization problem contained in a MPS file
 
virtual void read_prob_lp (const std::filesystem::path &filename)=0
 reads an optimization problem contained in a MPS file
 
virtual void read_basis (const std::filesystem::path &filename)=0
 Instructs the optimizer to read in a previously saved basis from a file.
 
virtual void copy_prob (Ptr fictif_solv)=0
 copy an existing problem
 
virtual int get_ncols () const =0
 returns number of columns of the problem
 
virtual int get_nrows () const =0
 returns number of rows of the problem
 
virtual int get_nelems () const =0
 returns number of non zeros elements in the matrix, excluding objective
 
virtual int get_n_integer_vars () const =0
 returns number of integer variables in the problem
 
virtual void get_obj (double *obj, int first, int last) const =0
 returns the objective function coefficients for the columns in a given range
 
virtual void set_obj_to_zero ()=0
 Set the objective function coefficients to zero.
 
virtual void set_obj (const double *obj, int first, int last)=0
 Set the objective function coefficients for the columns in a given range.
 
virtual void get_rows (int *mstart, int *mclind, double *dmatval, int size, int *nels, int first, int last) const =0
 get coefficients of rows from index first to last
 
virtual void get_row_type (char *qrtype, int first, int last) const =0
 Returns the row types for the rows in a given range.
 
virtual void get_rhs (double *rhs, int first, int last) const =0
 Returns the right-hand sides of the rows in a given range.
 
virtual void get_rhs_range (double *range, int first, int last) const =0
 Returns the right hand side range values for the rows in a given range.
 
virtual void get_col_type (char *coltype, int first, int last) const =0
 Returns the column types for the columns in a given range.
 
virtual void get_lb (double *lb, int fisrt, int last) const =0
 Returns the lower bounds for variables in a given range.
 
virtual void get_ub (double *ub, int fisrt, int last) const =0
 Returns the upper bounds for variables in a given range.
 
virtual int get_row_index (std::string const &name)=0
 Returns the index of row named "name".
 
virtual int get_col_index (std::string const &name)=0
 Returns the index of column named "name".
 
virtual std::vector< std::string > get_row_names (int first, int last)=0
 Returns the names of row from index first to last cannot be declared as const because of some solver methods.
 
virtual std::vector< std::string > get_row_names ()=0
 Returns the names of rows.
 
virtual std::vector< std::string > get_col_names (int first, int last)=0
 Returns the names of columns from index first to last cannot be declared as const because of some solver methods.
 
virtual std::vector< std::string > get_col_names ()=0
 Returns the names of columns.
 
virtual void del_rows (int first, int last)=0
 Deletes rows between index first and last.
 
virtual void add_rows (int newrows, int newnz, const char *qrtype, const double *rhs, const double *range, const int *mstart, const int *mclind, const double *dmatval, const std::vector< std::string > &names={})=0
 Adds rows to the problem.
 
virtual void add_cols (int newcol, int newnz, const double *objx, const int *mstart, const int *mrwind, const double *dmatval, const double *bdl, const double *bdu)=0
 Adds new columns to the problem.
 
virtual void add_name (int type, const char *cnames, int indice)=0
 Adds a name to a row or a column.
 
virtual void add_names (int type, const std::vector< std::string > &cnames, int first, int end)=0
 
virtual void chg_obj (const std::vector< int > &mindex, const std::vector< double > &obj)=0
 Change coefficients in objective function.
 
virtual void chg_obj_direction (const bool minimize)=0
 Change the problem's objective function sense to minimize or maximize.
 
virtual void chg_bounds (const std::vector< int > &mindex, const std::vector< char > &qbtype, const std::vector< double > &bnd)=0
 Change bounds of some variables.
 
virtual void chg_col_type (const std::vector< int > &mindex, const std::vector< char > &qctype)=0
 Change type of some columns.
 
virtual void chg_rhs (int id_row, double val)=0
 Change rhs of a row.
 
virtual void chg_coef (int id_row, int id_col, double val)=0
 Change a coefficient in the matrix.
 
virtual void chg_row_name (int id_row, std::string const &name)=0
 Change the name of a constraint.
 
virtual void chg_col_name (int id_col, std::string const &name)=0
 Change the name of a variable.
 
virtual int solve_lp ()=0
 Solves a problem as LP.
 
virtual int solve_mip ()=0
 Solves a problem as MIP.
 
virtual void get_basis (int *rstatus, int *cstatus) const =0
 Returns the current basis into the user’s data arrays.
 
virtual double get_mip_value () const =0
 Get the optimal value of a MIP problem (available after method "solve_mip")
 
virtual double get_lp_value () const =0
 Get the optimal value of a LP problem (available after method "solve_lp" )
 
virtual int get_splex_num_of_ite_last () const =0
 Get the number of simplex iterations done in the last resolution of the problem.
 
virtual void get_lp_sol (double *primals, double *duals, double *reduced_costs)=0
 Get LP solution of a problem (available after method "solve_lp")
 
virtual void get_mip_sol (double *primals)=0
 Get MIP solution of a problem (available after method "solve_mip")
 
virtual void set_output_log_level (int loglevel)=0
 Sets log level of the solver.
 
virtual void set_algorithm (std::string const &algo)=0
 Sets algorithm used by solver to solve LP's.
 
virtual void set_threads (int n_threads)=0
 Sets the maximum number of threads used to perform optimization.
 
virtual void set_optimality_gap (double gap)=0
 Sets the optimality gap.
 
virtual void set_simplex_iter (int iter)=0
 Sets the maximum number of simplex iterations the solver can perform.
 

Public Attributes

std::vector< std::string > SOLVER_STRING_STATUS
 
std::string _name
 
std::list< std::ostream * > _streams
 
FILE * _fp = nullptr
 
std::filesystem::path _log_file = ""
 

Member Typedef Documentation

◆ Ptr

typedef std::shared_ptr<SolverAbstract> SolverAbstract::Ptr

Ptr to the solver

Constructor & Destructor Documentation

◆ SolverAbstract()

SolverAbstract::SolverAbstract ( const std::string &  name,
const SolverAbstract::Ptr  toCopy 
)
inline

Copy constructor, copy the problem "toCopy" in memory and name it "name" if possible.

Parameters
name: Name to give to new problem
toCopy: Pointer to an AbstractSolver object, containing a solver object to copy

Member Function Documentation

◆ add_cols()

virtual void SolverAbstract::add_cols ( int  newcol,
int  newnz,
const double *  objx,
const int *  mstart,
const int *  mrwind,
const double *  dmatval,
const double *  bdl,
const double *  bdu 
)
pure virtual

Adds new columns to the problem.

Parameters
newcol: Number of new columns.
newnz: Number of new nonzeros in the added columns.
objx: Double array of length newcol containing the objective function coefficients of the new columns.
mstart: Integer array of length newcol containing the offsets in the mrwind and dmatval arrays of the start of the elements for each column.
mrwind: Integer array of length newnz containing the row indices for the elements 7 in each column.
dmatval: Double array of length newnz containing the element values.
bdl: Double array of length newcol containing the lower bounds on the added columns.
bdu: Double array of length newcol containing the upper bounds on the added columns.

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ add_name()

virtual void SolverAbstract::add_name ( int  type,
const char *  cnames,
int  indice 
)
pure virtual

Adds a name to a row or a column.

Parameters
type: 1 for row, 2 for column.
cnames: Character buffer containing the null-terminated string names.
indice: index of the row or of the column.

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ add_rows()

virtual void SolverAbstract::add_rows ( int  newrows,
int  newnz,
const char *  qrtype,
const double *  rhs,
const double *  range,
const int *  mstart,
const int *  mclind,
const double *  dmatval,
const std::vector< std::string > &  names = {} 
)
pure virtual

Adds rows to the problem.

Parameters
newrows: Number of new rows.
newnz: Number of new nonzeros in the added rows.
qrtype: Character array of length newrow containing the row types:
rhs: Double array of length newrow containing the right hand side elements.
range: Double array of length newrow containing the row range elements (index read only for R type rows)
mstart: Integer array of length newrow + 1 containing the offsets in the mclind and dmatval arrays of the start of the elements for each row.
mclind: Integer array of length newnz containing the (contiguous) column indices for the elements in each row.
dmatval: Double array of length newnz containing the (contiguous) element values.

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ add_stream()

void SolverAbstract::add_stream ( std::ostream &  stream)
inline

add a stream to the list of streams used by the solver instance

Parameters
stream: reference to a std::ostream object

◆ chg_bounds()

virtual void SolverAbstract::chg_bounds ( const std::vector< int > &  mindex,
const std::vector< char > &  qbtype,
const std::vector< double > &  bnd 
)
pure virtual

Change bounds of some variables.

Parameters
nbds: number of bounds to change
mindex: indices of columns to modify
qbtype: types of the bounds to modify ('U' upper, 'L' lower, 'B' both)
bnd: new values for the bounds

Implemented in SolverClp, Problem, SolverCbc, SolverXpress, and NOOPSolver.

◆ chg_coef()

virtual void SolverAbstract::chg_coef ( int  id_row,
int  id_col,
double  val 
)
pure virtual

Change a coefficient in the matrix.

Parameters
id_row: index of the row
id_col: index of the column
val: new value to set in the matrix

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ chg_col_name()

virtual void SolverAbstract::chg_col_name ( int  id_col,
std::string const &  name 
)
pure virtual

Change the name of a variable.

Parameters
id_col: index of the column
name: new name of the column

Implemented in Problem, NOOPSolver, SolverCbc, SolverClp, and SolverXpress.

◆ chg_col_type()

virtual void SolverAbstract::chg_col_type ( const std::vector< int > &  mindex,
const std::vector< char > &  qctype 
)
pure virtual

Change type of some columns.

Parameters
nels: number of elements to change
mindex: indices of columns to modify
qctype: New types of columns

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ chg_obj()

virtual void SolverAbstract::chg_obj ( const std::vector< int > &  mindex,
const std::vector< double > &  obj 
)
pure virtual

Change coefficients in objective function.

Parameters
mindex: indices of columns to modify
obj: Values to set in objective function

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ chg_obj_direction()

virtual void SolverAbstract::chg_obj_direction ( const bool  minimize)
pure virtual

Change the problem's objective function sense to minimize or maximize.

Parameters
minimize: boolean that is true for minimize, false for maximization

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ chg_rhs()

virtual void SolverAbstract::chg_rhs ( int  id_row,
double  val 
)
pure virtual

Change rhs of a row.

Parameters
id_row: index of the row
val: new rhs value

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ chg_row_name()

virtual void SolverAbstract::chg_row_name ( int  id_row,
std::string const &  name 
)
pure virtual

Change the name of a constraint.

Parameters
id_row: index of the row
name: new name of the row

Implemented in Problem, NOOPSolver, SolverCbc, SolverClp, and SolverXpress.

◆ copy_prob()

virtual void SolverAbstract::copy_prob ( Ptr  fictif_solv)
pure virtual

copy an existing problem

Parameters
prb_to_copy: Ptr to the

Implemented in SolverCbc, SolverClp, SolverXpress, Problem, and NOOPSolver.

◆ del_rows()

virtual void SolverAbstract::del_rows ( int  first,
int  last 
)
pure virtual

Deletes rows between index first and last.

Parameters
first: first row index to delete
last: last row index to delete

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ free()

virtual void SolverAbstract::free ( )
pure virtual

Frees all the datas contained in the Solver environment.

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ get_basis()

virtual void SolverAbstract::get_basis ( int *  rstatus,
int *  cstatus 
) const
pure virtual

Returns the current basis into the user’s data arrays.

Parameters
rstatus: Integer array of length ROWS to the basis status of the slack, surplus or artifficial variable associated with each row. The values depend on the solver used.May be NULL if not required.
cstatus: Integer array of length COLS to hold the basis status of the columns in the constraint matrix. The values depend on the solver used.May be NULL if not required.

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ get_col_index()

virtual int SolverAbstract::get_col_index ( std::string const &  name)
pure virtual

Returns the index of column named "name".

Parameters
name: name of column to get the index

Implemented in Problem, NOOPSolver, SolverCbc, SolverClp, and SolverXpress.

◆ get_col_names() [1/2]

virtual std::vector< std::string > SolverAbstract::get_col_names ( )
pure virtual

Returns the names of columns.

Returns
names : vector of names

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ get_col_names() [2/2]

virtual std::vector< std::string > SolverAbstract::get_col_names ( int  first,
int  last 
)
pure virtual

Returns the names of columns from index first to last cannot be declared as const because of some solver methods.

Parameters
first: first index from which name has be returned
last: last index from which name has be returned
Returns
names : vector of names

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ get_col_type()

virtual void SolverAbstract::get_col_type ( char *  coltype,
int  first,
int  last 
) const
pure virtual

Returns the column types for the columns in a given range.

Parameters
coltype: Character array of length last-first+1 where the column types will be returned (C: continuous, I: integer, B: binary, S: semi-continuous, R: semi-continuous integer, P: partial integer)
first: first index of row to get
last: last index of row to get

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ get_lb()

virtual void SolverAbstract::get_lb ( double *  lb,
int  fisrt,
int  last 
) const
pure virtual

Returns the lower bounds for variables in a given range.

Parameters
lb: Double array of length last-first+1 where the lower bounds are to be placed.
first: First column in the range.
last: Last column in the range.

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ get_lp_sol()

virtual void SolverAbstract::get_lp_sol ( double *  primals,
double *  duals,
double *  reduced_costs 
)
pure virtual

Get LP solution of a problem (available after method "solve_lp")

Parameters
primals: values of primal variables
duals: values of dual variables
reduced_costreduced_cost in an optimal basis

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ get_lp_value()

virtual double SolverAbstract::get_lp_value ( ) const
pure virtual

Get the optimal value of a LP problem (available after method "solve_lp" )

Returns
lb : optimal value of a LP problem

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ get_mip_sol()

virtual void SolverAbstract::get_mip_sol ( double *  primals)
pure virtual

Get MIP solution of a problem (available after method "solve_mip")

Parameters
primals: values of primal variables

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ get_mip_value()

virtual double SolverAbstract::get_mip_value ( ) const
pure virtual

Get the optimal value of a MIP problem (available after method "solve_mip")

Returns
lb : optimal value of a MIP problem

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ get_n_integer_vars()

virtual int SolverAbstract::get_n_integer_vars ( ) const
pure virtual

returns number of integer variables in the problem

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ get_ncols()

virtual int SolverAbstract::get_ncols ( ) const
pure virtual

returns number of columns of the problem

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ get_nelems()

virtual int SolverAbstract::get_nelems ( ) const
pure virtual

returns number of non zeros elements in the matrix, excluding objective

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ get_nrows()

virtual int SolverAbstract::get_nrows ( ) const
pure virtual

returns number of rows of the problem

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ get_number_of_instances()

virtual int SolverAbstract::get_number_of_instances ( )
pure virtual

Returns number of instances of solver currently in memory.

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ get_obj()

virtual void SolverAbstract::get_obj ( double *  obj,
int  first,
int  last 
) const
pure virtual

returns the objective function coefficients for the columns in a given range

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ get_rhs()

virtual void SolverAbstract::get_rhs ( double *  rhs,
int  first,
int  last 
) const
pure virtual

Returns the right-hand sides of the rows in a given range.

Parameters
qrtype: Character array of length last-first+1 characters where the rhs will be stored
first: first index of row to get
last: last index of row to get

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ get_rhs_range()

virtual void SolverAbstract::get_rhs_range ( double *  range,
int  first,
int  last 
) const
pure virtual

Returns the right hand side range values for the rows in a given range.

Parameters
range: Double array of length last-first+1 where the right hand side range values are to be placed.
first: first index of row to get
last: last index of row to get

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ get_row_index()

virtual int SolverAbstract::get_row_index ( std::string const &  name)
pure virtual

Returns the index of row named "name".

Parameters
name: name of row to get the index

Implemented in Problem, NOOPSolver, SolverCbc, SolverClp, and SolverXpress.

◆ get_row_names() [1/2]

virtual std::vector< std::string > SolverAbstract::get_row_names ( )
pure virtual

Returns the names of rows.

Returns
names : vector of names

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ get_row_names() [2/2]

virtual std::vector< std::string > SolverAbstract::get_row_names ( int  first,
int  last 
)
pure virtual

Returns the names of row from index first to last cannot be declared as const because of some solver methods.

Parameters
first: first index from which name has be returned
last: last index from which name has be returned
Returns
names : vector of names

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ get_row_type()

virtual void SolverAbstract::get_row_type ( char *  qrtype,
int  first,
int  last 
) const
pure virtual

Returns the row types for the rows in a given range.

Parameters
qrtype: Character array of length last-first+1 characters where the row types will be returned (N, E, L, G, R)
first: first index of row to get
last: last index of row to get

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ get_rows()

virtual void SolverAbstract::get_rows ( int *  mstart,
int *  mclind,
double *  dmatval,
int  size,
int *  nels,
int  first,
int  last 
) const
pure virtual

get coefficients of rows from index first to last

Parameters
mstart: Integer array which will be filled with the indices indicating the starting offsets in the mclind and dmatval arrays for each requested row.
mclind: array containing the column indices of the elements contained in dmatval
dmatval: array containing non zero elements of the rows
size: maximum number of elements to be retrieved
nels: array containing number of elements in dmatval and mclind
first: first index of row to get
last: last index of row to get

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ get_solver_name()

virtual std::string SolverAbstract::get_solver_name ( ) const
pure virtual

Returns the solver used.

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ get_splex_num_of_ite_last()

virtual int SolverAbstract::get_splex_num_of_ite_last ( ) const
pure virtual

Get the number of simplex iterations done in the last resolution of the problem.

Returns
result : number of simplex iterations done in the last resolution of the problem

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ get_ub()

virtual void SolverAbstract::get_ub ( double *  ub,
int  fisrt,
int  last 
) const
pure virtual

Returns the upper bounds for variables in a given range.

Parameters
lb: Double array of length last-first+1 where the upper bounds are to be placed.
first: First column in the range.
last: Last column in the range.

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ init()

virtual void SolverAbstract::init ( )
pure virtual

Initializes a problem.

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ read_basis()

virtual void SolverAbstract::read_basis ( const std::filesystem::path &  filename)
pure virtual

Instructs the optimizer to read in a previously saved basis from a file.

Parameters
filenameFile name where the basis is to be read

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ read_prob_lp()

virtual void SolverAbstract::read_prob_lp ( const std::filesystem::path &  filename)
pure virtual

reads an optimization problem contained in a MPS file

Parameters
name: name of the file to read

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ read_prob_mps()

virtual void SolverAbstract::read_prob_mps ( const std::filesystem::path &  filename)
pure virtual

reads an optimization problem contained in a MPS file

Parameters
name: name of the file to read

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ set_algorithm()

virtual void SolverAbstract::set_algorithm ( std::string const &  algo)
pure virtual

Sets algorithm used by solver to solve LP's.

Parameters
algo: string of the name of the algorithm

Implemented in Problem, NOOPSolver, SolverCbc, SolverClp, and SolverXpress.

◆ set_obj()

virtual void SolverAbstract::set_obj ( const double *  obj,
int  first,
int  last 
)
pure virtual

Set the objective function coefficients for the columns in a given range.

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ set_obj_to_zero()

virtual void SolverAbstract::set_obj_to_zero ( )
pure virtual

Set the objective function coefficients to zero.

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ set_optimality_gap()

virtual void SolverAbstract::set_optimality_gap ( double  gap)
pure virtual

Sets the optimality gap.

Parameters
gapdouble of the value of wanted gap

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ set_output_log_level()

virtual void SolverAbstract::set_output_log_level ( int  loglevel)
pure virtual

Sets log level of the solver.

Parameters
loglevel: level of log to set

Implemented in SolverCbc, SolverClp, SolverXpress, Problem, and NOOPSolver.

◆ set_simplex_iter()

virtual void SolverAbstract::set_simplex_iter ( int  iter)
pure virtual

Sets the maximum number of simplex iterations the solver can perform.

Parameters
itermaximum number of simplex iterations

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ set_threads()

virtual void SolverAbstract::set_threads ( int  n_threads)
pure virtual

Sets the maximum number of threads used to perform optimization.

Parameters
n_threadsmaximum number of threads

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ solve_lp()

virtual int SolverAbstract::solve_lp ( )
pure virtual

Solves a problem as LP.

Returns
lp_status : status of the problem after resolution

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ solve_mip()

virtual int SolverAbstract::solve_mip ( )
pure virtual

Solves a problem as MIP.

Returns
lp_status : status of the problem after resolution

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ write_basis()

virtual void SolverAbstract::write_basis ( const std::filesystem::path &  filename)
pure virtual

Writes the current basis to a file for later input into the optimizer.

Parameters
filename: file name where the basis is written

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ write_prob_lp()

virtual void SolverAbstract::write_prob_lp ( const std::filesystem::path &  filename)
pure virtual

writes an optimization problem in a LP file

Parameters
name: name of the file to write

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ write_prob_mps()

virtual void SolverAbstract::write_prob_mps ( const std::filesystem::path &  filename)
pure virtual

writes an optimization problem in a MPS file

Parameters
name: name of the file to write

Implemented in Problem, SolverCbc, SolverClp, SolverXpress, and NOOPSolver.

◆ zero_status_check()

void SolverAbstract::zero_status_check ( int  status,
const std::string &  action_failed,
const std::string &  log_location 
) const
inline

Check if a status code is different to 0, throw InvalidStatusException if it occurs.

Parameters
status: status code to check
action_failed: action which returned the non zero status code, used to print the error message.

Member Data Documentation

◆ _name

std::string SolverAbstract::_name

Name of the problem

◆ _streams

std::list<std::ostream *> SolverAbstract::_streams

List of streams to print the output (default std::cout)

◆ SOLVER_STRING_STATUS

std::vector<std::string> SolverAbstract::SOLVER_STRING_STATUS
Initial value:
= {
"OPTIMAL", "INFEASIBLE", "UNBOUNDED", "INForUNBOUND", "UNKNOWN"}

The documentation for this class was generated from the following file: