idol
A C++ Framework for Optimization
Loading...
Searching...
No Matches
Optimizers_DantzigWolfeDecomposition.h
1//
2// Created by henri on 31.10.23.
3//
4
5#ifndef IDOL_OPTIMIZERS_DANTZIGWOLFEDECOMPOSITION_H
6#define IDOL_OPTIMIZERS_DANTZIGWOLFEDECOMPOSITION_H
7
8#include "idol/general/optimizers/Algorithm.h"
9#include "Formulation.h"
10#include "SubProblem.h"
11#include "idol/mixed-integer/optimizers/dantzig-wolfe/infeasibility-strategies/DantzigWolfeInfeasibilityStrategy.h"
12#include "idol/mixed-integer/optimizers/dantzig-wolfe/stabilization/DualPriceSmoothingStabilization.h"
13#include "idol/mixed-integer/optimizers/dantzig-wolfe/logs/Factory.h"
14
15namespace idol::Optimizers {
16 class DantzigWolfeDecomposition;
17}
18
21 std::unique_ptr<OptimizerFactory> m_master_optimizer_factory;
22 std::unique_ptr<DantzigWolfe::InfeasibilityStrategyFactory::Strategy> m_strategy;
23 std::unique_ptr<DantzigWolfe::DualPriceSmoothingStabilization::Strategy> m_stabilization;
24 std::unique_ptr<Logs::DantzigWolfe::Factory::Strategy> m_logger;
25 std::optional<DantzigWolfe::SubProblem> m_default_sub_problem_spec;
26 std::vector<DantzigWolfe::SubProblem> m_sub_problem_specifications;
27 unsigned int m_with_dynamic_sub_problems = true;
28 unsigned int m_max_parallel_pricing;
29 bool m_use_hard_branching;
30 bool m_remove_infeasible_columns;
31public:
32 DantzigWolfeDecomposition(const Model& t_model,
33 idol::DantzigWolfe::Formulation&& t_formulation,
34 const OptimizerFactory& t_master_optimizer_factory,
36 unsigned int t_max_parallel_pricing,
37 bool t_use_hard_branching,
38 bool t_remove_infeasible_columns,
39 std::vector<DantzigWolfe::SubProblem>&& t_sub_problem_specifications,
40 std::optional<DantzigWolfe::SubProblem> t_default_sub_problem_spec,
42 const Logs::DantzigWolfe::Factory& t_logger_factory);
43
44 std::string name() const override;
45
46 [[nodiscard]] const DantzigWolfe::Formulation& formulation() const { return m_formulation; }
47
48 DantzigWolfe::Formulation& formulation() { return m_formulation; }
49
50 class ColumnGeneration;
51protected:
52 void hook_before_optimize() override;
53 void hook_optimize() override;
54 void hook_after_optimize() override;
55
56 void add(const Var &t_var) override;
57 void add(const Ctr &t_ctr) override;
58 void add(const QCtr &t_ctr) override;
59 void remove(const Var &t_var) override;
60 void remove(const Ctr &t_ctr) override;
61 void remove(const QCtr &t_ctr) override;
62 void update() override;
63 void write(const std::string &t_name) override;
64 double get_var_primal(const Var &t_var) const override;
65 double get_var_reduced_cost(const Var &t_var) const override;
66 double get_var_ray(const Var &t_var) const override;
67 double get_ctr_dual(const Ctr &t_ctr) const override;
68 double get_ctr_farkas(const Ctr &t_ctr) const override;
69 unsigned int get_n_solutions() const override;
70 unsigned int get_solution_index() const override;
71 void set_solution_index(unsigned int t_index) override;
72 void update_obj_sense() override;
73 void update_obj() override;
74 void update_rhs() override;
75 void update_obj_constant() override;
76 void update_mat_coeff(const Ctr &t_ctr, const Var &t_var) override;
77 void update_ctr_type(const Ctr &t_ctr) override;
78 void update_ctr_rhs(const Ctr &t_ctr) override;
79 void update_var_type(const Var &t_var) override;
80 void update_var_lb(const Var &t_var) override;
81 void update_var_ub(const Var &t_var) override;
82 void update_var_obj(const Var &t_var) override;
83 void add_sub_problem();
84};
85
86#endif //IDOL_OPTIMIZERS_DANTZIGWOLFEDECOMPOSITION_H