A C++ Framework for Optimization
Loading...
Searching...
No Matches
Optimizers_CriticalValueColumnAndConstraintGeneration.h
1//
2// Created by henri on 09.01.26.
3//
4
5#ifndef IDOL_OPTIMIZERS_CRITICALVALUECOLUMNANDCONSTRAINTGENERATION_H
6#define IDOL_OPTIMIZERS_CRITICALVALUECOLUMNANDCONSTRAINTGENERATION_H
7
8#include "idol/general/optimizers/Algorithm.h"
9#include "idol/robust/modeling/Description.h"
10#include "Formulation.h"
11
12namespace idol::Optimizers::Robust {
13 class CriticalValueColumnAndConstraintGeneration;
14}
15
17 const idol::Robust::Description& m_robust_description;
18 std::unique_ptr<OptimizerFactory> m_master_optimizer;
19 std::unique_ptr<OptimizerFactory> m_separation_optimizer;
20
21 std::unique_ptr<idol::CVCCG::Formulation> m_formulation;
22
23 std::optional<PrimalPoint> m_last_master_solution;
24 unsigned int m_n_iterations = 0;
25protected:
26 void add(const Var& t_var) override;
27 void add(const Ctr& t_ctr) override;
28 void add(const QCtr& t_ctr) override;
29 void add(const SOSCtr& t_ctr) override;
30 void remove(const Var& t_var) override;
31 void remove(const Ctr& t_ctr) override;
32 void remove(const QCtr& t_ctr) override;
33 void write(const std::string& t_name) override;
34 void hook_before_optimize() override;
35 void hook_optimize() override;
36 void hook_after_optimize() override;
37 void set_solution_index(unsigned t_index) override;
38 void update_obj_sense() override;
39 void update_obj() override;
40 void update_rhs() override;
41 void update_obj_constant() override;
42 void update_mat_coeff(const Ctr& t_ctr, const Var& t_var) override;
43 void update_ctr_type(const Ctr& t_ctr) override;
44 void update_ctr_rhs(const Ctr& t_ctr) override;
45 void update_var_type(const Var& t_var) override;
46 void update_var_lb(const Var& t_var) override;
47 void update_var_ub(const Var& t_var) override;
48 void update_var_obj(const Var& t_var) override;
49 void update() override;
50
51 idol::CVCCG::Formulation& get_formulation_or_throw();
52 [[nodiscard]] const idol::CVCCG::Formulation& get_formulation_or_throw() const;
53
54 void solve_master_problem();
55 void solve_separation_problem();
56 void add_scenario_to_master_problem();
57public:
59 const idol::Robust::Description& t_description,
60 const OptimizerFactory& t_master_optimizer,
61 const OptimizerFactory& t_separation_optimizer
62 );
63
64 [[nodiscard]] std::string name() const override;
65 [[nodiscard]] double get_var_primal(const Var& t_var) const override;
66 [[nodiscard]] double get_var_reduced_cost(const Var& t_var) const override;
67 [[nodiscard]] double get_var_ray(const Var& t_var) const override;
68 [[nodiscard]] double get_ctr_dual(const Ctr& t_ctr) const override;
69 [[nodiscard]] double get_ctr_farkas(const Ctr& t_ctr) const override;
70 [[nodiscard]] unsigned get_n_solutions() const override;
71 [[nodiscard]] unsigned get_solution_index() const override;
72
73 friend class idol::CVCCG::Formulation;
74};
75
76#endif //IDOL_OPTIMIZERS_CRITICALVALUECOLUMNANDCONSTRAINTGENERATION_H