idol
A C++ Framework for Optimization
Loading...
Searching...
No Matches
Neame.h
1//
2// Created by henri on 31.10.23.
3//
4
5#ifndef IDOL_NEAME_H
6#define IDOL_NEAME_H
7
8#include "DualPriceSmoothingStabilization.h"
9
10namespace idol::DantzigWolfe {
11 class Neame;
12}
13
15 double m_initial_factor;
16public:
17 explicit Neame(double t_initial_factor) : m_initial_factor(t_initial_factor) {}
18
20 double m_factor;
21 std::optional<DualPoint> m_smoothed_dual;
22 public:
23 explicit Strategy(double t_initial_factor) : m_factor(t_initial_factor) {}
24
25 void initialize() override {
26 m_smoothed_dual.reset();
27 }
28
29 void update_stability_center(const DualPoint &t_master_dual) override {
30 // intentionally left blank
31 }
32
33 DualPoint compute_smoothed_dual_solution(const DualPoint &t_master_dual) override {
34
35 if (!m_smoothed_dual.has_value() || m_factor <= 1e-4) {
36 m_smoothed_dual = t_master_dual;
37 } else {
38 m_smoothed_dual = m_factor * m_smoothed_dual.value() + (1. - m_factor) * t_master_dual;
39 }
40
41 return m_smoothed_dual.value();
42 }
43
44 };
45
46 DualPriceSmoothingStabilization::Strategy *operator()() const override {
47 return new Strategy(m_initial_factor);
48 }
49
50 DualPriceSmoothingStabilization *clone() const override {
51 return new Neame(*this);
52 }
53};
54
55#endif //IDOL_NEAME_H