20 const ::idol::Robust::Description &m_robust_description;
21 const ::idol::Bilevel::Description &m_bilevel_description;
22 std::unique_ptr<OptimizerFactory> m_master_optimizer;
23 std::unique_ptr<idol::CCG::Formulation> m_formulation;
24 bool m_check_for_repeated_scenarios;
25 unsigned int m_n_iterations = 0;
28 std::vector<Point<Var>> m_initial_scenarios;
29 std::unique_ptr<OptimizerFactory> m_initial_scenario_by_minimization;
30 std::unique_ptr<OptimizerFactory> m_initial_scenario_by_maximization;
33 const bool m_with_feasibility_separation_loop_reset =
false;
34 const bool m_with_annotation_for_infeasible_scenario =
true;
35 std::vector<std::unique_ptr<OptimizerFactory>> m_optimizer_feasibility_separation;
36 unsigned int m_index_feasibility_separation = 0;
39 const bool m_with_optimality_separation_loop_reset =
false;
40 std::vector<std::unique_ptr<OptimizerFactory>> m_optimizer_optimality_separation;
41 unsigned int m_index_optimality_separation = 0;
44 const bool m_with_joint_separation_loop_reset =
false;
45 std::vector<std::unique_ptr<OptimizerFactory>> m_optimizer_joint_separation;
46 unsigned int m_index_joint_separation = 0;
48 std::optional<PrimalPoint> m_last_master_solution;
52 Timer m_separation_timer;
55 const ::idol::Robust::Description &t_robust_description,
56 const ::idol::Bilevel::Description &t_bilevel_description,
61 const std::list<std::unique_ptr<OptimizerFactory>>& t_optimizer_feasibility_separation,
62 const std::list<std::unique_ptr<OptimizerFactory>>& t_optimizer_optimality_separation,
63 const std::list<std::unique_ptr<OptimizerFactory>>& t_optimizer_joint_separation,
64 bool t_check_for_repeated_scenarios);
66 [[nodiscard]] std::string name()
const override;
68 [[nodiscard]]
double get_var_primal(
const Var &t_var)
const override;
70 [[nodiscard]]
double get_var_reduced_cost(
const Var &t_var)
const override;
72 [[nodiscard]]
double get_var_ray(
const Var &t_var)
const override;
74 [[nodiscard]]
double get_ctr_dual(
const Ctr &t_ctr)
const override;
76 [[nodiscard]]
double get_ctr_farkas(
const Ctr &t_ctr)
const override;
78 [[nodiscard]]
unsigned int get_n_solutions()
const override;
80 [[nodiscard]]
unsigned int get_solution_index()
const override;
82 [[nodiscard]]
unsigned int get_n_scenarios()
const {
return m_formulation->n_added_scenarios(); }
84 [[nodiscard]]
unsigned int get_n_iterations()
const {
return m_n_iterations; }
86 [[nodiscard]]
const Timer& get_master_timer()
const {
return m_master_timer; }
88 [[nodiscard]]
const Timer& get_separation_timer()
const {
return m_separation_timer; }
90 [[nodiscard]]
bool check_for_repeated_scenarios()
const {
return m_check_for_repeated_scenarios; }
93 void add(
const Var &t_var)
override;
95 void add(
const Ctr &t_ctr)
override;
97 void add(
const QCtr &t_ctr)
override;
99 void remove(
const Var &t_var)
override;
101 void remove(
const Ctr &t_ctr)
override;
103 void remove(
const QCtr &t_ctr)
override;
105 void update()
override;
107 void write(
const std::string &t_name)
override;
109 void hook_before_optimize()
override;
111 void hook_optimize()
override;
113 void set_solution_index(
unsigned int t_index)
override;
115 void update_obj_sense()
override;
117 void update_obj()
override;
119 void update_rhs()
override;
121 void update_obj_constant()
override;
123 void update_mat_coeff(
const Ctr &t_ctr,
const Var &t_var)
override;
125 void update_ctr_type(
const Ctr &t_ctr)
override;
127 void update_ctr_rhs(
const Ctr &t_ctr)
override;
129 void update_var_type(
const Var &t_var)
override;
131 void update_var_lb(
const Var &t_var)
override;
133 void update_var_ub(
const Var &t_var)
override;
135 void update_var_obj(
const Var &t_var)
override;
137 void add_initial_scenarios();
139 void add_initial_scenario_by_min_or_max(
const OptimizerFactory& t_optimizer,
double t_coefficient);
141 void solve_master_problem();
143 void check_termination_criteria();
146 void log_iteration(
bool t_is_feasibility_separation,
147 const std::string& t_optimizer_name,
148 const SolutionStatus& t_status,
149 const SolutionReason& t_reason,
150 bool t_separation_outcome);
151 void log_iteration_separator();
153 void solve_adversarial_problem();
154 unsigned int solve_feasibility_adversarial_problem();
155 unsigned int solve_optimality_adversarial_problem();
156 unsigned int solve_joint_adversarial_problem();