Bcps 0.95.1
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-2023, Lehigh University, Yan Xu, and Ted Ralphs. *
20 * All Rights Reserved. *
21 *===========================================================================*/
22
23#ifndef BcpsBranchStrategy_h_
24#define BcpsBranchStrategy_h_
25
26#include "BcpsConfig.h"
27#include "BcpsBranchObject.h"
28
29class BcpsModel;
30
31//#############################################################################
32// NOTE: Borrow ideas from COIN/Cbc.
33//#############################################################################
34
35
41
42 private:
44 BcpsBranchStrategy & operator=(const BcpsBranchStrategy& rhs);
45
46 protected:
47
49 int type_;
50
53
63
80
81 public:
82
85 :
86 model_(NULL),
87 numBranchObjects_(0),
88 branchObjects_(NULL),
89 bestChangeUp_(0.0),
90 bestNumberUp_(0),
91 bestChangeDown_(0.0),
92 bestNumberDown_(0)
93 {}
94
97 :
98 model_(m),
99 numBranchObjects_(0),
100 branchObjects_(NULL),
101 bestChangeUp_(0.0),
102 bestNumberUp_(0),
103 bestChangeDown_(0.0),
104 bestNumberDown_(0)
105 {}
106
109 for (int k = 0; k < numBranchObjects_; ++k) {
110 delete branchObjects_[k];
111 }
112 delete [] branchObjects_;
113 }
114
116 virtual BcpsBranchStrategy * clone() const = 0;
117
119 int getType() const { return type_; }
120
122 void setType(int t) { type_ = t; }
123
125 void setModel(BcpsModel *m) { model_ = m; }
126
129 int getNumBranchObjects() const { return numBranchObjects_; }
130 void setNumBranchObjects(int num) { numBranchObjects_ = num; }
131 BcpsBranchObject ** getBranchObjects() { return branchObjects_; }
132 void setBranchObjects(BcpsBranchObject **obj) { branchObjects_ = obj; }
133 BcpsBranchObject *getBestBranchObject() { return bestBranchObject_; }
134 void setBestBranchObject(BcpsBranchObject *ob) { bestBranchObject_ = ob; }
136
139 virtual void clearBest(BcpsModel * model) {
140 bestBranchObject_ = NULL;
141 bestChangeUp_ = 0.0;
142 bestNumberUp_ = 0;
143 bestChangeDown_ = 0.0;
144 bestNumberDown_ = 0;
145 }
146
148 virtual int createCandBranchObjects(int numPassesLeft, double ub){
149 return 0;
150 }
151
158 BcpsBranchObject * bestSoFar) = 0;
159
164};
165
166#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.
#define BCPSLIB_EXPORT
Definition config.h:5