CbcNWay.hpp
Go to the documentation of this file.
1 // Edwin 11/9/2009-- carved out of CbcBranchActual
6 #ifndef CbcNWay_H
7 #define CbcNWay_H
8 
9 class CbcNWay : public CbcObject {
10 
11 public:
12 
13  // Default Constructor
14  CbcNWay ();
15 
19  const int * which, int identifier);
20 
21  // Copy constructor
22  CbcNWay ( const CbcNWay &);
23 
25  virtual CbcObject * clone() const;
26 
28  CbcNWay & operator=( const CbcNWay& rhs);
29 
31  virtual ~CbcNWay ();
32 
34  void setConsequence(int iColumn, const CbcConsequence & consequence);
35 
37  void applyConsequence(int iSequence, int state) const;
38 
40  virtual double infeasibility(const OsiBranchingInformation * info,
41  int &preferredWay) const;
42 
45  virtual void feasibleRegion();
46 
48  virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ;
49 
51  inline int numberMembers() const {
52  return numberMembers_;
53  }
54 
56  inline const int * members() const {
57  return members_;
58  }
60  virtual void redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns);
61 
62 protected:
66 
68  int * members_;
71 };
76 
77 public:
78 
79  // Default Constructor
81 
87  int numberBranches, const int * order);
88 
89  // Copy constructor
91 
92  // Assignment operator
94 
96  virtual CbcBranchingObject * clone() const;
97 
98  // Destructor
99  virtual ~CbcNWayBranchingObject ();
100 
103  virtual double branch();
104 
105 #ifdef JJF_ZERO
106  // FIXME: what do we need to do here?
110  virtual void previousBranch();
111 #endif
112 
116  virtual void print();
119  virtual int numberBranches() const {
120  return numberInSet_;
121  }
123  virtual bool twoWay() const {
124  return false;
125  }
126 
128  virtual CbcBranchObjType type() const {
129  return NWayBranchObj;
130  }
131 
139  virtual int compareOriginalObject(const CbcBranchingObject* brObj) const;
140 
150  (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
151 
152 private:
154  int * order_;
156  const CbcNWay * object_;
159 };
160 #endif
Abstract branching object base class Now just difference with OsiBranchingObject. ...
CbcRangeCompare
Define an n-way class for variables.
Definition: CbcNWay.hpp:9
Abstract base class for consequent bounds.
virtual void print() const
Print something about branch - only if log level high.
void applyConsequence(int iSequence, int state) const
Applies a consequence for a single member.
virtual double infeasibility(const OsiBranchingInformation *info, int &preferredWay) const
Infeasibility - large is 0.5 (and 0.5 will give this)
CbcBranchObjType
virtual double branch()
Does next branch and updates state.
virtual CbcRangeCompare compareBranchingObject(const CbcBranchingObject *brObj, const bool replaceIfOverlap=false)
Compare the this with brObj.
virtual CbcObject * clone() const
Clone.
int * members_
Members (indices in range 0 ... numberColumns-1)
Definition: CbcNWay.hpp:68
virtual CbcBranchingObject * clone() const
Clone.
virtual void feasibleRegion()=0
For the variable(s) referenced by the object, look at the current solution and set bounds to match th...
virtual bool twoWay() const
Is this a two way object (-1 down, +1 up)
Definition: CbcNWay.hpp:123
int numberInSet_
Number in set.
Definition: CbcNWay.hpp:158
int preferredWay() const
If -1 down always chosen first, +1 up always, 0 normal.
Definition: CbcObject.hpp:235
int numberMembers_
data Number of members
Definition: CbcNWay.hpp:65
int numberMembers() const
Number of members.
Definition: CbcNWay.hpp:51
virtual CbcBranchObjType type() const
Return the type (an integer identifier) of this.
Definition: CbcNWay.hpp:128
CbcNWayBranchingObject & operator=(const CbcNWayBranchingObject &rhs)
virtual void previousBranch()
Reset every information so that the branching object appears to point to the previous child...
virtual void redoSequenceEtc(CbcModel *model, int numberColumns, const int *originalColumns)
Redoes data when sequence numbers change.
virtual ~CbcNWayBranchingObject()
virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface *solver, const OsiBranchingInformation *info, int way)
Creates a branching object.
CbcModel * model() const
Return model.
Definition: CbcObject.hpp:230
CbcNWay & operator=(const CbcNWay &rhs)
Assignment operator.
virtual void feasibleRegion()
This looks at solution and sets bounds to contain solution.
virtual int compareOriginalObject(const CbcBranchingObject *brObj) const
Compare the original object of this with the original object of brObj.
virtual int numberBranches() const
The number of branch arms created for this branching object.
Definition: CbcNWay.hpp:119
CbcConsequence ** consequence_
Consequences (normally NULL)
Definition: CbcNWay.hpp:70
void setConsequence(int iColumn, const CbcConsequence &consequence)
Set up a consequence for a single member.
virtual ~CbcNWay()
Destructor.
N way branching Object class.
Definition: CbcNWay.hpp:75
const int * members() const
Members (indices in range 0 ... numberColumns-1)
Definition: CbcNWay.hpp:56
const CbcNWay * object_
Points back to object.
Definition: CbcNWay.hpp:156
virtual void print()
Print something about branch - only if log level high.
int * order_
order of branching - points back to CbcNWay
Definition: CbcNWay.hpp:154
CbcModel * model() const
Return model.
Simple Branch and bound class.
Definition: CbcModel.hpp:98
virtual double branch()=0
Execute the actions required to branch, as specified by the current state of the branching object...