Loading...
Searching...
No Matches
CutPool.h
1//
2// Created by Henri on 30/03/2026.
3//
4
5#ifndef IDOL_CUTPOOL_H
6#define IDOL_CUTPOOL_H
7#include <list>
8
9#include "idol/general/utils/Point.h"
10#include "idol/mixed-integer/modeling/constraints/Ctr.h"
11
12namespace idol {
13 class CutPool;
14}
15
17
18 struct CutHistory {
19 idol::Ctr cut;
20 double norm_squared = 0.;
21 unsigned int age = 0;
22 unsigned int n_active = 0;
23 double score = 1.;
24 CutHistory(Ctr t_cut, double t_norm_squared);
25 };
26
27 const unsigned int m_min_age = 10;
28 const double m_min_activity_threshold = .2;
29 const unsigned int m_max_pool_size = 20000;
30 const double m_max_cosine = .95;
31 std::list<CutHistory> m_cuts_in_relaxation;
32 std::list<Ctr> m_all_cuts;
33
34 bool add_existing_cut_to_relaxation(const Ctr& t_cut, Model& t_relaxation, bool t_force = false);
35public:
36 bool add_cut(const TempCtr& t_cut, Model& t_relaxation);
37 unsigned int recycle(const PrimalPoint& t_current_point, Model& t_relaxation, double t_tol_feasibility);
38 void clean_up(Model& t_relaxation);
39
40 static double cosine(const Env& t_env, const Ctr& t_cut1, const Ctr& t_cut2);
41 static double dot(const Env& t_env, const Ctr& t_cut1, const Ctr& t_cut2);
42 static double norm_squared(const Env& t_env, const Ctr& t_cut);
43};
44
45#endif //IDOL_CUTPOOL_H