Cbc  2.10.10
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CbcBranchLotsize.hpp
Go to the documentation of this file.
1 /* $Id$ */
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"
12 class CbcLotsize : public CbcObject {
13 
14 public:
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 
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  {
97  return columnNumber_;
98  }
100  inline void setModelSequence(int value)
101  {
102  columnNumber_ = value;
103  }
104 
109  virtual int columnNumber() const;
111  inline double originalLowerBound() const
112  {
113  return bound_[0];
114  }
115  inline double originalUpperBound() const
116  {
117  return bound_[rangeType_ * numberRanges_ - 1];
118  }
120  inline int rangeType() const
121  {
122  return rangeType_;
123  }
125  inline int numberRanges() const
126  {
127  return numberRanges_;
128  }
130  inline double *bound() const
131  {
132  return bound_;
133  }
136  virtual bool canDoHeuristics() const
137  {
138  return false;
139  }
140 
141 private:
143  void printLotsize(double value, bool condition, int type) const;
144 
145 protected:
147 
154  // largest gap
155  double largestGap_;
157  double *bound_;
159  mutable int range_;
160 };
161 
173 
174 public:
177 
186  int way, double value, const CbcLotsize *lotsize);
187 
195  double lowerValue, double upperValue);
196 
199 
202 
204  virtual CbcBranchingObject *clone() const;
205 
207  virtual ~CbcLotsizeBranchingObject();
208 
213  virtual double branch();
214 
218  virtual void print();
219 
221  virtual CbcBranchObjType type() const
222  {
223  return LotsizeBranchObj;
224  }
225 
226  // LL: compareOriginalObject can be inherited from the CbcBranchingObject
227  // since variable_ uniquely defines the lot sizing object.
228 
237  virtual CbcRangeCompare compareBranchingObject(const CbcBranchingObject *brObj, const bool replaceIfOverlap = false);
238 
239 protected:
241  double down_[2];
243  double up_[2];
244 };
245 
246 #endif
247 
248 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
249 */
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:157
CbcBranchingObject::variable
int variable() const
Index identifying the associated CbcObject within its class.
Definition: CbcBranchingObject.hpp:145
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::numberRanges_
int numberRanges_
Number of points.
Definition: CbcBranchLotsize.hpp:153
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:258
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()
CbcLotsize::bound_
double * bound_
Ranges.
Definition: CbcBranchLotsize.hpp:157
CbcBranchingObject::branch
virtual double branch()=0
Execute the actions required to branch, as specified by the current state of the branching object,...
CbcLotsize::originalUpperBound
double originalUpperBound() const
Definition: CbcBranchLotsize.hpp:115
CbcLotsize::originalLowerBound
double originalLowerBound() const
Original variable bounds.
Definition: CbcBranchLotsize.hpp:111
CbcLotsize::range_
int range_
Current range.
Definition: CbcBranchLotsize.hpp:159
CbcLotsize::printLotsize
void printLotsize(double value, bool condition, int type) const
Just for debug (CBC_PRINT defined in CbcBranchLotsize.cpp)
CbcLotsizeBranchingObject::type
virtual CbcBranchObjType type() const
Return the type (an integer identifier) of this.
Definition: CbcBranchLotsize.hpp:221
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:130
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.
CbcLotsize::columnNumber
virtual int columnNumber() const
Column number if single column object -1 otherwise, so returns >= 0 Used by heuristics.
CbcLotsize::rangeType
int rangeType() const
Type - 1 points, 2 ranges.
Definition: CbcBranchLotsize.hpp:120
CbcLotsize::modelSequence
int modelSequence() const
Model column number.
Definition: CbcBranchLotsize.hpp:95
CbcModel
Simple Branch and bound class.
Definition: CbcModel.hpp:100
CbcLotsize::~CbcLotsize
~CbcLotsize()
CbcBranchingObject::print
virtual void print() const
Print something about branch - only if log level high.
Definition: CbcBranchingObject.hpp:132
CbcLotsize::numberRanges
int numberRanges() const
Number of points.
Definition: CbcBranchLotsize.hpp:125
CbcBranchingObject
Abstract branching object base class Now just difference with OsiBranchingObject.
Definition: CbcBranchingObject.hpp:51
CbcObject
Definition: CbcObject.hpp:67
LotsizeBranchObj
@ LotsizeBranchObj
Definition: CbcBranchingObject.hpp:29
CbcLotsize::canDoHeuristics
virtual bool canDoHeuristics() const
Return true if object can take part in normal heuristics.
Definition: CbcBranchLotsize.hpp:136
CbcBranchBase.hpp
CbcLotsize::largestGap_
double largestGap_
Definition: CbcBranchLotsize.hpp:155
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:100
CbcObject::model
CbcModel * model() const
Return model.
Definition: CbcObject.hpp:252
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:172
CbcLotsize::columnNumber_
int columnNumber_
data
Definition: CbcBranchLotsize.hpp:149
CbcLotsizeBranchingObject::up_
double up_[2]
Lower [0] and upper [1] bounds for the up arm (way_ = 1)
Definition: CbcBranchLotsize.hpp:243
CbcLotsizeBranchingObject::down_
double down_[2]
Lower [0] and upper [1] bounds for the down arm (way_ = -1)
Definition: CbcBranchLotsize.hpp:241
CbcLotsize::floorCeiling
virtual void floorCeiling(double &floorLotsize, double &ceilingLotsize, double value, double tolerance) const
Returns floor and ceiling.
CbcBranchObjType
CbcBranchObjType
Definition: CbcBranchingObject.hpp:17
CbcLotsize::rangeType_
int rangeType_
Type - 1 points, 2 ranges.
Definition: CbcBranchLotsize.hpp:151
CbcBranchingObject::model
CbcModel * model() const
Return model.
Definition: CbcBranchingObject.hpp:177
CbcLotsize
Lotsize class.
Definition: CbcBranchLotsize.hpp:12
CbcLotsize::createCbcBranch
virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface *solver, const OsiBranchingInformation *info, int way)
Creates a branching object.