00001
00002
00003
00004 #ifndef CbcBranchLotsize_H
00005 #define CbcBranchLotsize_H
00006
00007 #include "CbcBranchBase.hpp"
00008
00012 class CbcLotsize : public CbcObject {
00013
00014 public:
00015
00016
00017 CbcLotsize ();
00018
00019
00020
00021
00022 CbcLotsize (CbcModel * model, int iColumn,
00023 int numberPoints, const double * points, bool range=false);
00024
00025
00026 CbcLotsize ( const CbcLotsize &);
00027
00029 virtual CbcObject * clone() const;
00030
00031
00032 CbcLotsize & operator=( const CbcLotsize& rhs);
00033
00034
00035 ~CbcLotsize ();
00036
00038 virtual double infeasibility(const OsiBranchingInformation * info,
00039 int &preferredWay) const;
00040
00041 using CbcObject::feasibleRegion ;
00049 virtual void feasibleRegion();
00050
00052 virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver,const OsiBranchingInformation * info, int way) ;
00053
00067 virtual CbcBranchingObject * preferredNewFeasible() const;
00068
00076 virtual CbcBranchingObject * notPreferredNewFeasible() const ;
00077
00083 virtual void resetBounds(const OsiSolverInterface * solver);
00084
00088 bool findRange(double value) const;
00089
00092 virtual void floorCeiling(double & floorLotsize, double & ceilingLotsize, double value,
00093 double tolerance) const;
00094
00096 inline int modelSequence() const
00097 {return columnNumber_;}
00099 inline void setModelSequence(int value)
00100 {columnNumber_ = value;}
00101
00106 virtual int columnNumber() const;
00108 inline double originalLowerBound() const
00109 { return bound_[0];}
00110 inline double originalUpperBound() const
00111 { return bound_[rangeType_*numberRanges_-1];}
00113 inline int rangeType() const
00114 { return rangeType_;}
00116 inline int numberRanges() const
00117 { return numberRanges_;}
00119 inline double * bound() const
00120 { return bound_;}
00123 virtual bool canDoHeuristics() const
00124 {return false;}
00125
00126 private:
00128 void printLotsize(double value,bool condition,int type) const;
00129
00130 private:
00132
00134 int columnNumber_;
00136 int rangeType_;
00138 int numberRanges_;
00139
00140 double largestGap_;
00142 double * bound_;
00144 mutable int range_;
00145 };
00146
00147
00158 class CbcLotsizeBranchingObject : public CbcBranchingObject {
00159
00160 public:
00161
00163 CbcLotsizeBranchingObject ();
00164
00172 CbcLotsizeBranchingObject (CbcModel *model, int variable,
00173 int way , double value,const CbcLotsize * lotsize) ;
00174
00181 CbcLotsizeBranchingObject (CbcModel *model, int variable, int way,
00182 double lowerValue, double upperValue) ;
00183
00185 CbcLotsizeBranchingObject ( const CbcLotsizeBranchingObject &);
00186
00188 CbcLotsizeBranchingObject & operator= (const CbcLotsizeBranchingObject& rhs);
00189
00191 virtual CbcBranchingObject * clone() const;
00192
00194 virtual ~CbcLotsizeBranchingObject ();
00195
00196 using CbcBranchingObject::branch ;
00200 virtual double branch();
00201
00202 #if 0
00203
00207 virtual void previousBranch();
00208 #endif
00209
00210 using CbcBranchingObject::print ;
00213 virtual void print();
00214
00216 virtual int type() const { return 300; }
00217
00218
00219
00220
00229 virtual CbcRangeCompare compareBranchingObject
00230 (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
00231
00232 protected:
00234 double down_[2];
00236 double up_[2];
00237 };
00238
00239
00240 #endif