Cbc  2.9.9
CbcFollowOn.hpp
Go to the documentation of this file.
1 // $Id: CbcFollowOn.hpp 1899 2013-04-09 18:12:08Z stefan $
2 // Copyright (C) 2002, 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 // Edwin 11/10/2009-- carved out of CbcBranchActual
7 
8 #ifndef CbcFollowOn_H
9 #define CbcFollowOn_H
10 
11 #include "CbcBranchBase.hpp"
12 #include "OsiRowCut.hpp"
13 #include "CoinHelperFunctions.hpp"
14 #include "CoinPackedMatrix.hpp"
15 
25 class CbcFollowOn : public CbcObject {
26 
27 public:
28 
29  // Default Constructor
31 
35 
36  // Copy constructor
38 
40  virtual CbcObject * clone() const;
41 
42  // Assignment operator
44 
45  // Destructor
47 
49  virtual double infeasibility(const OsiBranchingInformation * info,
50  int &preferredWay) const;
51 
54  virtual void feasibleRegion();
55 
57  virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ;
59  virtual int gutsOfFollowOn(int & otherRow, int & preferredWay) const;
60 
61 protected:
64  CoinPackedMatrix matrix_;
66  CoinPackedMatrix matrixByRow_;
68  int * rhs_;
69 };
70 
75 
76 public:
77 
78  // Default Constructor
80 
81  // Useful constructor
83  int way,
84  int numberOnDownSide, const int * down,
85  int numberOnUpSide, const int * up);
86 
87  // Copy constructor
89 
90  // Assignment operator
92 
94  virtual CbcBranchingObject * clone() const;
95 
96  // Destructor
98 
101  virtual double branch();
102 
103 #ifdef JJF_ZERO
104  // No need to override. Default works fine.
108  virtual void previousBranch();
109 #endif
110 
114  virtual void print();
115 
117  virtual CbcBranchObjType type() const {
118  return FollowOnBranchObj;
119  }
120 
128  virtual int compareOriginalObject(const CbcBranchingObject* brObj) const;
129 
139  (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
140 
141 private:
144  int numberDown_;
146  int numberUp_;
148  int * downList_;
150  int * upList_;
151 };
152 
161 class CbcIdiotBranch : public CbcObject {
162 
163 public:
164 
165  // Default Constructor
167 
171 
172  // Copy constructor
174 
176  virtual CbcObject * clone() const;
177 
178  // Assignment operator
180 
181  // Destructor
183 
185  virtual double infeasibility(const OsiBranchingInformation * info,
186  int &preferredWay) const;
187 
190  virtual void feasibleRegion();
191 
193  virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ;
196 protected:
198  OsiRowCut buildCut(const OsiBranchingInformation * info,int type,int & preferredWay) const;
201  mutable CoinThreadRandom randomNumberGenerator_;
203  mutable CoinThreadRandom savedRandomNumberGenerator_;
204 };
205 
206 #endif
207 
CbcBranchingObject::way
int way() const
Get the state of the branching object.
Definition: CbcBranchingObject.hpp:154
CbcObject::preferredWay
int preferredWay() const
If -1 down always chosen first, +1 up always, 0 normal.
Definition: CbcObject.hpp:245
CbcIdiotBranch::randomNumberGenerator_
CoinThreadRandom randomNumberGenerator_
data Thread specific random number generator
Definition: CbcFollowOn.hpp:201
CbcFollowOn
Define a follow on class.
Definition: CbcFollowOn.hpp:25
CbcIdiotBranch::createCbcBranch
virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface *solver, const OsiBranchingInformation *info, int way)
Creates a branching object.
CbcBranchingObject::previousBranch
virtual void previousBranch()
Reset every information so that the branching object appears to point to the previous child.
Definition: CbcBranchingObject.hpp:121
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...
CbcIdiotBranch::clone
virtual CbcObject * clone() const
Clone.
CbcIdiotBranch::initializeForBranching
virtual void initializeForBranching(CbcModel *)
Initialize for branching.
CbcBranchingObject::branch
virtual double branch()=0
Execute the actions required to branch, as specified by the current state of the branching object,...
CbcFollowOn::~CbcFollowOn
~CbcFollowOn()
CbcFollowOn::CbcFollowOn
CbcFollowOn(CbcModel *model)
Useful constructor.
CbcFollowOn::CbcFollowOn
CbcFollowOn()
CbcFixingBranchingObject::clone
virtual CbcBranchingObject * clone() const
Clone.
CbcIdiotBranch::CbcIdiotBranch
CbcIdiotBranch(const CbcIdiotBranch &)
CbcFixingBranchingObject::CbcFixingBranchingObject
CbcFixingBranchingObject(const CbcFixingBranchingObject &)
CbcFollowOn::feasibleRegion
virtual void feasibleRegion()
This looks at solution and sets bounds to contain solution.
CbcIdiotBranch::feasibleRegion
virtual void feasibleRegion()
This looks at solution and sets bounds to contain solution.
CbcFixingBranchingObject::type
virtual CbcBranchObjType type() const
Return the type (an integer identifier) of this.
Definition: CbcFollowOn.hpp:117
CbcIdiotBranch::infeasibility
virtual double infeasibility(const OsiBranchingInformation *info, int &preferredWay) const
Infeasibility - large is 0.5.
CbcFollowOn::operator=
CbcFollowOn & operator=(const CbcFollowOn &rhs)
FollowOnBranchObj
@ FollowOnBranchObj
Definition: CbcBranchingObject.hpp:26
CbcModel
Simple Branch and bound class.
Definition: CbcModel.hpp:101
CbcIdiotBranch::savedRandomNumberGenerator_
CoinThreadRandom savedRandomNumberGenerator_
Saved version of thread specific random number generator.
Definition: CbcFollowOn.hpp:203
CbcFollowOn::CbcFollowOn
CbcFollowOn(const CbcFollowOn &)
CbcBranchingObject::print
virtual void print() const
Print something about branch - only if log level high.
Definition: CbcBranchingObject.hpp:130
CbcFixingBranchingObject::print
virtual void print()
Print something about branch - only if log level high.
CbcBranchingObject
Abstract branching object base class Now just difference with OsiBranchingObject.
Definition: CbcBranchingObject.hpp:53
CbcObject
Definition: CbcObject.hpp:67
CbcFixingBranchingObject::CbcFixingBranchingObject
CbcFixingBranchingObject(CbcModel *model, int way, int numberOnDownSide, const int *down, int numberOnUpSide, const int *up)
CbcBranchBase.hpp
CbcIdiotBranch::CbcIdiotBranch
CbcIdiotBranch()
CbcFixingBranchingObject::branch
virtual double branch()
Does next branch and updates state.
CbcFollowOn::matrixByRow_
CoinPackedMatrix matrixByRow_
Matrix by row.
Definition: CbcFollowOn.hpp:66
CbcFixingBranchingObject::compareOriginalObject
virtual int compareOriginalObject(const CbcBranchingObject *brObj) const
Compare the original object of this with the original object of brObj.
CbcFollowOn::createCbcBranch
virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface *solver, const OsiBranchingInformation *info, int way)
Creates a branching object.
CbcFixingBranchingObject::operator=
CbcFixingBranchingObject & operator=(const CbcFixingBranchingObject &rhs)
CbcFixingBranchingObject::~CbcFixingBranchingObject
virtual ~CbcFixingBranchingObject()
CbcFixingBranchingObject
General Branching Object class.
Definition: CbcFollowOn.hpp:74
CbcObject::model
CbcModel * model() const
Return model.
Definition: CbcObject.hpp:240
CbcIdiotBranch::CbcIdiotBranch
CbcIdiotBranch(CbcModel *model)
Useful constructor.
CbcRangeCompare
CbcRangeCompare
Definition: CbcBranchBase.hpp:13
CbcIdiotBranch::buildCut
OsiRowCut buildCut(const OsiBranchingInformation *info, int type, int &preferredWay) const
Build "cut".
CbcFollowOn::matrix_
CoinPackedMatrix matrix_
data Matrix
Definition: CbcFollowOn.hpp:64
CbcFixingBranchingObject::compareBranchingObject
virtual CbcRangeCompare compareBranchingObject(const CbcBranchingObject *brObj, const bool replaceIfOverlap=false)
Compare the this with brObj.
CbcFollowOn::rhs_
int * rhs_
Possible rhs (if 0 then not possible)
Definition: CbcFollowOn.hpp:68
CbcFixingBranchingObject::CbcFixingBranchingObject
CbcFixingBranchingObject()
CbcBranchObjType
CbcBranchObjType
Definition: CbcBranchingObject.hpp:19
CbcBranchingObject::model
CbcModel * model() const
Return model.
Definition: CbcBranchingObject.hpp:171
CbcIdiotBranch
Define an idiotic idea class.
Definition: CbcFollowOn.hpp:161
CbcIdiotBranch::operator=
CbcIdiotBranch & operator=(const CbcIdiotBranch &rhs)
CbcFollowOn::gutsOfFollowOn
virtual int gutsOfFollowOn(int &otherRow, int &preferredWay) const
As some computation is needed in more than one place - returns row.
CbcIdiotBranch::~CbcIdiotBranch
~CbcIdiotBranch()
CbcFollowOn::infeasibility
virtual double infeasibility(const OsiBranchingInformation *info, int &preferredWay) const
Infeasibility - large is 0.5.
CbcFollowOn::clone
virtual CbcObject * clone() const
Clone.