CbcBranchLotsize.hpp
Go to the documentation of this file.
1 /* $Id: CbcBranchLotsize.hpp 1432 2010-02-07 19:33:53Z bjarni $ */
2 // Copyright (C) 2004, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 #ifndef CbcBranchLotsize_H
5 #define CbcBranchLotsize_H
6 
7 #include "CbcBranchBase.hpp"
11 class CbcLotsize : public CbcObject {
12 
13 public:
14 
15  // Default Constructor
16  CbcLotsize ();
17 
18  /* Useful constructor - passed model index.
19  Also passed valid values - if range then pairs
20  */
21  CbcLotsize (CbcModel * model, int iColumn,
22  int numberPoints, const double * points, bool range = false);
23 
24  // Copy constructor
25  CbcLotsize ( const CbcLotsize &);
26 
28  virtual CbcObject * clone() const;
29 
30  // Assignment operator
31  CbcLotsize & operator=( const CbcLotsize& rhs);
32 
33  // Destructor
34  ~CbcLotsize ();
35 
37  virtual double infeasibility(const OsiBranchingInformation * info,
38  int &preferredWay) const;
39 
48  virtual void feasibleRegion();
49 
51  virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ;
52 
66  virtual CbcBranchingObject * preferredNewFeasible() const;
67 
76 
82  virtual void resetBounds(const OsiSolverInterface * solver);
83 
87  bool findRange(double value) const;
88 
91  virtual void floorCeiling(double & floorLotsize, double & ceilingLotsize, double value,
92  double tolerance) const;
93 
95  inline int modelSequence() const {
96  return columnNumber_;
97  }
99  inline void setModelSequence(int value) {
100  columnNumber_ = value;
101  }
102 
107  virtual int columnNumber() const;
109  inline double originalLowerBound() const {
110  return bound_[0];
111  }
112  inline double originalUpperBound() const {
113  return bound_[rangeType_*numberRanges_-1];
114  }
116  inline int rangeType() const {
117  return rangeType_;
118  }
120  inline int numberRanges() const {
121  return numberRanges_;
122  }
124  inline double * bound() const {
125  return bound_;
126  }
129  virtual bool canDoHeuristics() const {
130  return false;
131  }
132 
133 private:
135  void printLotsize(double value, bool condition, int type) const;
136 
137 private:
139 
146  // largest gap
147  double largestGap_;
149  double * bound_;
151  mutable int range_;
152 };
153 
165 
166 public:
167 
170 
179  int way , double value, const CbcLotsize * lotsize) ;
180 
187  CbcLotsizeBranchingObject (CbcModel *model, int variable, int way,
188  double lowerValue, double upperValue) ;
189 
192 
195 
197  virtual CbcBranchingObject * clone() const;
198 
200  virtual ~CbcLotsizeBranchingObject ();
201 
206  virtual double branch();
207 
211  virtual void print();
212 
214  virtual CbcBranchObjType type() const {
215  return LotsizeBranchObj;
216  }
217 
218  // LL: compareOriginalObject can be inherited from the CbcBranchingObject
219  // since variable_ uniquely defines the lot sizing object.
220 
230  (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
231 
232 protected:
234  double down_[2];
236  double up_[2];
237 };
238 
239 #endif
240 
CbcLotsizeBranchingObject & operator=(const CbcLotsizeBranchingObject &rhs)
Assignment operator.
Abstract branching object base class Now just difference with OsiBranchingObject. ...
virtual void print()
Print something about branch - only if log level high.
CbcRangeCompare
double * bound() const
Ranges.
bool findRange(double value) const
Finds range of interest so value is feasible in range range_ or infeasible between hi[range_] and lo[...
virtual void floorCeiling(double &floorLotsize, double &ceilingLotsize, double value, double tolerance) const
Returns floor and ceiling.
double down_[2]
Lower [0] and upper [1] bounds for the down arm (way_ = -1)
virtual void print() const
Print something about branch - only if log level high.
int rangeType() const
Type - 1 points, 2 ranges.
virtual CbcBranchingObject * preferredNewFeasible() const
Given a valid solution (with reduced costs, etc.), return a branching object which would give a new f...
int modelSequence() const
Model column number.
int range_
Current range.
virtual void feasibleRegion()
Set bounds to contain the current solution.
virtual ~CbcLotsizeBranchingObject()
Destructor.
virtual double branch()
Sets the bounds for the variable according to the current arm of the branch and advances the object s...
CbcBranchObjType
void printLotsize(double value, bool condition, int type) const
Just for debug (CBC_PRINT defined in CbcBranchLotsize.cpp)
int numberRanges_
Number of points.
double * bound_
Ranges.
void setModelSequence(int value)
Set model column number.
virtual CbcRangeCompare compareBranchingObject(const CbcBranchingObject *brObj, const bool replaceIfOverlap=false)
Compare the this with brObj.
int columnNumber_
data
double originalLowerBound() const
Original variable bounds.
int variable() const
Index identifying the associated CbcObject within its class.
virtual void feasibleRegion()=0
For the variable(s) referenced by the object, look at the current solution and set bounds to match th...
int rangeType_
Type - 1 points, 2 ranges.
double up_[2]
Lower [0] and upper [1] bounds for the up arm (way_ = 1)
Lotsize branching object.
int preferredWay() const
If -1 down always chosen first, +1 up always, 0 normal.
Definition: CbcObject.hpp:235
double originalUpperBound() const
CbcLotsizeBranchingObject()
Default constructor.
int way() const
Get the state of the branching object.
virtual CbcBranchingObject * notPreferredNewFeasible() const
Given a valid solution (with reduced costs, etc.), return a branching object which would give a new f...
virtual bool canDoHeuristics() const
Return true if object can take part in normal heuristics.
virtual double infeasibility(const OsiBranchingInformation *info, int &preferredWay) const
Infeasibility - large is 0.5.
Lotsize class.
CbcModel * model() const
Return model.
Definition: CbcObject.hpp:230
CbcLotsize & operator=(const CbcLotsize &rhs)
virtual void resetBounds(const OsiSolverInterface *solver)
Reset original upper and lower bound values from the solver.
virtual int columnNumber() const
Column number if single column object -1 otherwise, so returns >= 0 Used by heuristics.
virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface *solver, const OsiBranchingInformation *info, int way)
Creates a branching object.
virtual CbcBranchObjType type() const
Return the type (an integer identifier) of this.
virtual CbcObject * clone() const
Clone.
int numberRanges() const
Number of points.
CbcModel * model() const
Return model.
Simple Branch and bound class.
Definition: CbcModel.hpp:98
virtual CbcBranchingObject * clone() const
Clone.
virtual double branch()=0
Execute the actions required to branch, as specified by the current state of the branching object...