00001
00002
00003
00004
00005
00006
00007
00008 #ifndef CbcGeneralDepth_H
00009 #define CbcGeneralDepth_H
00010
00011 #include "CbcGeneral.hpp"
00012 #include "CbcBranchBase.hpp"
00013 #include "CbcSubProblem.hpp"
00014
00015 #ifdef COIN_HAS_CLP
00016
00020 #include "ClpSimplex.hpp"
00021 #include "ClpNode.hpp"
00022
00023
00024 class CbcGeneralDepth : public CbcGeneral {
00025
00026 public:
00027
00028
00029 CbcGeneralDepth ();
00030
00037 CbcGeneralDepth (CbcModel * model, int maximumDepth);
00038
00039
00040 CbcGeneralDepth ( const CbcGeneralDepth &);
00041
00043 virtual CbcObject * clone() const;
00044
00045
00046 CbcGeneralDepth & operator=( const CbcGeneralDepth& rhs);
00047
00048
00049 ~CbcGeneralDepth ();
00050
00052 virtual double infeasibility(const OsiBranchingInformation * info,
00053 int &preferredWay) const;
00054
00055 using CbcObject::feasibleRegion ;
00057 virtual void feasibleRegion();
00058
00060 virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ;
00062 inline int maximumNodes() const {
00063 return maximumNodes_;
00064 }
00066 inline int maximumDepth() const {
00067 return maximumDepth_;
00068 }
00070 inline void setMaximumDepth(int value) {
00071 maximumDepth_ = value;
00072 }
00074 inline int whichSolution() const {
00075 return whichSolution_;
00076 }
00078 inline ClpNode * nodeInfo(int which) {
00079 return nodeInfo_->nodeInfo_[which];
00080 }
00081
00083 virtual void redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns);
00084
00085 protected:
00088 int maximumDepth_;
00090 int maximumNodes_;
00092 mutable int whichSolution_;
00094 mutable int numberNodes_;
00096 mutable ClpNodeStuff * nodeInfo_;
00097 };
00101 class CbcNode;
00102 class CbcGeneralBranchingObject : public CbcBranchingObject {
00103
00104 public:
00105
00106
00107 CbcGeneralBranchingObject ();
00108
00109
00110 CbcGeneralBranchingObject (CbcModel * model);
00111
00112
00113 CbcGeneralBranchingObject ( const CbcGeneralBranchingObject &);
00114
00115
00116 CbcGeneralBranchingObject & operator=( const CbcGeneralBranchingObject& rhs);
00117
00119 virtual CbcBranchingObject * clone() const;
00120
00121
00122 virtual ~CbcGeneralBranchingObject ();
00123
00124 using CbcBranchingObject::branch ;
00126 virtual double branch();
00129 virtual void checkIsCutoff(double cutoff);
00130
00131 using CbcBranchingObject::print ;
00134 virtual void print();
00136 void state(double & objectiveValue, double & sumInfeasibilities,
00137 int & numberUnsatisfied, int which) const;
00139 inline void setNode(CbcNode * node) {
00140 node_ = node;
00141 }
00143 virtual CbcBranchObjType type() const {
00144 return GeneralDepthBranchObj;
00145 }
00146
00154 virtual int compareOriginalObject(const CbcBranchingObject* brObj) const;
00155
00164 virtual CbcRangeCompare compareBranchingObject
00165 (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
00167 inline int numberSubProblems() const {
00168 return numberSubProblems_;
00169 }
00171 inline int decrementNumberLeft() {
00172 numberSubLeft_--;
00173 return numberSubLeft_;
00174 }
00176 inline int whichNode() const {
00177 return whichNode_;
00178 }
00180 inline void setWhichNode(int value) {
00181 whichNode_ = value;
00182 }
00183
00184 const CbcSubProblem * subProblem(int which) const {
00185 return subProblems_ + which;
00186 }
00187
00188 public:
00190
00191 CbcSubProblem * subProblems_;
00193 CbcNode * node_;
00195 int numberSubProblems_;
00197 int numberSubLeft_;
00199 int whichNode_;
00201 int numberRows_;
00202 };
00206 class CbcOneGeneralBranchingObject : public CbcBranchingObject {
00207
00208 public:
00209
00210
00211 CbcOneGeneralBranchingObject ();
00212
00213
00214 CbcOneGeneralBranchingObject (CbcModel * model,
00215 CbcGeneralBranchingObject * object,
00216 int whichOne);
00217
00218
00219 CbcOneGeneralBranchingObject ( const CbcOneGeneralBranchingObject &);
00220
00221
00222 CbcOneGeneralBranchingObject & operator=( const CbcOneGeneralBranchingObject& rhs);
00223
00225 virtual CbcBranchingObject * clone() const;
00226
00227
00228 virtual ~CbcOneGeneralBranchingObject ();
00229
00230 using CbcBranchingObject::branch ;
00232 virtual double branch();
00235 virtual void checkIsCutoff(double cutoff);
00236
00237 using CbcBranchingObject::print ;
00240 virtual void print();
00242 virtual CbcBranchObjType type() const {
00243 return OneGeneralBranchingObj;
00244 }
00245
00253 virtual int compareOriginalObject(const CbcBranchingObject* brObj) const;
00254
00263 virtual CbcRangeCompare compareBranchingObject
00264 (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
00265
00266 public:
00269 CbcGeneralBranchingObject * object_;
00271 int whichOne_;
00272 };
00273 #endif //COIN_HAS_CLP
00274 #endif
00275