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 
40 
41  private:
44 
45  protected:
46 
48  int type_;
49 
52 
62 
71  double bestChangeUp_;
79 
80  public:
81 
84  :
85  model_(NULL),
87  branchObjects_(NULL),
88  bestChangeUp_(0.0),
89  bestNumberUp_(0),
90  bestChangeDown_(0.0),
92  {}
93 
96  :
97  model_(m),
99  branchObjects_(NULL),
100  bestChangeUp_(0.0),
101  bestNumberUp_(0),
102  bestChangeDown_(0.0),
103  bestNumberDown_(0)
104  {}
105 
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 
129  void getNumBranchObjects(int num) { numBranchObjects_ = num; }
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 
163 };
164 
165 #endif
int bestNumberDown_
Number of infeasibilities for down.
virtual BcpsBranchStrategy * clone() const =0
Clone a branch strategy.
virtual int createCandBranchObjects(int numPassesLeft, double ub)
Create a set of candidate branching objects.
virtual void clearBest(BcpsModel *model)
Clear branching strategy environment before starting a new round of selecting the best branch object...
void setBestBranchObject(BcpsBranchObject *ob)
Set/get branching objects.
int numBranchObjects_
Following members are used to store candidate branching objects.
double bestChangeUp_
Change up for best.
int getType()
Get type.
BcpsBranchStrategy()
Default Constructor.
double bestChangeDown_
Change down for best.
BcpsBranchObject contains the member data required when choosing branching entities and excuting actu...
void setType(int t)
Set type.
int type_
Type of branching strategy.
virtual int betterBranchObject(BcpsBranchObject *b, BcpsBranchObject *bestSoFar)=0
Compare branching object thisOne to bestSoFar.
BcpsModel * model_
Pointer to model.
void setModel(BcpsModel *m)
Set model.
BcpsBranchObject * getBestBranchObject()
Set/get branching objects.
BcpsBranchStrategy(BcpsModel *m)
Useful Constructor.
int bestNumberUp_
Number of infeasibilities for up.
int getNumBranchObjects()
Set/get branching objects.
virtual BcpsBranchObject * bestBranchObject()
Compare branching objects in branchObjects_.
Branching strategy specifies: (1) how to select a candidate set of branching objects (2) how to compa...
BcpsBranchStrategy & operator=(const BcpsBranchStrategy &rhs)
Disable assignment operator.
virtual ~BcpsBranchStrategy()
Destructor.
void getNumBranchObjects(int num)
Set/get branching objects.
BcpsBranchObject * bestBranchObject_
Following members are used to store information about best branching object found so far...
BcpsBranchObject ** branchObjects_
The set of candiate branching objects.
void setBranchObjects(BcpsBranchObject **obj)
Set/get branching objects.
BcpsBranchObject ** getBranchObjects()
Set/get branching objects.