00001
00002
00003
00004
00005
00006 #ifndef CbcBranchLotsize_H
00007 #define CbcBranchLotsize_H
00008
00009 #include "CbcBranchBase.hpp"
00013 class CbcLotsize : public CbcObject {
00014
00015 public:
00016
00017
00018 CbcLotsize ();
00019
00020
00021
00022
00023 CbcLotsize (CbcModel * model, int iColumn,
00024 int numberPoints, const double * points, bool range = false);
00025
00026
00027 CbcLotsize ( const CbcLotsize &);
00028
00030 virtual CbcObject * clone() const;
00031
00032
00033 CbcLotsize & operator=( const CbcLotsize& rhs);
00034
00035
00036 ~CbcLotsize ();
00037
00039 virtual double infeasibility(const OsiBranchingInformation * info,
00040 int &preferredWay) const;
00041
00042 using CbcObject::feasibleRegion ;
00050 virtual void feasibleRegion();
00051
00053 virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ;
00054
00068 virtual CbcBranchingObject * preferredNewFeasible() const;
00069
00077 virtual CbcBranchingObject * notPreferredNewFeasible() const ;
00078
00084 virtual void resetBounds(const OsiSolverInterface * solver);
00085
00089 bool findRange(double value) const;
00090
00093 virtual void floorCeiling(double & floorLotsize, double & ceilingLotsize, double value,
00094 double tolerance) const;
00095
00097 inline int modelSequence() const {
00098 return columnNumber_;
00099 }
00101 inline void setModelSequence(int value) {
00102 columnNumber_ = value;
00103 }
00104
00109 virtual int columnNumber() const;
00111 inline double originalLowerBound() const {
00112 return bound_[0];
00113 }
00114 inline double originalUpperBound() const {
00115 return bound_[rangeType_*numberRanges_-1];
00116 }
00118 inline int rangeType() const {
00119 return rangeType_;
00120 }
00122 inline int numberRanges() const {
00123 return numberRanges_;
00124 }
00126 inline double * bound() const {
00127 return bound_;
00128 }
00131 virtual bool canDoHeuristics() const {
00132 return false;
00133 }
00134
00135 private:
00137 void printLotsize(double value, bool condition, int type) const;
00138
00139 private:
00141
00143 int columnNumber_;
00145 int rangeType_;
00147 int numberRanges_;
00148
00149 double largestGap_;
00151 double * bound_;
00153 mutable int range_;
00154 };
00155
00166 class CbcLotsizeBranchingObject : public CbcBranchingObject {
00167
00168 public:
00169
00171 CbcLotsizeBranchingObject ();
00172
00180 CbcLotsizeBranchingObject (CbcModel *model, int variable,
00181 int way , double value, const CbcLotsize * lotsize) ;
00182
00189 CbcLotsizeBranchingObject (CbcModel *model, int variable, int way,
00190 double lowerValue, double upperValue) ;
00191
00193 CbcLotsizeBranchingObject ( const CbcLotsizeBranchingObject &);
00194
00196 CbcLotsizeBranchingObject & operator= (const CbcLotsizeBranchingObject& rhs);
00197
00199 virtual CbcBranchingObject * clone() const;
00200
00202 virtual ~CbcLotsizeBranchingObject ();
00203
00204 using CbcBranchingObject::branch ;
00208 virtual double branch();
00209
00210 using CbcBranchingObject::print ;
00213 virtual void print();
00214
00216 virtual CbcBranchObjType type() const {
00217 return LotsizeBranchObj;
00218 }
00219
00220
00221
00222
00231 virtual CbcRangeCompare compareBranchingObject
00232 (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
00233
00234 protected:
00236 double down_[2];
00238 double up_[2];
00239 };
00240
00241 #endif
00242