Cbc  2.10.7
CbcFollowOn.hpp
Go to the documentation of this file.
1 // $Id$
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  // Default Constructor
30 
34 
35  // Copy constructor
37 
39  virtual CbcObject *clone() const;
40 
41  // Assignment operator
43 
44  // Destructor
46 
48  virtual double infeasibility(const OsiBranchingInformation *info,
49  int &preferredWay) const;
50 
53  virtual void feasibleRegion();
54 
56  virtual CbcBranchingObject *createCbcBranch(OsiSolverInterface *solver, const OsiBranchingInformation *info, int way);
58  virtual int gutsOfFollowOn(int &otherRow, int &preferredWay) const;
59 
60 protected:
63  CoinPackedMatrix matrix_;
65  CoinPackedMatrix matrixByRow_;
67  int *rhs_;
68 };
69 
74 
75 public:
76  // Default Constructor
78 
79  // Useful constructor
81  int way,
82  int numberOnDownSide, const int *down,
83  int numberOnUpSide, const int *up);
84 
85  // Copy constructor
87 
88  // Assignment operator
90 
92  virtual CbcBranchingObject *clone() const;
93 
94  // Destructor
96 
99  virtual double branch();
100 
101 #ifdef JJF_ZERO
102  // No need to override. Default works fine.
106  virtual void previousBranch();
107 #endif
108 
112  virtual void print();
113 
115  virtual CbcBranchObjType type() const
116  {
117  return FollowOnBranchObj;
118  }
119 
127  virtual int compareOriginalObject(const CbcBranchingObject *brObj) const;
128 
137  virtual CbcRangeCompare compareBranchingObject(const CbcBranchingObject *brObj, const bool replaceIfOverlap = false);
138 
139 private:
146  int *downList_;
148  int *upList_;
149 };
150 
159 class CbcIdiotBranch : public CbcObject {
160 
161 public:
162  // Default Constructor
164 
168 
169  // Copy constructor
171 
173  virtual CbcObject *clone() const;
174 
175  // Assignment operator
177 
178  // Destructor
180 
182  virtual double infeasibility(const OsiBranchingInformation *info,
183  int &preferredWay) const;
184 
187  virtual void feasibleRegion();
188 
190  virtual CbcBranchingObject *createCbcBranch(OsiSolverInterface *solver, const OsiBranchingInformation *info, int way);
193 
194 protected:
196  OsiRowCut buildCut(const OsiBranchingInformation *info, int type, int &preferredWay) const;
199  mutable CoinThreadRandom randomNumberGenerator_;
201  mutable CoinThreadRandom savedRandomNumberGenerator_;
202 };
203 
204 #endif
205 
206 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
207 */
CbcRangeCompare
CbcBranchObjType
@ FollowOnBranchObj
Abstract branching object base class Now just difference with OsiBranchingObject.
virtual void previousBranch()
Reset every information so that the branching object appears to point to the previous child.
CbcModel * model() const
Return model.
virtual double branch()=0
Execute the actions required to branch, as specified by the current state of the branching object,...
int way() const
Get the state of the branching object.
virtual void print() const
Print something about branch - only if log level high.
General Branching Object class.
Definition: CbcFollowOn.hpp:73
CbcFixingBranchingObject(CbcModel *model, int way, int numberOnDownSide, const int *down, int numberOnUpSide, const int *up)
virtual double branch()
Does next branch and updates state.
int * upList_
upList - variables to fix to lb on up branch
virtual ~CbcFixingBranchingObject()
CbcFixingBranchingObject(const CbcFixingBranchingObject &)
CbcFixingBranchingObject & operator=(const CbcFixingBranchingObject &rhs)
virtual CbcRangeCompare compareBranchingObject(const CbcBranchingObject *brObj, const bool replaceIfOverlap=false)
Compare the this with brObj.
virtual CbcBranchingObject * clone() const
Clone.
int numberDown_
data Number on down list
virtual int compareOriginalObject(const CbcBranchingObject *brObj) const
Compare the original object of this with the original object of brObj.
int numberUp_
Number on up list.
virtual CbcBranchObjType type() const
Return the type (an integer identifier) of this.
int * downList_
downList - variables to fix to lb on down branch
virtual void print()
Print something about branch - only if log level high.
Define a follow on class.
Definition: CbcFollowOn.hpp:25
virtual int gutsOfFollowOn(int &otherRow, int &preferredWay) const
As some computation is needed in more than one place - returns row.
int * rhs_
Possible rhs (if 0 then not possible)
Definition: CbcFollowOn.hpp:67
virtual CbcObject * clone() const
Clone.
CbcFollowOn & operator=(const CbcFollowOn &rhs)
CoinPackedMatrix matrixByRow_
Matrix by row.
Definition: CbcFollowOn.hpp:65
CbcFollowOn(CbcModel *model)
Useful constructor.
virtual double infeasibility(const OsiBranchingInformation *info, int &preferredWay) const
Infeasibility - large is 0.5.
virtual void feasibleRegion()
This looks at solution and sets bounds to contain solution.
CoinPackedMatrix matrix_
data Matrix
Definition: CbcFollowOn.hpp:63
virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface *solver, const OsiBranchingInformation *info, int way)
Creates a branching object.
CbcFollowOn(const CbcFollowOn &)
Define an idiotic idea class.
OsiRowCut buildCut(const OsiBranchingInformation *info, int type, int &preferredWay) const
Build "cut".
CbcIdiotBranch(const CbcIdiotBranch &)
virtual double infeasibility(const OsiBranchingInformation *info, int &preferredWay) const
Infeasibility - large is 0.5.
virtual CbcObject * clone() const
Clone.
virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface *solver, const OsiBranchingInformation *info, int way)
Creates a branching object.
virtual void initializeForBranching(CbcModel *)
Initialize for branching.
CoinThreadRandom randomNumberGenerator_
data Thread specific random number generator
CoinThreadRandom savedRandomNumberGenerator_
Saved version of thread specific random number generator.
CbcIdiotBranch & operator=(const CbcIdiotBranch &rhs)
CbcIdiotBranch(CbcModel *model)
Useful constructor.
virtual void feasibleRegion()
This looks at solution and sets bounds to contain solution.
Simple Branch and bound class.
Definition: CbcModel.hpp:100
CbcModel * model() const
Return model.
Definition: CbcObject.hpp:252
virtual void feasibleRegion()=0
For the variable(s) referenced by the object, look at the current solution and set bounds to match th...
int preferredWay() const
If -1 down always chosen first, +1 up always, 0 normal.
Definition: CbcObject.hpp:258