/home/coin/SVN-release/Cbc-2.3.2/Cbc/src/CbcBranchLotsize.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2004, International Business Machines
00002 // Corporation and others.  All Rights Reserved.
00003 #ifndef CbcBranchLotsize_H
00004 #define CbcBranchLotsize_H
00005 
00006 #include "CbcBranchBase.hpp"
00007 
00011 class CbcLotsize : public CbcObject {
00012 
00013 public:
00014 
00015   // Default Constructor 
00016   CbcLotsize ();
00017 
00018   /* Useful constructor - passed model index.
00019      Also passed valid values - if range then pairs
00020   */
00021   CbcLotsize (CbcModel * model, int iColumn,
00022               int numberPoints, const double * points, bool range=false);
00023   
00024   // Copy constructor 
00025   CbcLotsize ( const CbcLotsize &);
00026    
00028   virtual CbcObject * clone() const;
00029 
00030   // Assignment operator 
00031   CbcLotsize & operator=( const CbcLotsize& rhs);
00032 
00033   // Destructor 
00034   ~CbcLotsize ();
00035   
00036   using CbcObject::infeasibility ;
00038   virtual double infeasibility(int & preferredWay) const;
00039 
00040   using CbcObject::feasibleRegion ;
00048   virtual void feasibleRegion();
00049 
00050   using CbcObject::createBranch ;
00052   virtual CbcBranchingObject * createBranch(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   // largest gap
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   // No need to override. Default works fine.
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   // LL: compareOriginalObject can be inherited from the CbcBranchingObject
00219   // since variable_ uniquely defines the lot sizing object.
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

Generated on Wed Oct 7 03:01:15 2009 by  doxygen 1.4.7