Loading...
Searching...
No Matches
RENS.h
1//
2// Created by henri on 16.10.23.
3//
4
5#ifndef IDOL_RENS_H
6#define IDOL_RENS_H
7
8#include "idol/mixed-integer/optimizers/callbacks/CallbackFactory.h"
9#include "idol/mixed-integer/optimizers/callbacks/Callback.h"
10#include "idol/general/optimizers/OptimizerFactory.h"
11
12namespace idol::Heuristics {
13 class RENS;
14}
15
17
18 std::unique_ptr<OptimizerFactory> m_optimizer_factory;
19 double m_minimum_ratio_of_integer_variables_to_fix = .75;
20 double m_minimum_ratio_of_variables_to_fix = .25;
21
22 RENS(const RENS& t_src);
23public:
24 RENS() = default;
25
26 class Strategy : public Callback {
27 double m_minimum_ratio_of_integer_variables_to_fix;
28 double m_minimum_ratio_of_variables_to_fix;
29 std::unique_ptr<OptimizerFactory> m_optimizer_factory;
30 unsigned int m_n_relevant_calls = 0;
31 unsigned int m_frequency = 10;
32 protected:
33 void operator()(CallbackEvent t_event) override;
34
35 public:
36 Strategy(double t_minimum_ratio_of_integer_variables_to_fix,
37 double t_minimum_ratio_of_variables_to_fix,
38 OptimizerFactory* t_optimizer_factory);
39 };
40
41 Callback *operator()() override {
42
43 auto* result = new Strategy(m_minimum_ratio_of_integer_variables_to_fix,
44 m_minimum_ratio_of_variables_to_fix,
45 m_optimizer_factory->clone());
46
47 return result;
48 }
49
50 [[nodiscard]] CallbackFactory *clone() const override {
51 return new RENS(*this);
52 }
53
54 RENS& with_optimizer(const OptimizerFactory& t_optimizer_factory);
55
56};
57
58#endif //IDOL_RENS_H
void operator()(CallbackEvent t_event) override