00001
00002
00003 #ifndef SbbBranchBase_H
00004 #define SbbBranchBase_H
00005
00006 #include <string>
00007 #include <vector>
00008
00009 class OsiSolverInterface;
00010
00011 class SbbModel;
00012 class SbbNode;
00013 class SbbNodeInfo;
00014 class SbbBranchingObject;
00015
00016
00017
00043 class SbbObject {
00044
00045 public:
00046
00047
00048 SbbObject ();
00049
00050
00051 SbbObject (SbbModel * model);
00052
00053
00054 SbbObject ( const SbbObject &);
00055
00056
00057 SbbObject & operator=( const SbbObject& rhs);
00058
00060 virtual SbbObject * clone() const=0;
00061
00063 virtual ~SbbObject ();
00064
00077 virtual double infeasibility(int &preferredWay, double &otherWay) const = 0;
00078
00082 virtual void feasibleRegion() = 0;
00083
00089 virtual SbbBranchingObject * createBranch(int way) const = 0;
00090
00099 virtual SbbBranchingObject * preferredNewFeasible() const
00100 { return NULL;};
00101
00110 virtual SbbBranchingObject * notPreferredNewFeasible() const
00111 { return NULL;};
00112
00118 virtual void resetBounds() {};
00119
00121 inline int id() const
00122 { return id_;};
00123
00125 inline void setModel(SbbModel * model)
00126 { model_ = model;};
00127
00129 inline SbbModel * model() const
00130 {return model_;};
00131
00132 protected:
00134
00135
00136 SbbModel * model_;
00137
00138 int id_;
00139
00140 };
00141
00159 class SbbBranchingObject {
00160
00161 public:
00162
00164 SbbBranchingObject ();
00165
00167 SbbBranchingObject (SbbModel * model, int variable, int way , double value);
00168
00170 SbbBranchingObject ( const SbbBranchingObject &);
00171
00173 SbbBranchingObject & operator=( const SbbBranchingObject& rhs);
00174
00176 virtual SbbBranchingObject * clone() const=0;
00177
00179 virtual ~SbbBranchingObject ();
00180
00186 virtual int numberBranches() const
00187 {return 2;};
00188
00190 virtual int numberBranchesLeft() const
00191 {return numberBranchesLeft_;};
00192
00197 virtual void branch()=0;
00198
00210 inline int variable() const
00211 {return variable_;};
00212
00220 inline int way() const
00221 {return way_;};
00222
00227 inline void way(int way)
00228 {way_=way;};
00229
00231 inline double value() const
00232 {return value_;};
00233
00235 inline SbbModel * model() const
00236 {return model_;};
00237
00238 protected:
00239
00241 SbbModel * model_;
00242
00244 int variable_;
00245
00253 int way_;
00254
00256 double value_;
00257
00263 int numberBranchesLeft_;
00264
00265 };
00266
00267
00281 class SbbBranchDecision {
00282 public:
00284 SbbBranchDecision ();
00285
00287 virtual ~SbbBranchDecision();
00288
00290 virtual SbbBranchDecision * clone() const = 0;
00291
00293 virtual void initialize(SbbModel * model) = 0;
00294
00305 virtual int
00306 betterBranch (SbbBranchingObject * thisOne,
00307 SbbBranchingObject * bestSoFar,
00308 double changeUp, int numberInfeasibilitiesUp,
00309 double changeDown, int numberInfeasibilitiesDown) = 0 ;
00310
00318 virtual int
00319 bestBranch (SbbBranchingObject ** objects, int numberObjects, int numberUnsatisfied,
00320 double * changeUp, int * numberInfeasibilitiesUp,
00321 double * changeDown, int * numberInfeasibilitiesDown,
00322 double objectiveValue) ;
00323
00324
00325
00326 private:
00327
00329 SbbBranchDecision & operator=(const SbbBranchDecision& rhs);
00330
00331 };
00332
00333 #endif