Minotaur 0.4.1
Docs for developers
ParPCBProcessor.h
Go to the documentation of this file.
1//
2// Minotaur -- It's only 1/2 bull
3//
4// (C)opyright 2009 - 2025 The Minotaur Team.
5//
6
14#ifndef MINOTAURPARPCBPROCESSOR_H
15#define MINOTAURPARPCBPROCESSOR_H
16
17#include "NodeProcessor.h"
18#include "ParCutMan.h"
19#include "ParReliabilityBrancher.h"
20#include "ParTreeManager.h"
21#include "Types.h"
22
23namespace Minotaur {
24
25 //class Engine;
26 //class Problem;
27 class Solution;
28 typedef const Solution* ConstSolutionPtr;
29
30 struct ParNodeStats {
31 UInt bra;
37 };
38
48
49 friend class ParBranchAndBound;
50 friend class ParQGBranchAndBound;
51
52 public:
55
57 ParPCBProcessor(EnvPtr env, EnginePtr engine, HandlerVector handlers_);
58
61
62 // Translate and add constraint to relaxation
63 //void addConsToRel(std::vector<ConstraintPtr> cons, UInt cIndex);
64
65 // Add a heuristic.
66 void addHeur(HeurPtr h);
67
68 // True if a new solution was found while processing this node.
69 bool foundNewSolution();
70
71 // Find branches that will be used to branch at this node.
72 Branches getBranches();
73
74 // Return the cut manager used with this processor.
75 CutManager* getCutManager() {return cutMan_;};
76
77 // Get the recent solution from the engine.
78 ConstSolutionPtr getSolution();
79
80 // Get warm-start information.
82
83 // Implement NodeProcessor::process().
84 void process(NodePtr node, RelaxationPtr rel,
85 SolutionPoolPtr s_pool);
86
91 void process(NodePtr node, RelaxationPtr rel,
92 SolutionPoolPtr s_pool, bool init, UIntVector timesUp,
93 UIntVector timesDown, DoubleVector pseudoUp,
94 DoubleVector pseudoDown, UInt nodesProc);
95
96 // set cut manager
97 void setCutManager(CutManager* cutman);
98
99 // write statistics. Base class method.
100 void writeStats(std::ostream &out) const;
101
102 // write statistics. Base class method.
103 void writeStats() const;
104
105 protected:
106
108 Branches branches_;
109
115
118
120 double cutOff_;
121
124
127
129 HandlerVector handlers_;
130
132 HeurVector heurs_;
133
136
138 static const std::string me_;
139
143
146
149
152
155
157 double oATol_;
158
160 double oRTol_;
161
168 virtual bool isFeasible_(NodePtr node, ConstSolutionPtr sol,
169 SolutionPoolPtr s_pool, bool &should_prune);
170
172 virtual bool presolveNode_(NodePtr node, SolutionPoolPtr s_pool);
173
174
176 virtual void solveRelaxation_();
177
182 virtual bool shouldPrune_(NodePtr node, double solval,
183 SolutionPoolPtr s_pool);
184
185
187
194 void separate_(ConstSolutionPtr sol, NodePtr node, SolutionPoolPtr s_pool,
195 SeparationStatus *status);
196
197 // Implement NodeProcessor::tightenBounds_()
198 virtual void tightenBounds_();
199
200 };
201
203
204}
205#endif
206
Define the NodeProcessor class for processing nodes in the branch-and-bound algorithm.
Manages storage, addition and deletion of cuts to problem.
Declare important 'types' used in Minotaur.
Abstract base class to manage cuts in the relaxation.
Definition: CutManager.h:42
Definition: Engine.h:34
Definition: Environment.h:28
Definition: Heuristic.h:30
Definition: Logger.h:37
Definition: NodeProcessor.h:49
Definition: Node.h:54
Implement a generic parallel branch-and-bound algorithm on a multicore cpu.
Definition: ParBranchAndBound.h:48
Default node processor used in solver for now.
Definition: ParPCBProcessor.h:47
bool contOnErr_
Definition: ParPCBProcessor.h:114
double cutOff_
If lb is greater than cutOff_, we can prune this node.
Definition: ParPCBProcessor.h:120
double oATol_
Absolute tolerance for pruning a node on basis of bounds.
Definition: ParPCBProcessor.h:157
void process(NodePtr node, RelaxationPtr rel, SolutionPoolPtr s_pool)
Definition: ParPCBProcessor.cpp:225
void writeStats() const
Write statistics to our own logger.
Definition: ParPCBProcessor.cpp:589
UInt numSolutions_
How many new solutions were found by the processor.
Definition: ParPCBProcessor.h:145
EnginePtr engine_
Engine used to process the relaxation.
Definition: ParPCBProcessor.h:123
WarmStartPtr getWarmStart()
Definition: ParPCBProcessor.cpp:140
virtual bool isFeasible_(NodePtr node, ConstSolutionPtr sol, SolutionPoolPtr s_pool, bool &should_prune)
Definition: ParPCBProcessor.cpp:146
HandlerVector handlers_
All the handlers that are used for this processor.
Definition: ParPCBProcessor.h:129
double oRTol_
Relative tolerance for pruning a node on basis of bounds.
Definition: ParPCBProcessor.h:160
~ParPCBProcessor()
Destroy.
Definition: ParPCBProcessor.cpp:93
Branches getBranches()
Find branches that will be used to branch at this node.
Definition: ParPCBProcessor.cpp:126
CutManager * cutMan_
The cut manager.
Definition: ParPCBProcessor.h:117
virtual bool shouldPrune_(NodePtr node, double solval, SolutionPoolPtr s_pool)
Definition: ParPCBProcessor.cpp:425
void separate_(ConstSolutionPtr sol, NodePtr node, SolutionPoolPtr s_pool, SeparationStatus *status)
Separate the given point from the node relaxation.
Definition: ParPCBProcessor.cpp:381
bool foundNewSolution()
Definition: ParPCBProcessor.cpp:120
RelaxationPtr relaxation_
Relaxation that is processed by this processor.
Definition: ParPCBProcessor.h:148
EngineStatus engineStatus_
Status of the engine.
Definition: ParPCBProcessor.h:126
ParNodeStats stats_
Statistics.
Definition: ParPCBProcessor.h:151
virtual void solveRelaxation_()
Solve the relaxation.
Definition: ParPCBProcessor.cpp:558
WarmStartPtr ws_
Warm-start information for start processing the children.
Definition: ParPCBProcessor.h:154
HeurVector heurs_
Heuristics that can be called at each node.
Definition: ParPCBProcessor.h:132
Branches branches_
Branches found by this processor for this node.
Definition: ParPCBProcessor.h:108
virtual bool presolveNode_(NodePtr node, SolutionPoolPtr s_pool)
Presolve a node.
Definition: ParPCBProcessor.cpp:176
static const std::string me_
For logging.
Definition: ParPCBProcessor.h:138
ParPCBProcessor()
Default constructor.
LoggerPtr logger_
Log.
Definition: ParPCBProcessor.h:135
int presFreq_
Definition: ParPCBProcessor.h:142
Implement a generic parallel branch-and-bound algorithm on a multicore cpu.
Definition: ParQGBranchAndBound.h:48
Definition: Relaxation.h:53
Definition: SolutionPool.h:28
Definition: Solution.h:30
Definition: WarmStart.h:45
Definition: ActiveNodeStore.h:20
unsigned int UInt
Unsigned integer.
Definition: Types.h:30
SeparationStatus
Status from separation routine:
Definition: Types.h:217
EngineStatus
Different status that an external engine may report.
Definition: Types.h:176
Definition: ParPCBProcessor.h:30
UInt ub
Number of nodes processed.
Definition: ParPCBProcessor.h:36
UInt proc
Number of times problem ocurred in solving.
Definition: ParPCBProcessor.h:35
UInt inf
Number of times relaxation became infeasible.
Definition: ParPCBProcessor.h:32
UInt prob
Number of times relaxation gave optimal feasible solution.
Definition: ParPCBProcessor.h:34
UInt opt
Number of times relaxation became infeasible.
Definition: ParPCBProcessor.h:33

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