CbcSimpleInteger.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef CbcSimpleInteger_H
00009 #define CbcSimpleInteger_H
00010
00011 #include "CbcBranchingObject.hpp"
00012
00023 class CbcIntegerBranchingObject : public CbcBranchingObject {
00024
00025 public:
00026
00028 CbcIntegerBranchingObject ();
00029
00037 CbcIntegerBranchingObject (CbcModel *model, int variable,
00038 int way , double value) ;
00039
00047 CbcIntegerBranchingObject (CbcModel *model, int variable, int way,
00048 double lowerValue, double upperValue) ;
00049
00051 CbcIntegerBranchingObject ( const CbcIntegerBranchingObject &);
00052
00054 CbcIntegerBranchingObject & operator= (const CbcIntegerBranchingObject& rhs);
00055
00057 virtual CbcBranchingObject * clone() const;
00058
00060 virtual ~CbcIntegerBranchingObject ();
00061
00063 void fillPart ( int variable, int way , double value) ;
00064 using CbcBranchingObject::branch ;
00069 virtual double branch();
00072 virtual void fix(OsiSolverInterface * solver,
00073 double * lower, double * upper,
00074 int branchState) const ;
00077 virtual bool tighten(OsiSolverInterface * ) ;
00078
00079 #ifdef JJF_ZERO
00080
00084 virtual void previousBranch();
00085 #endif
00086
00087 using CbcBranchingObject::print ;
00090 virtual void print();
00091
00093 inline const double * downBounds() const {
00094 return down_;
00095 }
00097 inline const double * upBounds() const {
00098 return up_;
00099 }
00101 inline void setDownBounds(const double bounds[2]) {
00102 memcpy(down_, bounds, 2*sizeof(double));
00103 }
00105 inline void setUpBounds(const double bounds[2]) {
00106 memcpy(up_, bounds, 2*sizeof(double));
00107 }
00108 #ifdef FUNNY_BRANCHING
00109
00111 inline const int * variables() const {
00112 return variables_;
00113 }
00114
00115 inline const double * newBounds() const {
00116 return newBounds_;
00117 }
00119 inline int numberExtraChangedBounds() const {
00120 return numberExtraChangedBounds_;
00121 }
00123 int applyExtraBounds(int iColumn, double lower, double upper, int way) ;
00125 void deactivate();
00127 inline bool active() const {
00128 return (down_[1] != -COIN_DBL_MAX);
00129 }
00130 #endif
00131
00133 virtual CbcBranchObjType type() const {
00134 return SimpleIntegerBranchObj;
00135 }
00136
00145 virtual CbcRangeCompare compareBranchingObject
00146 (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
00147
00148 protected:
00150 double down_[2];
00152 double up_[2];
00153 #ifdef FUNNY_BRANCHING
00154
00156 int * variables_;
00157
00158 double * newBounds_;
00160 int numberExtraChangedBounds_;
00161 #endif
00162 };
00163
00165
00166
00167 class CbcSimpleInteger : public CbcObject {
00168
00169 public:
00170
00171
00172 CbcSimpleInteger ();
00173
00174
00175 CbcSimpleInteger (CbcModel * model, int iColumn, double breakEven = 0.5);
00176
00177
00178 CbcSimpleInteger (CbcModel * model, const OsiSimpleInteger * object);
00179
00180
00181 CbcSimpleInteger ( const CbcSimpleInteger &);
00182
00184 virtual CbcObject * clone() const;
00185
00186
00187 CbcSimpleInteger & operator=( const CbcSimpleInteger& rhs);
00188
00189
00190 virtual ~CbcSimpleInteger ();
00192 OsiSimpleInteger * osiObject() const;
00194 virtual double infeasibility(const OsiBranchingInformation * info,
00195 int &preferredWay) const;
00196
00197 using CbcObject::feasibleRegion ;
00203 virtual double feasibleRegion(OsiSolverInterface * solver, const OsiBranchingInformation * info) const;
00204
00210 virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ;
00212 void fillCreateBranch(CbcIntegerBranchingObject * branching, const OsiBranchingInformation * info, int way) ;
00213
00214 using CbcObject::solverBranch ;
00219 virtual OsiSolverBranch * solverBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info) const;
00220
00227 virtual void feasibleRegion();
00228
00233 virtual int columnNumber() const;
00235 inline void setColumnNumber(int value) {
00236 columnNumber_ = value;
00237 }
00238
00243 virtual void resetBounds(const OsiSolverInterface * solver) ;
00244
00247 virtual void resetSequenceEtc(int numberColumns, const int * originalColumns) ;
00249 inline double originalLowerBound() const {
00250 return originalLower_;
00251 }
00252 inline void setOriginalLowerBound(double value) {
00253 originalLower_ = value;
00254 }
00255 inline double originalUpperBound() const {
00256 return originalUpper_;
00257 }
00258 inline void setOriginalUpperBound(double value) {
00259 originalUpper_ = value;
00260 }
00262 inline double breakEven() const {
00263 return breakEven_;
00264 }
00266 inline void setBreakEven(double value) {
00267 breakEven_ = value;
00268 }
00269
00270
00271 protected:
00273
00275 double originalLower_;
00277 double originalUpper_;
00279 double breakEven_;
00281 int columnNumber_;
00283 int preferredWay_;
00284 };
00285 #endif
00286