Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef BcpsBranchStrategy_h_
00024 #define BcpsBranchStrategy_h_
00025
00026 #include "BcpsBranchObject.h"
00027
00028 class BcpsModel;
00029
00030
00031
00032
00033
00034
00039 class BcpsBranchStrategy {
00040
00041 private:
00043 BcpsBranchStrategy & operator=(const BcpsBranchStrategy& rhs);
00044
00045 protected:
00046
00048 int type_;
00049
00051 BcpsModel *model_;
00052
00058 int numBranchObjects_;
00060 BcpsBranchObject ** branchObjects_;
00062
00069 BcpsBranchObject * bestBranchObject_;
00071 double bestChangeUp_;
00073 int bestNumberUp_;
00075 double bestChangeDown_;
00077 int bestNumberDown_;
00079
00080 public:
00081
00083 BcpsBranchStrategy()
00084 :
00085 model_(NULL),
00086 numBranchObjects_(0),
00087 branchObjects_(NULL),
00088 bestChangeUp_(0.0),
00089 bestNumberUp_(0),
00090 bestChangeDown_(0.0),
00091 bestNumberDown_(0)
00092 {}
00093
00095 BcpsBranchStrategy(BcpsModel *m)
00096 :
00097 model_(m),
00098 numBranchObjects_(0),
00099 branchObjects_(NULL),
00100 bestChangeUp_(0.0),
00101 bestNumberUp_(0),
00102 bestChangeDown_(0.0),
00103 bestNumberDown_(0)
00104 {}
00105
00107 virtual ~BcpsBranchStrategy() {
00108 for (int k = 0; k < numBranchObjects_; ++k) {
00109 delete branchObjects_[k];
00110 }
00111 delete [] branchObjects_;
00112 }
00113
00115 virtual BcpsBranchStrategy * clone() const = 0;
00116
00118 int getType() { return type_; }
00119
00121 void setType(int t) { type_ = t; }
00122
00124 void setModel(BcpsModel *m) { model_ = m; }
00125
00128 int getNumBranchObjects() { return numBranchObjects_; }
00129 void getNumBranchObjects(int num) { numBranchObjects_ = num; }
00130 BcpsBranchObject ** getBranchObjects() { return branchObjects_; }
00131 void setBranchObjects(BcpsBranchObject **obj) { branchObjects_ = obj; }
00132 BcpsBranchObject *getBestBranchObject() { return bestBranchObject_; }
00133 void setBestBranchObject(BcpsBranchObject *ob) { bestBranchObject_ = ob; }
00135
00138 virtual void clearBest(BcpsModel * model) {
00139 bestBranchObject_ = NULL;
00140 bestChangeUp_ = 0.0;
00141 bestNumberUp_ = 0;
00142 bestChangeDown_ = 0.0;
00143 bestNumberDown_ = 0;
00144 }
00145
00147 virtual int createCandBranchObjects(int numPassesLeft, double ub){
00148 return 0;
00149 }
00150
00156 virtual int betterBranchObject(BcpsBranchObject * b,
00157 BcpsBranchObject * bestSoFar) = 0;
00158
00162 virtual BcpsBranchObject *bestBranchObject();
00163 };
00164
00165 #endif