Cbc 2.10.12
Loading...
Searching...
No Matches
CbcSOS.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/9/2009-- carved out of CbcBranchActual
7
8#ifndef CbcSOS_H
9#define CbcSOS_H
10
28
29class CbcSOS : public CbcObject {
30
31public:
32 // Default Constructor
34
44
46 const int *which, const double *weights, int identifier,
47 int type = 1);
48
49 // Copy constructor
50 CbcSOS(const CbcSOS &);
51
53 virtual CbcObject *clone() const;
54
55 // Assignment operator
56 CbcSOS &operator=(const CbcSOS &rhs);
57
58 // Destructor
59 virtual ~CbcSOS();
60
62 virtual double infeasibility(const OsiBranchingInformation *info,
63 int &preferredWay) const;
64
67 virtual void feasibleRegion();
68
70 virtual CbcBranchingObject *createCbcBranch(OsiSolverInterface *solver, const OsiBranchingInformation *info, int way);
71
75 virtual CbcObjectUpdateData createUpdateInformation(const OsiSolverInterface *solver,
76 const CbcNode *node,
77 const CbcBranchingObject *branchingObject);
79 virtual void updateInformation(const CbcObjectUpdateData &data);
85 virtual OsiSolverBranch *solverBranch() const;
87 virtual void redoSequenceEtc(CbcModel *model, int numberColumns, const int *originalColumns);
88
90 OsiSOS *osiObject(const OsiSolverInterface *solver) const;
92 inline int numberMembers() const
93 {
94 return numberMembers_;
95 }
96
98 inline const int *members() const
99 {
100 return members_;
101 }
102
104 inline int sosType() const
105 {
106 return sosType_;
107 }
108
109 inline int numberTimesDown() const
110 {
111 return numberTimesDown_;
112 }
113
114 inline int numberTimesUp() const
115 {
116 return numberTimesUp_;
117 }
118
120 inline const double *weights() const
121 {
122 return weights_;
123 }
124
126 inline void setNumberMembers(int n)
127 {
128 numberMembers_ = n;
129 }
130
132 inline int *mutableMembers() const
133 {
134 return members_;
135 }
136
138 inline double *mutableWeights() const
139 {
140 return weights_;
141 }
142
145 virtual bool canDoHeuristics() const
146 {
147 return (sosType_ == 1 && integerValued_);
148 }
149
150 inline void setIntegerValued(bool yesNo)
151 {
152 integerValued_ = yesNo;
153 }
154
155protected:
157
171
172 double *weights_;
174 mutable double shadowEstimateDown_;
176 mutable double shadowEstimateUp_;
193};
194
201
202public:
203 // Default Constructor
205
206 // Useful constructor
208 int way,
209 double separator);
210
211 // Copy constructor
213
214 // Assignment operator
216
218 virtual CbcBranchingObject *clone() const;
219
220 // Destructor
222
225 virtual double branch();
228 virtual void fix(OsiSolverInterface *solver,
229 double *lower, double *upper,
230 int branchState) const;
231
240
244 virtual void print();
245
247 virtual CbcBranchObjType type() const
248 {
249 return SoSBranchObj;
250 }
251
259 virtual int compareOriginalObject(const CbcBranchingObject *brObj) const;
260
269 virtual CbcRangeCompare compareBranchingObject(const CbcBranchingObject *brObj, const bool replaceIfOverlap = false);
270
273
274protected:
276 const CbcSOS *set_;
286};
287#endif
288
289/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
290*/
CbcRangeCompare
@ SoSBranchObj
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.
CbcBranchingObject()
Default Constructor.
virtual double branch()=0
Execute the actions required to branch, as specified by the current state of the branching object,...
CbcModel * model() const
Return model.
int way() const
Get the state of the branching object.
virtual void print() const
Print something about branch - only if log level high.
Simple Branch and bound class.
Definition CbcModel.hpp:100
Information required while the node is live.
Definition CbcNode.hpp:49
virtual void feasibleRegion()=0
For the variable(s) referenced by the object, look at the current solution and set bounds to match th...
CbcModel * model() const
Return model.
int preferredWay() const
If -1 down always chosen first, +1 up always, 0 normal.
virtual OsiSolverBranch * solverBranch() const
Create an OsiSolverBranch object.
void computeNonzeroRange()
Fill out the firstNonzero_ and lastNonzero_ data members.
virtual void print()
Print something about branch - only if log level high.
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 int compareOriginalObject(const CbcBranchingObject *brObj) const
Compare the original object of this with the original object of brObj.
CbcSOSBranchingObject(CbcModel *model, const CbcSOS *clique, int way, double separator)
virtual void fix(OsiSolverInterface *solver, double *lower, double *upper, int branchState) const
Update bounds in solver as in 'branch' and update given bounds.
virtual void previousBranch()
Reset every information so that the branching object appears to point to the previous child.
Definition CbcSOS.hpp:235
virtual ~CbcSOSBranchingObject()
int firstNonzero_
The following two members describe the range in the members_ of the original object that whose upper ...
Definition CbcSOS.hpp:284
const CbcSOS * set_
data
Definition CbcSOS.hpp:276
double separator_
separator
Definition CbcSOS.hpp:278
CbcSOSBranchingObject & operator=(const CbcSOSBranchingObject &rhs)
virtual CbcBranchingObject * clone() const
Clone.
virtual CbcBranchObjType type() const
Return the type (an integer identifier) of this.
Definition CbcSOS.hpp:247
CbcSOSBranchingObject(const CbcSOSBranchingObject &)
Branching object for Special Ordered Sets of type 1 and 2.
Definition CbcSOS.hpp:29
int * members_
data
Definition CbcSOS.hpp:159
int numberTimesUp_
Number of times we have gone up.
Definition CbcSOS.hpp:184
void setNumberMembers(int n)
Set number of members.
Definition CbcSOS.hpp:126
int sosType_
SOS type.
Definition CbcSOS.hpp:188
double shadowEstimateDown_
Current pseudo-shadow price estimate down.
Definition CbcSOS.hpp:174
virtual void feasibleRegion()
This looks at solution and sets bounds to contain solution.
double * mutableWeights() const
Array of weights.
Definition CbcSOS.hpp:138
virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface *solver, const OsiBranchingInformation *info, int way)
Creates a branching object.
int numberTimesDown_
Number of times we have gone down.
Definition CbcSOS.hpp:182
void setIntegerValued(bool yesNo)
Set whether set is integer valued or not.
Definition CbcSOS.hpp:150
double downDynamicPseudoRatio_
Down pseudo ratio.
Definition CbcSOS.hpp:178
virtual OsiSolverBranch * solverBranch() const
Create an OsiSolverBranch object.
const double * weights() const
Array of weights.
Definition CbcSOS.hpp:120
OsiSOS * osiObject(const OsiSolverInterface *solver) const
Construct an OsiSOS object.
virtual ~CbcSOS()
bool oddValues_
Whether odd values e.g. negative.
Definition CbcSOS.hpp:192
double shadowEstimateUp_
Current pseudo-shadow price estimate up.
Definition CbcSOS.hpp:176
CbcSOS(const CbcSOS &)
int * mutableMembers() const
Members (indices in range 0 ... numberColumns-1)
Definition CbcSOS.hpp:132
virtual CbcObject * clone() const
Clone.
int numberMembers() const
Number of members.
Definition CbcSOS.hpp:92
virtual double infeasibility(const OsiBranchingInformation *info, int &preferredWay) const
Infeasibility - large is 0.5.
bool integerValued_
Whether integer valued.
Definition CbcSOS.hpp:190
virtual CbcObjectUpdateData createUpdateInformation(const OsiSolverInterface *solver, const CbcNode *node, const CbcBranchingObject *branchingObject)
Pass in information on branch just done and create CbcObjectUpdateData instance.
virtual void updateInformation(const CbcObjectUpdateData &data)
Update object by CbcObjectUpdateData.
double upDynamicPseudoRatio_
Up pseudo ratio.
Definition CbcSOS.hpp:180
int numberTimesDown() const
Down number times.
Definition CbcSOS.hpp:109
CbcSOS & operator=(const CbcSOS &rhs)
double * weights_
Weights for individual members.
Definition CbcSOS.hpp:172
int numberTimesUp() const
Up number times.
Definition CbcSOS.hpp:114
CbcSOS(CbcModel *model, int numberMembers, const int *which, const double *weights, int identifier, int type=1)
Constructor with SOS type and member information.
int sosType() const
SOS type.
Definition CbcSOS.hpp:104
virtual void redoSequenceEtc(CbcModel *model, int numberColumns, const int *originalColumns)
Redoes data when sequence numbers change.
virtual bool canDoHeuristics() const
Return true if object can take part in normal heuristics.
Definition CbcSOS.hpp:145
int numberMembers_
Number of members.
Definition CbcSOS.hpp:186
const int * members() const
Members (indices in range 0 ... numberColumns-1)
Definition CbcSOS.hpp:98