Cbc  2.9.9
CbcBranchLotsize.hpp
Go to the documentation of this file.
1 /* $Id: CbcBranchLotsize.hpp 1573 2011-01-05 01:12:36Z lou $ */
2 // Copyright (C) 2004, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5 
6 #ifndef CbcBranchLotsize_H
7 #define CbcBranchLotsize_H
8 
9 #include "CbcBranchBase.hpp"
13 class CbcLotsize : public CbcObject {
14 
15 public:
16 
17  // Default Constructor
19 
20  /* Useful constructor - passed model index.
21  Also passed valid values - if range then pairs
22  */
23  CbcLotsize (CbcModel * model, int iColumn,
24  int numberPoints, const double * points, bool range = false);
25 
26  // Copy constructor
27  CbcLotsize ( const CbcLotsize &);
28 
30  virtual CbcObject * clone() const;
31 
32  // Assignment operator
34 
35  // Destructor
37 
39  virtual double infeasibility(const OsiBranchingInformation * info,
40  int &preferredWay) const;
41 
50  virtual void feasibleRegion();
51 
53  virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ;
54 
69 
78 
84  virtual void resetBounds(const OsiSolverInterface * solver);
85 
89  bool findRange(double value) const;
90 
93  virtual void floorCeiling(double & floorLotsize, double & ceilingLotsize, double value,
94  double tolerance) const;
95 
97  inline int modelSequence() const {
98  return columnNumber_;
99  }
101  inline void setModelSequence(int value) {
102  columnNumber_ = value;
103  }
104 
109  virtual int columnNumber() const;
111  inline double originalLowerBound() const {
112  return bound_[0];
113  }
114  inline double originalUpperBound() const {
115  return bound_[rangeType_*numberRanges_-1];
116  }
118  inline int rangeType() const {
119  return rangeType_;
120  }
122  inline int numberRanges() const {
123  return numberRanges_;
124  }
126  inline double * bound() const {
127  return bound_;
128  }
131  virtual bool canDoHeuristics() const {
132  return false;
133  }
134 
135 private:
137  void printLotsize(double value, bool condition, int type) const;
138 
139 private:
141 
143  int columnNumber_;
145  int rangeType_;
147  int numberRanges_;
148  // largest gap
149  double largestGap_;
151  double * bound_;
153  mutable int range_;
154 };
155 
167 
168 public:
169 
172 
181  int way , double value, const CbcLotsize * lotsize) ;
182 
190  double lowerValue, double upperValue) ;
191 
194 
197 
199  virtual CbcBranchingObject * clone() const;
200 
203 
208  virtual double branch();
209 
213  virtual void print();
214 
216  virtual CbcBranchObjType type() const {
217  return LotsizeBranchObj;
218  }
219 
220  // LL: compareOriginalObject can be inherited from the CbcBranchingObject
221  // since variable_ uniquely defines the lot sizing object.
222 
232  (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
233 
234 protected:
236  double down_[2];
238  double up_[2];
239 };
240 
241 #endif
242 
CbcLotsize::notPreferredNewFeasible
virtual CbcBranchingObject * notPreferredNewFeasible() const
Given a valid solution (with reduced costs, etc.), return a branching object which would give a new f...
CbcLotsizeBranchingObject::clone
virtual CbcBranchingObject * clone() const
Clone.
CbcLotsize::findRange
bool findRange(double value) const
Finds range of interest so value is feasible in range range_ or infeasible between hi[range_] and lo[...
CbcLotsizeBranchingObject::compareBranchingObject
virtual CbcRangeCompare compareBranchingObject(const CbcBranchingObject *brObj, const bool replaceIfOverlap=false)
Compare the this with brObj.
CbcBranchingObject::way
int way() const
Get the state of the branching object.
Definition: CbcBranchingObject.hpp:154
CbcBranchingObject::variable
int variable() const
Index identifying the associated CbcObject within its class.
Definition: CbcBranchingObject.hpp:143
CbcLotsizeBranchingObject::branch
virtual double branch()
Sets the bounds for the variable according to the current arm of the branch and advances the object s...
CbcLotsize::operator=
CbcLotsize & operator=(const CbcLotsize &rhs)
CbcLotsizeBranchingObject::CbcLotsizeBranchingObject
CbcLotsizeBranchingObject()
Default constructor.
CbcLotsizeBranchingObject::operator=
CbcLotsizeBranchingObject & operator=(const CbcLotsizeBranchingObject &rhs)
Assignment operator.
CbcObject::preferredWay
int preferredWay() const
If -1 down always chosen first, +1 up always, 0 normal.
Definition: CbcObject.hpp:245
CbcObject::feasibleRegion
virtual void feasibleRegion()=0
For the variable(s) referenced by the object, look at the current solution and set bounds to match th...
CbcLotsize::CbcLotsize
CbcLotsize()
CbcBranchingObject::branch
virtual double branch()=0
Execute the actions required to branch, as specified by the current state of the branching object,...
CbcLotsize::CbcLotsize
CbcLotsize(const CbcLotsize &)
CbcLotsize::originalUpperBound
double originalUpperBound() const
Definition: CbcBranchLotsize.hpp:114
CbcLotsize::originalLowerBound
double originalLowerBound() const
Original variable bounds.
Definition: CbcBranchLotsize.hpp:111
CbcLotsizeBranchingObject::type
virtual CbcBranchObjType type() const
Return the type (an integer identifier) of this.
Definition: CbcBranchLotsize.hpp:216
CbcLotsize::resetBounds
virtual void resetBounds(const OsiSolverInterface *solver)
Reset original upper and lower bound values from the solver.
CbcLotsize::infeasibility
virtual double infeasibility(const OsiBranchingInformation *info, int &preferredWay) const
Infeasibility - large is 0.5.
CbcLotsize::bound
double * bound() const
Ranges.
Definition: CbcBranchLotsize.hpp:126
CbcLotsize::preferredNewFeasible
virtual CbcBranchingObject * preferredNewFeasible() const
Given a valid solution (with reduced costs, etc.), return a branching object which would give a new f...
CbcLotsize::feasibleRegion
virtual void feasibleRegion()
Set bounds to contain the current solution.
CbcLotsizeBranchingObject::CbcLotsizeBranchingObject
CbcLotsizeBranchingObject(const CbcLotsizeBranchingObject &)
Copy constructor.
CbcLotsize::CbcLotsize
CbcLotsize(CbcModel *model, int iColumn, int numberPoints, const double *points, bool range=false)
CbcLotsize::columnNumber
virtual int columnNumber() const
Column number if single column object -1 otherwise, so returns >= 0 Used by heuristics.
CbcLotsizeBranchingObject::CbcLotsizeBranchingObject
CbcLotsizeBranchingObject(CbcModel *model, int variable, int way, double lowerValue, double upperValue)
Create a degenerate branch object.
CbcLotsize::rangeType
int rangeType() const
Type - 1 points, 2 ranges.
Definition: CbcBranchLotsize.hpp:118
CbcLotsize::modelSequence
int modelSequence() const
Model column number.
Definition: CbcBranchLotsize.hpp:97
CbcModel
Simple Branch and bound class.
Definition: CbcModel.hpp:101
CbcLotsize::~CbcLotsize
~CbcLotsize()
CbcBranchingObject::print
virtual void print() const
Print something about branch - only if log level high.
Definition: CbcBranchingObject.hpp:130
CbcLotsizeBranchingObject::CbcLotsizeBranchingObject
CbcLotsizeBranchingObject(CbcModel *model, int variable, int way, double value, const CbcLotsize *lotsize)
Create a lotsize floor/ceiling branch object.
CbcLotsize::numberRanges
int numberRanges() const
Number of points.
Definition: CbcBranchLotsize.hpp:122
CbcBranchingObject
Abstract branching object base class Now just difference with OsiBranchingObject.
Definition: CbcBranchingObject.hpp:53
CbcObject
Definition: CbcObject.hpp:67
LotsizeBranchObj
@ LotsizeBranchObj
Definition: CbcBranchingObject.hpp:31
CbcLotsize::canDoHeuristics
virtual bool canDoHeuristics() const
Return true if object can take part in normal heuristics.
Definition: CbcBranchLotsize.hpp:131
CbcBranchBase.hpp
CbcLotsizeBranchingObject::~CbcLotsizeBranchingObject
virtual ~CbcLotsizeBranchingObject()
Destructor.
CbcLotsize::clone
virtual CbcObject * clone() const
Clone.
CbcLotsize::setModelSequence
void setModelSequence(int value)
Set model column number.
Definition: CbcBranchLotsize.hpp:101
CbcObject::model
CbcModel * model() const
Return model.
Definition: CbcObject.hpp:240
CbcLotsizeBranchingObject::print
virtual void print()
Print something about branch - only if log level high.
CbcRangeCompare
CbcRangeCompare
Definition: CbcBranchBase.hpp:13
CbcLotsizeBranchingObject
Lotsize branching object.
Definition: CbcBranchLotsize.hpp:166
CbcLotsizeBranchingObject::up_
double up_[2]
Lower [0] and upper [1] bounds for the up arm (way_ = 1)
Definition: CbcBranchLotsize.hpp:238
CbcLotsizeBranchingObject::down_
double down_[2]
Lower [0] and upper [1] bounds for the down arm (way_ = -1)
Definition: CbcBranchLotsize.hpp:236
CbcLotsize::floorCeiling
virtual void floorCeiling(double &floorLotsize, double &ceilingLotsize, double value, double tolerance) const
Returns floor and ceiling.
CbcBranchObjType
CbcBranchObjType
Definition: CbcBranchingObject.hpp:19
CbcBranchingObject::model
CbcModel * model() const
Return model.
Definition: CbcBranchingObject.hpp:171
CbcLotsize
Lotsize class.
Definition: CbcBranchLotsize.hpp:13
CbcLotsize::createCbcBranch
virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface *solver, const OsiBranchingInformation *info, int way)
Creates a branching object.