Minotaur 0.4.1
Docs for developers
CutMan2.h
Go to the documentation of this file.
1//
2// Minotaur -- It's only 1/2 bull
3//
4// (C)opyright 2010 - 2025 The Minotaur Team.
5//
6
13#ifndef MINOTAURCUTMAN2_H
14#define MINOTAURCUTMAN2_H
15
16#include <list>
17#include <map>
18#include "CutManager.h"
19#include "Types.h"
20
21namespace Minotaur {
22
23 class Constraint;
24
25 class Node;
26 class Timer;
27 typedef Constraint *ConstraintPtr; //changed from boost-> simple
28 typedef std::list<CutPtr> cutList;
29
35 struct CutStat
36 {
37 int numAddedCuts;
38 int numDeletedCuts;
39 int numPoolToRel;
40 int numRelToPool;
41 int callNums;
42 int PoolSize;
43 int RelSize;
44 int numCuts;
45 };
46
47 class CutMan2 : public CutManager {
48
49 public:
51 CutMan2();
52
55
57 ~CutMan2();
58
59 // base class method
60 void addCut(CutPtr c);
61
62 // base class method
63 void addCuts(CutVectorIter cbeg, CutVectorIter cend);
64
65 size_t getNumCuts() const { return numCuts_; };
66
67 size_t getNumEnabledCuts() const { return rel_.size(); };
68
69 size_t getNumDisabledCuts() const { return pool_.size(); };
70
71 size_t getNumNewCuts() const { return 0; };
72
73 // base class method
74 ConstraintPtr addCut(ProblemPtr rel, FunctionPtr fn, double lb, double ub,
75 bool directToRel, bool neverDelete);
76
77 // base class method
78 void NodeIsBranched(NodePtr node, ConstSolutionPtr sol, int num);
79
80 // base class method
81 void NodeIsProcessed(NodePtr node);
82
83 // base class method
85
86 // base class method
87 void separate(ProblemPtr, ConstSolutionPtr, bool *, size_t *) {};
88
89 // base class method
91
92 // base class method
94
95 // base class method
96 void write(std::ostream &out) const;
97
98 // base class method
99 void writeStats(std::ostream &out) const;
100
101 void writeStat();
102
104 {
105 double t;
106 int RelSize;
107 int PoolSize;
108 int RelToPool;
109 int PoolToRel;
110 double RelAve;
111 double PoolAve;
112 int RelTr;
113 int PoolTr;
114 int PrntActCnt;
115 };
116
117 ctMngrInfo getInfo() { return ctmngrInfo_; }
118
119 private:
121 cutList pool_;
122
124 cutList rel_;
125
127 std::map<NodePtr, cutList> NodeCutsMap_;
128
130 std::map<NodePtr, int> ChildNum_;
131
133 EnvPtr env_;
134
136 double *hashVec_;
137
139 LoggerPtr logger_;
140
142 const static std::string me_;
143
145 ProblemPtr p_;
146
148 void addToRel_(ProblemPtr rel, CutPtr cut, bool newcut);
149
151 void addToRel_(CutPtr cut);
152
154 void addToPool_(CutPtr cut);
155
157 double absTol_;
158
163 size_t MaxInactiveInRel_;
164
166 size_t PoolSize_;
167
169 size_t CtThrsh_;
170
171 CutStat *stats_;
172
173 Timer *timer_;
174
176 double ctMngrtime_;
177
179 double updateTime_;
180
182 double checkTime_;
183
185 double processedTime_;
186
188 double branchedTime_;
189
190 ctMngrInfo ctmngrInfo_;
191
194 int PrntCntThrsh_;
195
196 size_t numCuts_;
197 };
198 typedef CutMan2 *CutMan2Ptr;
199} //namespace Minotaur
200#endif
Manages addition and deletion of cuts to problem.
Declare important 'types' used in Minotaur.
The Constraint class is used to manage a constraint.
Definition: Constraint.h:61
Definition: CutMan2.h:47
size_t getNumNewCuts() const
Get the total number of cuts added to manager (but not to problem) before the last call to separate()...
Definition: CutMan2.h:71
size_t getNumCuts() const
Get the total number of cuts available to the manager.
Definition: CutMan2.h:65
void updateRel(ConstSolutionPtr sol, ProblemPtr rel)
Update information about cuts in the relaxation.
Definition: CutMan2.cpp:121
~CutMan2()
Destroy.
Definition: CutMan2.cpp:103
void separate(ProblemPtr, ConstSolutionPtr, bool *, size_t *)
Separate a given point using the cuts in the storage.
Definition: CutMan2.h:87
size_t getNumEnabledCuts() const
Get the total number of cuts currently enabled, i.e., added to the relaxation.
Definition: CutMan2.h:67
void writeStats(std::ostream &out) const
Write statistics to output.
Definition: CutMan2.cpp:357
void addCut(CutPtr c)
Add a cut to be managed by the cut manager.
Definition: CutMan2.cpp:352
void addCuts(CutVectorIter cbeg, CutVectorIter cend)
Add a cut to be managed by the cut manager. The cut is not added to the problem by this function (See...
Definition: CutMan2.cpp:344
void updatePool(ProblemPtr rel, ConstSolutionPtr sol)
Update information of the cuts in the pool.
Definition: CutMan2.cpp:185
CutMan2()
Default constructor.
Definition: CutMan2.cpp:40
void postSolveUpdate(ConstSolutionPtr, EngineStatus)
Definition: CutMan2.h:84
void write(std::ostream &out) const
Write cuts to output.
Definition: CutMan2.cpp:338
size_t getNumDisabledCuts() const
Get the total number of cuts currently not enabled.
Definition: CutMan2.h:69
Abstract base class to manage cuts in the relaxation.
Definition: CutManager.h:42
Store function, bounds and other information about a cut.
Definition: Cut.h:52
Definition: Environment.h:28
Definition: Function.h:37
Definition: Logger.h:37
Definition: Node.h:54
Definition: Problem.h:74
Definition: Solution.h:30
Definition: Timer.h:40
Definition: ActiveNodeStore.h:20
EngineStatus
Different status that an external engine may report.
Definition: Types.h:176
Definition: CutMan2.h:104
Definition: CutMan2.h:36

Minotaur source code documented by Doxygen 1.9.4 on Thu Apr 24 2025