Cbc  2.9.8
CbcNWay.hpp
Go to the documentation of this file.
1 // $Id: CbcNWay.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/9/2009-- carved out of CbcBranchActual
7 
12 #ifndef CbcNWay_H
13 #define CbcNWay_H
14 
15 class CbcNWay : public CbcObject {
16 
17 public:
18 
19  // Default Constructor
20  CbcNWay ();
21 
25  const int * which, int identifier);
26 
27  // Copy constructor
28  CbcNWay ( const CbcNWay &);
29 
31  virtual CbcObject * clone() const;
32 
34  CbcNWay & operator=( const CbcNWay& rhs);
35 
37  virtual ~CbcNWay ();
38 
40  void setConsequence(int iColumn, const CbcConsequence & consequence);
41 
43  void applyConsequence(int iSequence, int state) const;
44 
46  virtual double infeasibility(const OsiBranchingInformation * info,
47  int &preferredWay) const;
48 
51  virtual void feasibleRegion();
52 
54  virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ;
55 
57  inline int numberMembers() const {
58  return numberMembers_;
59  }
60 
62  inline const int * members() const {
63  return members_;
64  }
66  virtual void redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns);
67 
68 protected:
72 
74  int * members_;
77 };
82 
83 public:
84 
85  // Default Constructor
87 
93  int numberBranches, const int * order);
94 
95  // Copy constructor
97 
98  // Assignment operator
100 
102  virtual CbcBranchingObject * clone() const;
103 
104  // Destructor
105  virtual ~CbcNWayBranchingObject ();
106 
109  virtual double branch();
110 
111 #ifdef JJF_ZERO
112  // FIXME: what do we need to do here?
116  virtual void previousBranch();
117 #endif
118 
122  virtual void print();
125  virtual int numberBranches() const {
126  return numberInSet_;
127  }
129  virtual bool twoWay() const {
130  return false;
131  }
132 
134  virtual CbcBranchObjType type() const {
135  return NWayBranchObj;
136  }
137 
145  virtual int compareOriginalObject(const CbcBranchingObject* brObj) const;
146 
155  virtual CbcRangeCompare compareBranchingObject
156  (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
157 
158 private:
160  int * order_;
162  const CbcNWay * object_;
164  int numberInSet_;
165 };
166 #endif
int numberMembers() const
Number of members.
Definition: CbcNWay.hpp:57
virtual CbcObject * clone() const
Clone.
virtual double infeasibility(const OsiBranchingInformation *info, int &preferredWay) const
Infeasibility - large is 0.5 (and 0.5 will give this)
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:129
virtual void redoSequenceEtc(CbcModel *model, int numberColumns, const int *originalColumns)
Redoes data when sequence numbers change.
CbcRangeCompare
virtual void feasibleRegion()
This looks at solution and sets bounds to contain solution.
void setConsequence(int iColumn, const CbcConsequence &consequence)
Set up a consequence for a single member.
Define an n-way class for variables.
Definition: CbcNWay.hpp:15
virtual int numberBranches() const
The number of branch arms created for this branching object.
Definition: CbcNWay.hpp:125
virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface *solver, const OsiBranchingInformation *info, int way)
Creates a branching object.
int * members_
Members (indices in range 0 ... numberColumns-1)
Definition: CbcNWay.hpp:74
virtual ~CbcNWay()
Destructor.
Abstract branching object base class Now just difference with OsiBranchingObject. ...
const int * members() const
Members (indices in range 0 ... numberColumns-1)
Definition: CbcNWay.hpp:62
Abstract base class for consequent bounds.
CbcBranchObjType
N way branching Object class.
Definition: CbcNWay.hpp:81
CbcConsequence ** consequence_
Consequences (normally NULL)
Definition: CbcNWay.hpp:76
CbcModel * model() const
Return model.
Definition: CbcObject.hpp:240
virtual double branch()=0
Execute the actions required to branch, as specified by the current state of the branching object...
virtual void print() const
Print something about branch - only if log level high.
CbcNWay & operator=(const CbcNWay &rhs)
Assignment operator.
int numberMembers_
data Number of members
Definition: CbcNWay.hpp:71
Simple Branch and bound class.
Definition: CbcModel.hpp:101
void applyConsequence(int iSequence, int state) const
Applies a consequence for a single member.
virtual CbcBranchObjType type() const
Return the type (an integer identifier) of this.
Definition: CbcNWay.hpp:134
int preferredWay() const
If -1 down always chosen first, +1 up always, 0 normal.
Definition: CbcObject.hpp:245