Cbc  2.10.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CbcNWay.hpp
Go to the documentation of this file.
1 // $Id: CbcNWay.hpp 2465 2019-01-03 19:26:52Z unxusr $
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  // Default Constructor
19  CbcNWay();
20 
24  const int *which, int identifier);
25 
26  // Copy constructor
27  CbcNWay(const CbcNWay &);
28 
30  virtual CbcObject *clone() const;
31 
33  CbcNWay &operator=(const CbcNWay &rhs);
34 
36  virtual ~CbcNWay();
37 
39  void setConsequence(int iColumn, const CbcConsequence &consequence);
40 
42  void applyConsequence(int iSequence, int state) const;
43 
45  virtual double infeasibility(const OsiBranchingInformation *info,
46  int &preferredWay) const;
47 
50  virtual void feasibleRegion();
51 
53  virtual CbcBranchingObject *createCbcBranch(OsiSolverInterface *solver, const OsiBranchingInformation *info, int way);
54 
56  inline int numberMembers() const
57  {
58  return numberMembers_;
59  }
60 
62  inline const int *members() const
63  {
64  return members_;
65  }
67  virtual void redoSequenceEtc(CbcModel *model, int numberColumns, const int *originalColumns);
68 
69 protected:
73 
75  int *members_;
78 };
83 
84 public:
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  {
127  return numberInSet_;
128  }
130  virtual bool twoWay() const
131  {
132  return false;
133  }
134 
136  virtual CbcBranchObjType type() const
137  {
138  return NWayBranchObj;
139  }
140 
148  virtual int compareOriginalObject(const CbcBranchingObject *brObj) const;
149 
158  virtual CbcRangeCompare compareBranchingObject(const CbcBranchingObject *brObj, const bool replaceIfOverlap = false);
159 
160 private:
162  int *order_;
164  const CbcNWay *object_;
167 };
168 #endif
169 
170 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
171 */
virtual void feasibleRegion()=0
For the variable(s) referenced by the object, look at the current solution and set bounds to match th...
const int * members() const
Members (indices in range 0 ... numberColumns-1)
Definition: CbcNWay.hpp:62
virtual CbcObject * clone() const
Clone.
virtual void redoSequenceEtc(CbcModel *model, int numberColumns, const int *originalColumns)
Redoes data when sequence numbers change.
CbcRangeCompare
virtual double branch()
Does next branch and updates state.
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.
void applyConsequence(int iSequence, int state) const
Applies a consequence for a single member.
int preferredWay() const
If -1 down always chosen first, +1 up always, 0 normal.
Definition: CbcObject.hpp:258
Abstract Base Class for describing an interface to a solver.
Define an n-way class for variables.
Definition: CbcNWay.hpp:15
virtual bool twoWay() const
Is this a two way object (-1 down, +1 up)
Definition: CbcNWay.hpp:130
double infeasibility() const
Return infeasibility.
virtual ~CbcNWayBranchingObject()
CbcNWayBranchingObject & operator=(const CbcNWayBranchingObject &rhs)
const CbcNWay * object_
Points back to object.
Definition: CbcNWay.hpp:164
virtual int numberBranches() const
The number of branch arms created for this branching object.
Definition: CbcNWay.hpp:125
CbcModel * model() const
Return model.
Definition: CbcObject.hpp:252
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:75
virtual ~CbcNWay()
Destructor.
Abstract branching object base class Now just difference with OsiBranchingObject. ...
virtual CbcBranchObjType type() const
Return the type (an integer identifier) of this.
Definition: CbcNWay.hpp:136
int numberMembers() const
Number of members.
Definition: CbcNWay.hpp:56
virtual void previousBranch()
Reset every information so that the branching object appears to point to the previous child...
Abstract base class for consequent bounds.
CbcBranchObjType
N way branching Object class.
Definition: CbcNWay.hpp:82
CbcConsequence ** consequence_
Consequences (normally NULL)
Definition: CbcNWay.hpp:77
virtual CbcRangeCompare compareBranchingObject(const CbcBranchingObject *brObj, const bool replaceIfOverlap=false)
Compare the this with brObj.
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...
virtual void print() const
Print something about branch - only if log level high.
CbcNWay & operator=(const CbcNWay &rhs)
Assignment operator.
virtual int compareOriginalObject(const CbcBranchingObject *brObj) const
Compare the original object of this with the original object of brObj.
int numberInSet_
Number in set.
Definition: CbcNWay.hpp:166
int numberMembers_
data Number of members
Definition: CbcNWay.hpp:72
virtual CbcBranchingObject * clone() const
Clone.
Simple Branch and bound class.
Definition: CbcModel.hpp:100
int * order_
order of branching - points back to CbcNWay
Definition: CbcNWay.hpp:162
virtual void print()
Print something about branch - only if log level high.