Antares Xpansion
Investment simulations for Antares studies
Loading...
Searching...
No Matches
NOOPSolver.h
1//
2// Created by marechaljas on 02/05/2022.
3//
4
5#ifndef ANTARESXPANSION_TESTS_CPP_LP_NAMER_NOOPSOLVER_H_
6#define ANTARESXPANSION_TESTS_CPP_LP_NAMER_NOOPSOLVER_H_
7
8#include "antares-xpansion/multisolver_interface/SolverAbstract.h"
10 public:
11 virtual int get_number_of_instances() override { return 0; }
12 virtual std::string get_solver_name() const override { return std::string(); }
13 virtual void init() override {}
14 virtual void free() override {}
15 virtual void write_prob_mps(const std::filesystem::path &filename) override {}
16 virtual void write_prob_lp(const std::filesystem::path &filename) override {}
17 virtual void read_prob_mps(const std::filesystem::path &filename) override {}
18 virtual void read_prob_lp(const std::filesystem::path &filename) override {}
19 virtual void copy_prob(Ptr fictif_solv) override {}
20 virtual int get_ncols() const override { return 0; }
21 virtual int get_nrows() const override { return 0; }
22 virtual int get_nelems() const override { return 0; }
23 virtual int get_n_integer_vars() const override { return 0; }
24 virtual void get_obj(double *obj, int first, int last) const override {}
25 void set_obj_to_zero() override {}
26 void set_obj(const double *obj, int first, int last) override {}
27 virtual void get_rows(int *mstart, int *mclind, double *dmatval, int size,
28 int *nels, int first, int last) const override {}
29 virtual void get_row_type(char *qrtype, int first, int last) const override {}
30 virtual void get_rhs(double *rhs, int first, int last) const override {}
31 virtual void get_rhs_range(double *range, int first,
32 int last) const override {}
33 virtual void get_col_type(char *coltype, int first, int last) const override {
34
35 }
36 virtual void get_lb(double *lb, int fisrt, int last) const override {}
37 virtual void get_ub(double *ub, int fisrt, int last) const override {}
38 virtual int get_row_index(const std::string &name) override { return 0; }
39 virtual int get_col_index(const std::string &name) override { return 0; }
40 virtual std::vector<std::string> get_row_names(int first, int last) override {
41 return std::vector<std::string>();
42 }
43 virtual std::vector<std::string> get_row_names() override {
44 return std::vector<std::string>();
45 }
46 virtual std::vector<std::string> get_col_names(int first, int last) override {
47 return std::vector<std::string>();
48 }
49 virtual std::vector<std::string> get_col_names() override {
50 return std::vector<std::string>();
51 }
52 virtual void del_rows(int first, int last) override {}
53 virtual void add_rows(int newrows, int newnz, const char *qrtype,
54 const double *rhs, const double *range,
55 const int *mstart, const int *mclind,
56 const double *dmatval,
57 const std::vector<std::string> &names = {}) override {}
58 virtual void add_cols(int newcol, int newnz, const double *objx,
59 const int *mstart, const int *mrwind,
60 const double *dmatval, const double *bdl,
61 const double *bdu) override {}
62 virtual void add_name(int type, const char *cnames, int indice) override {}
63 virtual void add_names(int type, const std::vector<std::string> &cnames,
64 int first, int end) override {}
65 virtual void chg_obj(const std::vector<int> &mindex,
66 const std::vector<double> &obj) override {}
67 virtual void chg_obj_direction(const bool minimize) override {}
68 virtual void chg_bounds(const std::vector<int> &mindex,
69 const std::vector<char> &qbtype,
70 const std::vector<double> &bnd) override {}
71 virtual void chg_col_type(const std::vector<int> &mindex,
72 const std::vector<char> &qctype) override {}
73 virtual void chg_rhs(int id_row, double val) override {}
74 virtual void chg_coef(int id_row, int id_col, double val) override {}
75 virtual void chg_row_name(int id_row, const std::string &name) override {}
76 virtual void chg_col_name(int id_col, const std::string &name) override {}
77 virtual int solve_lp() override { return 0; }
78 virtual int solve_mip() override { return 0; }
79 virtual void get_basis(int *rstatus, int *cstatus) const override {}
80 virtual double get_mip_value() const override { return 0; }
81 virtual double get_lp_value() const override { return 0; }
82 virtual int get_splex_num_of_ite_last() const override { return 0; }
83 virtual void get_lp_sol(double *primals, double *duals,
84 double *reduced_costs) override {}
85 virtual void get_mip_sol(double *primals) override {}
86 virtual void set_output_log_level(int loglevel) override {}
87 virtual void set_algorithm(const std::string &algo) override {}
88 virtual void set_threads(int n_threads) override {}
89 virtual void set_optimality_gap(double gap) override {}
90 virtual void set_simplex_iter(int iter) override {}
91 virtual void write_basis(const std::filesystem::path &filename) override {}
92 virtual void read_basis(const std::filesystem::path &filename) override {}
93 void save_prob(const std::filesystem::path &filename) override {}
94 void restore_prob(const std::filesystem::path &filename) override {}
95};
96
97#endif // ANTARESXPANSION_TESTS_CPP_LP_NAMER_NOOPSOLVER_H_
Definition NOOPSolver.h:9
virtual 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.
Definition NOOPSolver.h:31
virtual void read_basis(const std::filesystem::path &filename) override
Instructs the optimizer to read in a previously saved basis from a file.
Definition NOOPSolver.h:92
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) override
Adds new columns to the problem.
Definition NOOPSolver.h:58
virtual void get_basis(int *rstatus, int *cstatus) const override
Returns the current basis into the user’s data arrays.
Definition NOOPSolver.h:79
virtual int solve_lp() override
Solves a problem as LP.
Definition NOOPSolver.h:77
virtual void get_row_type(char *qrtype, int first, int last) const override
Returns the row types for the rows in a given range.
Definition NOOPSolver.h:29
virtual int get_nelems() const override
returns number of non zeros elements in the matrix, excluding objective
Definition NOOPSolver.h:22
virtual void set_threads(int n_threads) override
Sets the maximum number of threads used to perform optimization.
Definition NOOPSolver.h:88
virtual int get_nrows() const override
returns number of rows of the problem
Definition NOOPSolver.h:21
virtual void init() override
Initializes a problem.
Definition NOOPSolver.h:13
virtual int get_n_integer_vars() const override
returns number of integer variables in the problem
Definition NOOPSolver.h:23
virtual void read_prob_lp(const std::filesystem::path &filename) override
reads an optimization problem contained in a MPS file
Definition NOOPSolver.h:18
virtual 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
Definition NOOPSolver.h:27
virtual void set_output_log_level(int loglevel) override
Sets log level of the solver.
Definition NOOPSolver.h:86
virtual void chg_coef(int id_row, int id_col, double val) override
Change a coefficient in the matrix.
Definition NOOPSolver.h:74
virtual void free() override
Frees all the datas contained in the Solver environment.
Definition NOOPSolver.h:14
virtual void chg_obj_direction(const bool minimize) override
Change the problem's objective function sense to minimize or maximize.
Definition NOOPSolver.h:67
void set_obj_to_zero() override
Set the objective function coefficients to zero.
Definition NOOPSolver.h:25
virtual void chg_rhs(int id_row, double val) override
Change rhs of a row.
Definition NOOPSolver.h:73
virtual void get_lb(double *lb, int fisrt, int last) const override
Returns the lower bounds for variables in a given range.
Definition NOOPSolver.h:36
virtual std::vector< std::string > get_col_names() override
Returns the names of columns.
Definition NOOPSolver.h:49
virtual double get_lp_value() const override
Get the optimal value of a LP problem (available after method "solve_lp" )
Definition NOOPSolver.h:81
void set_obj(const double *obj, int first, int last) override
Set the objective function coefficients for the columns in a given range.
Definition NOOPSolver.h:26
virtual int get_number_of_instances() override
Returns number of instances of solver currently in memory.
Definition NOOPSolver.h:11
virtual void set_optimality_gap(double gap) override
Sets the optimality gap.
Definition NOOPSolver.h:89
virtual void chg_row_name(int id_row, const std::string &name) override
Change the name of a constraint.
Definition NOOPSolver.h:75
void restore_prob(const std::filesystem::path &filename) override
read an optimisation problem from a file
Definition NOOPSolver.h:94
virtual void set_simplex_iter(int iter) override
Sets the maximum number of simplex iterations the solver can perform.
Definition NOOPSolver.h:90
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={}) override
Adds rows to the problem.
Definition NOOPSolver.h:53
virtual void get_obj(double *obj, int first, int last) const override
returns the objective function coefficients for the columns in a given range
Definition NOOPSolver.h:24
virtual int solve_mip() override
Solves a problem as MIP.
Definition NOOPSolver.h:78
virtual void get_col_type(char *coltype, int first, int last) const override
Returns the column types for the columns in a given range.
Definition NOOPSolver.h:33
virtual void chg_bounds(const std::vector< int > &mindex, const std::vector< char > &qbtype, const std::vector< double > &bnd) override
Change bounds of some variables.
Definition NOOPSolver.h:68
virtual 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 sol...
Definition NOOPSolver.h:46
virtual int get_row_index(const std::string &name) override
Returns the index of row named "name".
Definition NOOPSolver.h:38
virtual int get_ncols() const override
returns number of columns of the problem
Definition NOOPSolver.h:20
virtual void chg_col_type(const std::vector< int > &mindex, const std::vector< char > &qctype) override
Change type of some columns.
Definition NOOPSolver.h:71
virtual void get_rhs(double *rhs, int first, int last) const override
Returns the right-hand sides of the rows in a given range.
Definition NOOPSolver.h:30
virtual void read_prob_mps(const std::filesystem::path &filename) override
reads an optimization problem contained in a MPS file
Definition NOOPSolver.h:17
void save_prob(const std::filesystem::path &filename) override
write an optimisation problem in a file
Definition NOOPSolver.h:93
virtual void get_lp_sol(double *primals, double *duals, double *reduced_costs) override
Get LP solution of a problem (available after method "solve_lp")
Definition NOOPSolver.h:83
virtual 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 ...
Definition NOOPSolver.h:40
virtual void copy_prob(Ptr fictif_solv) override
copy an existing problem
Definition NOOPSolver.h:19
virtual int get_splex_num_of_ite_last() const override
Get the number of simplex iterations done in the last resolution of the problem.
Definition NOOPSolver.h:82
virtual void del_rows(int first, int last) override
Deletes rows between index first and last.
Definition NOOPSolver.h:52
virtual void set_algorithm(const std::string &algo) override
Sets algorithm used by solver to solve LP's.
Definition NOOPSolver.h:87
virtual int get_col_index(const std::string &name) override
Returns the index of column named "name".
Definition NOOPSolver.h:39
virtual std::string get_solver_name() const override
Returns the solver used.
Definition NOOPSolver.h:12
virtual void chg_obj(const std::vector< int > &mindex, const std::vector< double > &obj) override
Change coefficients in objective function.
Definition NOOPSolver.h:65
virtual void write_basis(const std::filesystem::path &filename) override
Writes the current basis to a file for later input into the optimizer.
Definition NOOPSolver.h:91
virtual void write_prob_mps(const std::filesystem::path &filename) override
writes an optimization problem in a MPS file
Definition NOOPSolver.h:15
virtual void get_mip_sol(double *primals) override
Get MIP solution of a problem (available after method "solve_mip")
Definition NOOPSolver.h:85
virtual void add_name(int type, const char *cnames, int indice) override
Adds a name to a row or a column.
Definition NOOPSolver.h:62
virtual void chg_col_name(int id_col, const std::string &name) override
Change the name of a variable.
Definition NOOPSolver.h:76
virtual void write_prob_lp(const std::filesystem::path &filename) override
writes an optimization problem in a LP file
Definition NOOPSolver.h:16
virtual void get_ub(double *ub, int fisrt, int last) const override
Returns the upper bounds for variables in a given range.
Definition NOOPSolver.h:37
virtual double get_mip_value() const override
Get the optimal value of a MIP problem (available after method "solve_mip")
Definition NOOPSolver.h:80
virtual std::vector< std::string > get_row_names() override
Returns the names of rows.
Definition NOOPSolver.h:43
Definition SolverAbstract.h:170
std::shared_ptr< SolverAbstract > Ptr
Definition SolverAbstract.h:181