Antares Xpansion
Investment simulations for Antares studies
Loading...
Searching...
No Matches
MockProblem Class Reference
Inheritance diagram for MockProblem:
Problem SolverAbstract

Public Member Functions

 MockProblem (int year)
 
- Public Member Functions inherited from Problem
 Problem (SolverAbstract::Ptr solver_abstract)
 
unsigned int McYear () const
 
unsigned int Week () const
 
int get_number_of_instances () override
 Returns number of instances of solver currently in memory.
 
std::string get_solver_name () const override
 Returns the solver used.
 
void init () override
 Initializes a problem.
 
void free () override
 Frees all the datas contained in the Solver environment.
 
void write_prob_mps (const std::filesystem::path &filename) override
 writes an optimization problem in a MPS file
 
void write_prob_lp (const std::filesystem::path &filename) override
 writes an optimization problem in a LP file
 
void read_prob_mps (const std::filesystem::path &filename) override
 reads an optimization problem contained in a MPS file
 
void read_prob_lp (const std::filesystem::path &filename) override
 reads an optimization problem contained in a MPS file
 
void copy_prob (Ptr fictif_solv) override
 copy an existing problem
 
int get_ncols () const override
 returns number of columns of the problem
 
int get_nrows () const override
 returns number of rows of the problem
 
int get_nelems () const override
 returns number of non zeros elements in the matrix, excluding objective
 
int get_n_integer_vars () const override
 returns number of integer variables in the problem
 
void get_obj (double *obj, int first, int last) const override
 returns the objective function coefficients for the columns in a given range
 
void set_obj_to_zero () override
 Set the objective function coefficients to zero.
 
void set_obj (const double *obj, int first, int last) override
 Set the objective function coefficients for the columns in a given range.
 
void get_rows (int *mstart, int *mclind, double *dmatval, int size, int *nels, int first, int last) const override
 get coefficients of rows from index first to last
 
void get_row_type (char *qrtype, int first, int last) const override
 Returns the row types for the rows in a given range.
 
void get_rhs (double *rhs, int first, int last) const override
 Returns the right-hand sides of the rows in a given range.
 
void get_rhs_range (double *range, int first, int last) const override
 Returns the right hand side range values for the rows in a given range.
 
void get_col_type (char *coltype, int first, int last) const override
 Returns the column types for the columns in a given range.
 
void get_lb (double *lb, int fisrt, int last) const override
 Returns the lower bounds for variables in a given range.
 
void get_ub (double *ub, int fisrt, int last) const override
 Returns the upper bounds for variables in a given range.
 
int get_row_index (const std::string &name) override
 Returns the index of row named "name".
 
int get_col_index (const std::string &name) override
 Returns the index of column named "name".
 
std::vector< std::string > get_row_names (int first, int last) override
 Returns the names of row from index first to last cannot be declared as const because of some solver methods.
 
std::vector< std::string > get_row_names () override
 Returns the names of rows.
 
std::vector< std::string > get_col_names (int first, int last) override
 Returns the names of columns from index first to last cannot be declared as const because of some solver methods.
 
std::vector< std::string > get_col_names () override
 Returns the names of columns.
 
void del_rows (int first, int last) override
 Deletes rows between index first and last.
 
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) override
 Adds rows to the problem.
 
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, const std::vector< std::string > &names) override
 Adds new columns to the problem.
 
void add_name (int type, const char *cnames, int indice) override
 Adds a name to a row or a column.
 
void add_names (int type, const std::vector< std::string > &cnames, int first, int end) override
 
void chg_obj (const std::vector< int > &mindex, const std::vector< double > &obj) override
 Change coefficients in objective function.
 
void chg_obj_direction (const bool minimize) override
 Change the problem's objective function sense to minimize or maximize.
 
void chg_bounds (const std::vector< int > &mindex, const std::vector< char > &qbtype, const std::vector< double > &bnd) override
 Change bounds of some variables.
 
void chg_col_type (const std::vector< int > &mindex, const std::vector< char > &qctype) override
 Change type of some columns.
 
void chg_rhs (int id_row, double val) override
 Change rhs of a row.
 
void chg_coef (int id_row, int id_col, double val) override
 Change a coefficient in the matrix.
 
void chg_row_name (int id_row, const std::string &name) override
 Change the name of a constraint.
 
void chg_col_name (int id_col, const std::string &name) override
 Change the name of a variable.
 
int solve_lp () override
 Solves a problem as LP.
 
int solve_mip () override
 Solves a problem as MIP.
 
void get_basis (int *rstatus, int *cstatus) const override
 Returns the current basis into the user’s data arrays.
 
double get_mip_value () const override
 Get the optimal value of a MIP problem (available after method "solve_mip")
 
double get_lp_value () const override
 Get the optimal value of a LP problem (available after method "solve_lp" )
 
int get_splex_num_of_ite_last () const override
 Get the number of simplex iterations done in the last resolution of the problem.
 
void get_lp_sol (double *primals, double *duals, double *reduced_costs) const override
 Get LP solution of a problem (available after method "solve_lp")
 
void get_mip_sol (double *primals) override
 Get MIP solution of a problem (available after method "solve_mip")
 
void set_output_log_level (int loglevel) override
 Sets log level of the solver.
 
void set_algorithm (const std::string &algo) override
 Sets algorithm used by solver to solve LP's.
 
void set_threads (int n_threads) override
 Sets the maximum number of threads used to perform optimization.
 
void set_optimality_gap (double gap) override
 Sets the optimality gap.
 
void set_simplex_iter (int iter) override
 Sets the maximum number of simplex iterations the solver can perform.
 
void write_basis (const std::filesystem::path &filename) override
 Writes the current basis to a file for later input into the optimizer.
 
void read_basis (const std::filesystem::path &filename) override
 Instructs the optimizer to read in a previously saved basis from a file.
 
void save_prob (const std::filesystem::path &filename) override
 write an optimisation problem in a file
 
void restore_prob (const std::filesystem::path &filename) override
 read an optimisation problem from a file
 
- Public Member Functions inherited from SolverAbstract
 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
 
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.
 
bool operator== (const SolverAbstract &) const
 

Additional Inherited Members

- Public Types inherited from SolverAbstract
typedef std::shared_ptr< SolverAbstractPtr
 
- Public Attributes inherited from Problem
unsigned int mc_year = 0
 
unsigned int week = 0
 
- Public Attributes inherited from SolverAbstract
std::vector< std::string > SOLVER_STRING_STATUS
 
std::string _name
 
std::list< std::ostream * > _streams
 
FILE * _fp = nullptr
 
std::filesystem::path _log_file = ""
 

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