idol
A C++ Framework for Optimization
Loading...
Searching...
No Matches
DantzigWolfeInfeasibilityStrategy.h
1//
2// Created by henri on 31.10.23.
3//
4
5#ifndef IDOL_DANTZIGWOLFEINFEASIBILITYSTRATEGY_H
6#define IDOL_DANTZIGWOLFEINFEASIBILITYSTRATEGY_H
7
8#include "idol/general/utils/types.h"
9#include "idol/general/utils/Point.h"
10
11namespace idol::Optimizers {
12 class DantzigWolfeDecomposition;
13}
14
15namespace idol::DantzigWolfe {
16 class InfeasibilityStrategyFactory;
17}
18
20public:
21 virtual ~InfeasibilityStrategyFactory() = default;
22
23 class Strategy {
24 SolutionStatus m_status = Loaded;
25 SolutionReason m_reason = NotSpecified;
26 std::optional<double> m_best_obj;
27 std::optional<double> m_best_bound;
28 std::optional<PrimalPoint> m_primal_solution;
29 public:
30 virtual ~Strategy() = default;
31
32 virtual void execute(Optimizers::DantzigWolfeDecomposition& t_parent) = 0;
33
34 SolutionStatus status() const { return m_status; }
35
36 SolutionReason reason() const { return m_reason; }
37
38 double best_obj() const { return m_best_obj.value(); }
39
40 double best_bound() const { return m_best_bound.value(); }
41
42 const PrimalPoint& primal_solution() const;
43 protected:
44 void set_status(SolutionStatus t_status) { m_status = t_status; }
45
46 void set_reason(SolutionReason t_reason) { m_reason = t_reason; }
47
48 void set_primal_solution(PrimalPoint t_solution) { m_primal_solution = std::move(t_solution); }
49
50 void set_best_obj(double t_best_obj) { m_best_obj = t_best_obj; }
51
52 void set_best_bound(double t_best_bound) { m_best_bound = t_best_bound; }
53 };
54
55 virtual Strategy* operator()() const = 0;
56
57 [[nodiscard]] virtual InfeasibilityStrategyFactory* clone() const = 0;
58};
59
60#endif //IDOL_DANTZIGWOLFEINFEASIBILITYSTRATEGY_H