Minotaur 0.4.1
Docs for developers
WeakBrancher.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
13#ifndef MINOTAURWEAKBRANCHER_H
14#define MINOTAURWEAKBRANCHER_H
15
16#include "Brancher.h"
17
18namespace Minotaur
19{
20
21class Engine;
22class Timer;
23typedef Engine* EnginePtr;
24
26 UInt calls;
28 double time;
29};
30// A class to select a variable for branching using weak branching.
31class WeakBrancher : public Brancher
32{
33public:
41 WeakBrancher(EnvPtr env, HandlerVector& handlers);
42
45
46 // base class function.
47 Branches findBranches(RelaxationPtr rel, NodePtr node, ConstSolutionPtr sol,
48 SolutionPoolPtr s_pool, BrancherStatus& br_status,
49 ModVector& mods);
50
51 // base class function.
52 std::string getName() const;
53
59 void setProblem(ProblemPtr p);
60
61 // base class function.
63
65 void writeStats(std::ostream& out) const;
66
67private:
69 BrVarCandSet cands_;
70
72 const double eTol_;
73
75 BrCandVector gencands_;
76
81 HandlerVector handlers_;
82
84 LoggerPtr logger_;
85
87 const static std::string me_;
88
90 ModVector mods_;
91
93 ProblemPtr p_;
94
96 RelaxationPtr rel_;
97
99 const double* rCost_;
100
102 WeakBrStats* stats_;
103
105 BrancherStatus status_;
106
108 DoubleVector x_;
109
111 const Timer* timer_;
112
113 double computeObjChange_(DoubleVector oldLb, DoubleVector oldUb);
114
124 BrCandPtr findBestCandidate_(SolutionPoolPtr s_pool);
125
131 void findCandidates_(bool& should_prune);
132
137 void freeCandidates_(BrCandPtr no_del);
138
145 double getScore_(const double& up_score, const double& down_score);
146
153 void weakBranch_(BrCandPtr cand, double& obj_up, double& obj_down,
154 SolutionPoolPtr s_pool);
155
164 void writeScore_(BrCandPtr cand, double score, double change_up,
165 double change_down);
166};
168} // namespace Minotaur
169#endif
170
Declare the base class Brancher for finding and creating branches in Branch-and-Bound.
Base class for describing candidates for branching on a node in branch-and-bound.
Definition: BrCand.h:32
A brancher is used to find suitable branches for a given node. e.g. LexicoBrancher....
Definition: Brancher.h:33
Definition: Environment.h:28
Definition: Logger.h:37
Definition: Node.h:54
Definition: Problem.h:74
Definition: Relaxation.h:53
Definition: SolutionPool.h:28
Definition: Solution.h:30
Definition: Timer.h:40
Definition: WeakBrancher.h:32
void updateAfterSolve(NodePtr node, ConstSolutionPtr sol)
Update pseudo-costs after LP is solved.
Definition: WeakBrancher.cpp:367
WeakBrancher(EnvPtr env, HandlerVector &handlers)
Construct using an environment pointer and handlers.
Definition: WeakBrancher.cpp:38
~WeakBrancher()
Destructor.
Definition: WeakBrancher.cpp:54
void writeStats(std::ostream &out) const
Write statistics.
Definition: WeakBrancher.cpp:378
std::string getName() const
Return the name of this brancher.
Definition: WeakBrancher.cpp:268
Branches findBranches(RelaxationPtr rel, NodePtr node, ConstSolutionPtr sol, SolutionPoolPtr s_pool, BrancherStatus &br_status, ModVector &mods)
Find a branching candidate.
Definition: WeakBrancher.cpp:115
void setProblem(ProblemPtr p)
Set problem.
Definition: WeakBrancher.cpp:282
Definition: ActiveNodeStore.h:20
BrancherStatus
What can a brancher do to a node in branch-and-bound.
Definition: Types.h:193
unsigned int UInt
Unsigned integer.
Definition: Types.h:30
Definition: WeakBrancher.h:25
double time
Number of times node was pruned by strong branching.
Definition: WeakBrancher.h:28
UInt nodePruned
Number of calls to find branching candidate.
Definition: WeakBrancher.h:27

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