Antares Xpansion
Investment simulations for Antares studies
|
Public Member Functions | |
WorkerMaster (VariableMap const &variable_map, const std::filesystem::path &path_to_mps, const std::string &solver_name, int log_level, int subproblems_count, SolverLogManager &solver_log_manager, bool mps_has_alpha, Logger logger, ProblemsFormat format) | |
Constructor of a Master Problem. | |
void | get (Point &x0, double &overall_subpb_cost_under_approx, DblVector &single_subpb_costs_under_approx) |
Return optimal variables of a problem. | |
void | get_dual_values (std::vector< double > &dual) const |
Set dual values of a problem in a vector. | |
int | get_number_constraint () const |
Return number of constraint in a problem. | |
void | add_cut (Point const &s, Point const &x0, double const &rhs) const |
Add benders cut to a problem. | |
void | add_cut_by_iter (int i, Point const &s, double const &sx0, double const &rhs) const |
Add benders cut to a problem. | |
void | add_dynamic_cut (Point const &s, double const &sx0, double const &rhs) const |
Add benders cut to a problem. | |
void | addSubproblemCut (int i, Point const &s, Point const &x0, double const &rhs) const |
Add one benders cut to a problem. | |
void | fix_alpha (double const &bestUB) const |
Fix an upper bound and the variable overall_subpb_cost_under_approx of a problem. | |
virtual void | DeactivateIntegrityConstraints () const |
virtual void | ActivateIntegrityConstraints () const |
virtual std::vector< int > | get_id_nb_units () const |
Public Member Functions inherited from Worker | |
Worker (VariableMap variable_map, std::filesystem::path path_to_mps, Logger logger) | |
void | init (const std::string &solver_name, int log_level, SolverLogManager &solver_log_manager, ProblemsFormat format) |
Initialization of a problem. | |
void | get_value (double &lb) const |
Return the optimal value of a problem. | |
void | get_splex_num_of_ite_last (int &result) const |
Get the number of iteration needed to solve a problem. | |
void | free () |
Free the problem. | |
void | write_basis (const std::filesystem::path &filename) const |
virtual std::shared_ptr< SolverAbstract > | solver () const |
void | solve (int &lp_status, const std::string &outputroot, const std::string &output_master_mps_file_name, Writer writer) const |
Method to solve a problem. | |
int | RowIndex (const std::string &row_name) const |
void | ChangeRhs (int id_row, double val) const |
void | GetRhs (double *val, int id_row) const |
void | AddRows (std::vector< char > const &qrtype_p, std::vector< double > const &rhs_p, std::vector< double > const &range_p, std::vector< int > const &mstart_p, std::vector< int > const &mclind_p, std::vector< double > const &dmatval_p, const std::vector< std::string > &row_names) const |
int | Getnrows () const |
Returns the number of rows (constraints) | |
int | Getncols () const |
Additional Inherited Members | |
Public Attributes inherited from Worker | |
std::filesystem::path | _path_to_mps |
VariableMap | _name_to_id |
Int2Str | _id_to_name |
std::shared_ptr< SolverAbstract > | _solver |
bool | _is_master = false |
Logger | logger_ |
WorkerMaster::WorkerMaster | ( | VariableMap const & | variable_map, |
const std::filesystem::path & | path_to_mps, | ||
const std::string & | solver_name, | ||
int | log_level, | ||
int | subproblems_count, | ||
SolverLogManager & | solver_log_manager, | ||
bool | mps_has_alpha, | ||
Logger | logger, | ||
ProblemsFormat | format ) |
Constructor of a Master Problem.
Construct a Master Problem by loading mps and mapping files and adding the variable overall_subpb_cost_under_approx
variable_map | : map linking each variable to its id in the problem |
path_to_mps | : path to the problem mps file |
solver_name | : solver name |
log_level | : solver log level |
subproblems_count | : number of subproblems |
void WorkerMaster::add_cut | ( | Point const & | s, |
Point const & | x_cut, | ||
double const & | rhs ) const |
Add benders cut to a problem.
s | : subgradient of optimal slave variables |
x_cut | : master separation point |
rhs | : optimal slave value |
void WorkerMaster::add_cut_by_iter | ( | int | i, |
Point const & | s, | ||
double const & | sx0, | ||
double const & | rhs ) const |
Add benders cut to a problem.
i | : identifier of a subproblem |
s | : optimal slave variables |
sx0 | : subgradient times x0 |
rhs | : optimal slave value |
void WorkerMaster::add_dynamic_cut | ( | Point const & | s, |
double const & | sx0, | ||
double const & | rhs ) const |
Add benders cut to a problem.
s | : optimal slave variables |
sx0 | : subgradient times x0 |
rhs | : optimal slave value |
void WorkerMaster::addSubproblemCut | ( | int | i, |
Point const & | s, | ||
Point const & | x_cut, | ||
double const & | rhs ) const |
Add one benders cut to a problem.
i | : identifier of a subproblem |
s | : optimal slave variables |
x_cut | : optimal Master variables |
rhs | : optimal slave value |
void WorkerMaster::fix_alpha | ( | double const & | bestUB | ) | const |
Fix an upper bound and the variable overall_subpb_cost_under_approx of a problem.
bestUB | : bound to fix |
void WorkerMaster::get | ( | Point & | x_out, |
double & | overall_subpb_cost_under_approx, | ||
DblVector & | single_subpb_costs_under_approx ) |
Return optimal variables of a problem.
Set optimal variables of a problem which has the form (min(x,overall_subpb_cost_under_approx) : f(x) + overall_subpb_cost_under_approx)
x_out | : reference to an empty map list |
overall_subpb_cost_under_approx | : reference to an empty double |
void WorkerMaster::get_dual_values | ( | std::vector< double > & | dual | ) | const |
Set dual values of a problem in a vector.
dual | : reference to a vector of double |