Bcps 0.94.5
Loading...
Searching...
No Matches
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-2017, 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
28class BcpsModel;
29
30//#############################################################################
31// NOTE: Borrow ideas from COIN/Cbc.
32//#############################################################################
33
34
40
41 private:
43 BcpsBranchStrategy & operator=(const BcpsBranchStrategy& rhs);
44
45 protected:
46
48 int type_;
49
52
62
79
80 public:
81
84 :
85 model_(NULL),
87 branchObjects_(NULL),
88 bestChangeUp_(0.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),
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() const { return type_; }
119
121 void setType(int t) { type_ = t; }
122
124 void setModel(BcpsModel *m) { model_ = m; }
125
129 void setNumBranchObjects(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
157 BcpsBranchObject * bestSoFar) = 0;
158
163};
164
165#endif
BcpsBranchObject contains the member data required when choosing branching entities and excuting actu...
Branching strategy specifies: (1) how to select a candidate set of branching objects (2) how to compa...
void setBestBranchObject(BcpsBranchObject *ob)
BcpsBranchObject * getBestBranchObject()
void setModel(BcpsModel *m)
Set model.
double bestChangeDown_
Change down for best.
virtual void clearBest(BcpsModel *model)
Clear branching strategy environment before starting a new round of selecting the best branch object.
int getNumBranchObjects() const
Set/get branching objects.
BcpsBranchStrategy()
Default Constructor.
virtual int createCandBranchObjects(int numPassesLeft, double ub)
Create a set of candidate branching objects.
virtual BcpsBranchStrategy * clone() const =0
Clone a branch strategy.
int numBranchObjects_
Following members are used to store candidate 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 setType(int t)
Set type.
int type_
Type of branching strategy.
BcpsModel * model_
Pointer to model.
virtual ~BcpsBranchStrategy()
Destructor.
virtual BcpsBranchObject * bestBranchObject()
Compare branching objects in branchObjects_.
BcpsBranchStrategy(BcpsModel *m)
Useful Constructor.
int getType() const
Get type.
void setNumBranchObjects(int num)
void setBranchObjects(BcpsBranchObject **obj)
int bestNumberUp_
Number of infeasibilities for up.
virtual int betterBranchObject(BcpsBranchObject *b, BcpsBranchObject *bestSoFar)=0
Compare branching object thisOne to bestSoFar.
int bestNumberDown_
Number of infeasibilities for down.
BcpsBranchObject ** getBranchObjects()
double bestChangeUp_
Change up for best.