Minotaur 0.4.1
Docs for developers
BrCand.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 MINOTAURBRCAND_H
14#define MINOTAURBRCAND_H
15
16#include <string>
17#include "Types.h"
18
19namespace Minotaur {
20
21class Handler;
22class Variable;
23
32class BrCand {
33public:
35 BrCand();
36
38 virtual ~BrCand() {};
39
43 virtual void decrBranches() { --branches_; };
44
50 virtual double getDDist() = 0;
51
53 virtual BranchDirection getDir() const {return prefDir_;};
54
56 virtual HandlerPtr getHandler() { return h_; };
57
59 virtual std::string getName() const {return "default br-cand";};
60
65 virtual int getPCostIndex() const { return pCostIndex_; };
66
68 virtual double getScore() { return score_; };
69
75 virtual double getUDist() = 0;
76
80 virtual int numBranches() { return branches_; };
81
86 virtual void setDir(BranchDirection d) {prefDir_ = d;};
87
92 void setDist(double ddist, double udist);
93
95 virtual void setHandler(HandlerPtr h) { h_ = h; };
96
100 virtual void setNumBranches(int n) { branches_ = n; };
101
108 virtual void setScore(const double score) { score_ = score; };
109
110protected:
113
116
119
122
124 double score_;
125};
126
131bool CompareScore(BrCandPtr c1, BrCandPtr c2);
132}
133
134#endif
135
Declare important 'types' used in Minotaur.
Base class for describing candidates for branching on a node in branch-and-bound.
Definition: BrCand.h:32
virtual double getUDist()=0
virtual void setHandler(HandlerPtr h)
Set the handler that created this candidate.
Definition: BrCand.h:95
virtual void setDir(BranchDirection d)
Set the preferred direction that will be processed first in the branch-and-bound tree.
Definition: BrCand.h:86
virtual HandlerPtr getHandler()
Return the handler that created this candidate.
Definition: BrCand.h:56
virtual void decrBranches()
Decrement the number of branches currently associated with this candidate.
Definition: BrCand.h:43
HandlerPtr h_
Handler that created this candidate.
Definition: BrCand.h:112
virtual int numBranches()
Return the number of branches currently associated with this candidate.
Definition: BrCand.h:80
BranchDirection prefDir_
Which is preferred for processing next? UpBranch or DownBranch?
Definition: BrCand.h:121
int pCostIndex_
Index of the this candidate in the pseudo-cost array.
Definition: BrCand.h:118
virtual BranchDirection getDir() const
Get the preferred direction.
Definition: BrCand.h:53
virtual ~BrCand()
Destroy.
Definition: BrCand.h:38
virtual double getScore()
Return the score for this candidate.
Definition: BrCand.h:68
void setDist(double ddist, double udist)
Set the distance of the current solution from the down branch and the up branch.
Definition: BrCand.cpp:44
double score_
Score of this candidate.
Definition: BrCand.h:124
virtual void setScore(const double score)
Set score for this candidate.
Definition: BrCand.h:108
virtual std::string getName() const
Display for debugging.
Definition: BrCand.h:59
virtual double getDDist()=0
int branches_
Number of branches still in the tree which were created by this candidate.
Definition: BrCand.h:115
virtual int getPCostIndex() const
Return the index in the pseudo cost array. If it is not in the array, return a value less than 0.
Definition: BrCand.h:65
virtual void setNumBranches(int n)
Set the number of branches associated with this candidate.
Definition: BrCand.h:100
BrCand()
Constructor.
Definition: BrCand.cpp:39
Base class for handling specific types of constraints or objective.
Definition: Handler.h:49
Definition: ActiveNodeStore.h:20
BranchDirection
Two directions for branching.
Definition: Types.h:201
bool CompareScore(BrCandPtr c1, BrCandPtr c2)
Comparison function to sort candidates in the decreasing order of their score.
Definition: BrCand.cpp:22

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