- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

BcpsBranchStrategy.h
Go to the documentation of this file.
1 /*===========================================================================*
2 * This file is part of the Branch, Constrain and Price Software (BiCePS) *
3 * *
4 * BiCePS is distributed under the Eclipse Public License as part of the *
5 * COIN-OR repository (http://www.coin-or.org). *
6 * *
7 * Authors: *
8 * *
9 * Yan Xu, Lehigh University *
10 * Ted Ralphs, Lehigh University *
11 * *
12 * Conceptual Design: *
13 * *
14 * Yan Xu, Lehigh University *
15 * Ted Ralphs, Lehigh University *
16 * Laszlo Ladanyi, IBM T.J. Watson Research Center *
17 * Matthew Saltzman, Clemson University *
18 * *
19 * Copyright (C) 2001-2013, Lehigh University, Yan Xu, and Ted Ralphs. *
20 * All Rights Reserved. *
21 *===========================================================================*/
22
23 #ifndef BcpsBranchStrategy_h_
24 #define BcpsBranchStrategy_h_
25
26 #include "BcpsBranchObject.h"
27
28 class BcpsModel;
29
30 //#############################################################################
31 // NOTE: Borrow ideas from COIN/Cbc.
32 //#############################################################################
33
34
39 class BcpsBranchStrategy {
40
41 private:
43 BcpsBranchStrategy & operator=(const BcpsBranchStrategy& rhs);
44
45 protected:
46
48 int type_;
49
51 BcpsModel *model_;
52
58 int numBranchObjects_;
60 BcpsBranchObject ** branchObjects_;
62
69 BcpsBranchObject * bestBranchObject_;
71 double bestChangeUp_;
73 int bestNumberUp_;
75 double bestChangeDown_;
77 int bestNumberDown_;
79
80 public:
81
83 BcpsBranchStrategy()
84 :
85 model_(NULL),
86 numBranchObjects_(0),
87 branchObjects_(NULL),
88 bestChangeUp_(0.0),
89 bestNumberUp_(0),
90 bestChangeDown_(0.0),
91 bestNumberDown_(0)
92 {}
93
95 BcpsBranchStrategy(BcpsModel *m)
96 :
97 model_(m),
98 numBranchObjects_(0),
99 branchObjects_(NULL),
100 bestChangeUp_(0.0),
101 bestNumberUp_(0),
102 bestChangeDown_(0.0),
103 bestNumberDown_(0)
104 {}
105
107 virtual ~BcpsBranchStrategy() {
108 for (int k = 0; k < numBranchObjects_; ++k) {
109 delete branchObjects_[k];
110 }
111 delete [] branchObjects_;
112 }
113
115 virtual BcpsBranchStrategy * clone() const = 0;
116
118 int getType() { return type_; }
119
121 void setType(int t) { type_ = t; }
122
124 void setModel(BcpsModel *m) { model_ = m; }
125
128 int getNumBranchObjects() { return numBranchObjects_; }
129 void getNumBranchObjects(int num) { numBranchObjects_ = num; }
130 BcpsBranchObject ** getBranchObjects() { return branchObjects_; }
131 void setBranchObjects(BcpsBranchObject **obj) { branchObjects_ = obj; }
132 BcpsBranchObject *getBestBranchObject() { return bestBranchObject_; }
133 void setBestBranchObject(BcpsBranchObject *ob) { bestBranchObject_ = ob; }
135
138 virtual void clearBest(BcpsModel * model) {
139 bestBranchObject_ = NULL;
140 bestChangeUp_ = 0.0;
141 bestNumberUp_ = 0;
142 bestChangeDown_ = 0.0;
143 bestNumberDown_ = 0;
144 }
145
147 virtual int createCandBranchObjects(int numPassesLeft, double ub){
148 return 0;
149 }
150
156 virtual int betterBranchObject(BcpsBranchObject * b,
157 BcpsBranchObject * bestSoFar) = 0;
158
162 virtual BcpsBranchObject *bestBranchObject();
163 };
164
165 #endif
BcpsBranchStrategy::bestNumberDown_
int bestNumberDown_
Number of infeasibilities for down.
Definition: BcpsBranchStrategy.h:77
BcpsBranchStrategy::clone
virtual BcpsBranchStrategy * clone() const =0
Clone a branch strategy.
BcpsBranchStrategy::createCandBranchObjects
virtual int createCandBranchObjects(int numPassesLeft, double ub)
Create a set of candidate branching objects.
Definition: BcpsBranchStrategy.h:147
BcpsBranchStrategy::clearBest
virtual void clearBest(BcpsModel *model)
Clear branching strategy environment before starting a new round of selecting the best branch object...
Definition: BcpsBranchStrategy.h:138
BcpsBranchStrategy::setBestBranchObject
void setBestBranchObject(BcpsBranchObject *ob)
Set/get branching objects.
Definition: BcpsBranchStrategy.h:133
BcpsBranchStrategy::numBranchObjects_
int numBranchObjects_
Following members are used to store candidate branching objects.
Definition: BcpsBranchStrategy.h:58
BcpsBranchStrategy::bestChangeUp_
double bestChangeUp_
Change up for best.
Definition: BcpsBranchStrategy.h:71
BcpsBranchStrategy::getType
int getType()
Get type.
Definition: BcpsBranchStrategy.h:118
BcpsBranchStrategy::BcpsBranchStrategy
BcpsBranchStrategy()
Default Constructor.
Definition: BcpsBranchStrategy.h:83
BcpsBranchStrategy::bestChangeDown_
double bestChangeDown_
Change down for best.
Definition: BcpsBranchStrategy.h:75
BcpsBranchObject
BcpsBranchObject contains the member data required when choosing branching entities and excuting actu...
Definition: BcpsBranchObject.h:47
BcpsBranchStrategy::setType
void setType(int t)
Set type.
Definition: BcpsBranchStrategy.h:121
BcpsBranchStrategy::type_
int type_
Type of branching strategy.
Definition: BcpsBranchStrategy.h:48
BcpsBranchStrategy::betterBranchObject
virtual int betterBranchObject(BcpsBranchObject *b, BcpsBranchObject *bestSoFar)=0
Compare branching object thisOne to bestSoFar.
BcpsBranchStrategy::model_
BcpsModel * model_
Pointer to model.
Definition: BcpsBranchStrategy.h:51
BcpsBranchStrategy::setModel
void setModel(BcpsModel *m)
Set model.
Definition: BcpsBranchStrategy.h:124
BcpsBranchStrategy::getBestBranchObject
BcpsBranchObject * getBestBranchObject()
Set/get branching objects.
Definition: BcpsBranchStrategy.h:132
BcpsBranchStrategy::BcpsBranchStrategy
BcpsBranchStrategy(BcpsModel *m)
Useful Constructor.
Definition: BcpsBranchStrategy.h:95
BcpsBranchStrategy::bestNumberUp_
int bestNumberUp_
Number of infeasibilities for up.
Definition: BcpsBranchStrategy.h:73
BcpsBranchStrategy::getNumBranchObjects
int getNumBranchObjects()
Set/get branching objects.
Definition: BcpsBranchStrategy.h:128
BcpsModel
Definition: BcpsModel.h:40
BcpsBranchStrategy::bestBranchObject
virtual BcpsBranchObject * bestBranchObject()
Compare branching objects in branchObjects_.
BcpsBranchStrategy
Branching strategy specifies: (1) how to select a candidate set of branching objects (2) how to compa...
Definition: BcpsBranchStrategy.h:39
BcpsBranchStrategy::operator=
BcpsBranchStrategy & operator=(const BcpsBranchStrategy &rhs)
Disable assignment operator.
BcpsBranchStrategy::~BcpsBranchStrategy
virtual ~BcpsBranchStrategy()
Destructor.
Definition: BcpsBranchStrategy.h:107
BcpsBranchStrategy::getNumBranchObjects
void getNumBranchObjects(int num)
Set/get branching objects.
Definition: BcpsBranchStrategy.h:129
BcpsBranchStrategy::bestBranchObject_
BcpsBranchObject * bestBranchObject_
Following members are used to store information about best branching object found so far...
Definition: BcpsBranchStrategy.h:69
BcpsBranchObject.h
BcpsBranchStrategy::branchObjects_
BcpsBranchObject ** branchObjects_
The set of candiate branching objects.
Definition: BcpsBranchStrategy.h:60
BcpsBranchStrategy::setBranchObjects
void setBranchObjects(BcpsBranchObject **obj)
Set/get branching objects.
Definition: BcpsBranchStrategy.h:131
BcpsBranchStrategy::getBranchObjects
BcpsBranchObject ** getBranchObjects()
Set/get branching objects.
Definition: BcpsBranchStrategy.h:130