Cbc
2.10.10
|
Branching object for Special Ordered Sets of type 1 and 2. More...
#include <CbcSOS.hpp>
Public Member Functions | |
CbcSOS () | |
CbcSOS (CbcModel *model, int numberMembers, const int *which, const double *weights, int identifier, int type=1) | |
Constructor with SOS type and member information. More... | |
CbcSOS (const CbcSOS &) | |
virtual CbcObject * | clone () const |
Clone. More... | |
CbcSOS & | operator= (const CbcSOS &rhs) |
virtual | ~CbcSOS () |
virtual double | infeasibility (const OsiBranchingInformation *info, int &preferredWay) const |
Infeasibility - large is 0.5. More... | |
virtual void | feasibleRegion () |
This looks at solution and sets bounds to contain solution. More... | |
virtual CbcBranchingObject * | createCbcBranch (OsiSolverInterface *solver, const OsiBranchingInformation *info, int way) |
Creates a branching object. More... | |
virtual CbcObjectUpdateData | createUpdateInformation (const OsiSolverInterface *solver, const CbcNode *node, const CbcBranchingObject *branchingObject) |
Pass in information on branch just done and create CbcObjectUpdateData instance. More... | |
virtual void | updateInformation (const CbcObjectUpdateData &data) |
Update object by CbcObjectUpdateData. More... | |
virtual OsiSolverBranch * | solverBranch () const |
Create an OsiSolverBranch object. More... | |
virtual void | redoSequenceEtc (CbcModel *model, int numberColumns, const int *originalColumns) |
Redoes data when sequence numbers change. More... | |
OsiSOS * | osiObject (const OsiSolverInterface *solver) const |
Construct an OsiSOS object. More... | |
int | numberMembers () const |
Number of members. More... | |
const int * | members () const |
Members (indices in range 0 ... numberColumns-1) More... | |
int | sosType () const |
SOS type. More... | |
int | numberTimesDown () const |
Down number times. More... | |
int | numberTimesUp () const |
Up number times. More... | |
const double * | weights () const |
Array of weights. More... | |
void | setNumberMembers (int n) |
Set number of members. More... | |
int * | mutableMembers () const |
Members (indices in range 0 ... numberColumns-1) More... | |
double * | mutableWeights () const |
Array of weights. More... | |
virtual bool | canDoHeuristics () const |
Return true if object can take part in normal heuristics. More... | |
void | setIntegerValued (bool yesNo) |
Set whether set is integer valued or not. More... | |
virtual void | feasibleRegion ()=0 |
For the variable(s) referenced by the object, look at the current solution and set bounds to match the solution. More... | |
virtual double | feasibleRegion (OsiSolverInterface *solver, const OsiBranchingInformation *info) const |
Dummy one for compatibility. More... | |
virtual double | feasibleRegion (OsiSolverInterface *solver) const |
For the variable(s) referenced by the object, look at the current solution and set bounds to match the solution. More... | |
virtual OsiSolverBranch * | solverBranch () const |
Create an OsiSolverBranch object. More... | |
![]() | |
CbcObject () | |
CbcObject (CbcModel *model) | |
CbcObject (const CbcObject &) | |
CbcObject & | operator= (const CbcObject &rhs) |
virtual | ~CbcObject () |
Destructor. More... | |
virtual double | infeasibility (int &) const |
virtual double | feasibleRegion (OsiSolverInterface *solver, const OsiBranchingInformation *info) const |
Dummy one for compatibility. More... | |
virtual double | feasibleRegion (OsiSolverInterface *solver) const |
For the variable(s) referenced by the object, look at the current solution and set bounds to match the solution. More... | |
virtual OsiBranchingObject * | createBranch (OsiSolverInterface *, const OsiBranchingInformation *, int) const |
virtual OsiBranchingObject * | createOsiBranch (OsiSolverInterface *solver, const OsiBranchingInformation *info, int way) const |
Create an Osibranching object and indicate which way to branch first. More... | |
virtual CbcBranchingObject * | preferredNewFeasible () const |
Given a valid solution (with reduced costs, etc.), return a branching object which would give a new feasible point in a good direction. More... | |
virtual CbcBranchingObject * | notPreferredNewFeasible () const |
Given a valid solution (with reduced costs, etc.), return a branching object which would give a new feasible point in a bad direction. More... | |
virtual void | resetBounds (const OsiSolverInterface *) |
Reset variable bounds to their original values. More... | |
virtual void | floorCeiling (double &floorValue, double &ceilingValue, double value, double tolerance) const |
Returns floor and ceiling i.e. More... | |
int | id () const |
Identifier (normally column number in matrix) More... | |
void | setId (int value) |
Set identifier (normally column number in matrix) but 1000000000 to 1100000000 means optional branching object i.e. More... | |
bool | optionalObject () const |
Return true if optional branching object i.e. More... | |
int | position () const |
Get position in object_ list. More... | |
void | setPosition (int position) |
Set position in object_ list. More... | |
void | setModel (CbcModel *model) |
update model More... | |
CbcModel * | model () const |
Return model. More... | |
int | preferredWay () const |
If -1 down always chosen first, +1 up always, 0 normal. More... | |
void | setPreferredWay (int value) |
Set -1 down always chosen first, +1 up always, 0 normal. More... | |
virtual void | initializeForBranching (CbcModel *) |
Initialize for branching. More... | |
Protected Attributes | |
int * | members_ |
data More... | |
double * | weights_ |
Weights for individual members. More... | |
double | shadowEstimateDown_ |
Current pseudo-shadow price estimate down. More... | |
double | shadowEstimateUp_ |
Current pseudo-shadow price estimate up. More... | |
double | downDynamicPseudoRatio_ |
Down pseudo ratio. More... | |
double | upDynamicPseudoRatio_ |
Up pseudo ratio. More... | |
int | numberTimesDown_ |
Number of times we have gone down. More... | |
int | numberTimesUp_ |
Number of times we have gone up. More... | |
int | numberMembers_ |
Number of members. More... | |
int | sosType_ |
SOS type. More... | |
bool | integerValued_ |
Whether integer valued. More... | |
bool | oddValues_ |
Whether odd values e.g. negative. More... | |
![]() | |
CbcModel * | model_ |
data More... | |
int | id_ |
Identifier (normally column number in matrix) More... | |
int | position_ |
Position in object list. More... | |
int | preferredWay_ |
If -1 down always chosen first, +1 up always, 0 normal. More... | |
Branching object for Special Ordered Sets of type 1 and 2.
SOS1 are an ordered set of variables where at most one variable can be non-zero. SOS1 are commonly defined with binary variables (interpreted as selection between alternatives) but this is not necessary. An SOS1 with all binary variables is a special case of a clique (setting any one variable to 1 forces all others to 0).
In theory, the implementation makes no assumptions about integrality in Type 1 sets. In practice, there are places where the code seems to have been written with a binary SOS mindset. Current development of SOS branching objects is proceeding in OsiSOS.
SOS2 are an ordered set of variables in which at most two consecutive variables can be non-zero and must sum to 1 (interpreted as interpolation between two discrete values). By definition the variables are non-integer.
Definition at line 29 of file CbcSOS.hpp.
CbcSOS::CbcSOS | ( | ) |
CbcSOS::CbcSOS | ( | CbcModel * | model, |
int | numberMembers, | ||
const int * | which, | ||
const double * | weights, | ||
int | identifier, | ||
int | type = 1 |
||
) |
Constructor with SOS type and member information.
Type specifies SOS 1 or 2. Identifier is an arbitrary value.
Which should be an array of variable indices with numberMembers entries. Weights can be used to assign arbitrary weights to variables, in the order they are specified in which. If no weights are provided, a default array of 0, 1, 2, ... is generated.
CbcSOS::CbcSOS | ( | const CbcSOS & | ) |
|
virtual |
|
virtual |
Infeasibility - large is 0.5.
Reimplemented from CbcObject.
|
virtual |
This looks at solution and sets bounds to contain solution.
Implements CbcObject.
|
virtual |
Creates a branching object.
Reimplemented from CbcObject.
|
virtual |
Pass in information on branch just done and create CbcObjectUpdateData instance.
If object does not need data then backward pointer will be NULL. Assumes can get information from solver
Reimplemented from CbcObject.
|
virtual |
Update object by CbcObjectUpdateData.
Reimplemented from CbcObject.
|
virtual |
Create an OsiSolverBranch object.
This returns NULL if branch not represented by bound changes
Reimplemented from CbcObject.
|
virtual |
Redoes data when sequence numbers change.
Reimplemented from CbcObject.
OsiSOS* CbcSOS::osiObject | ( | const OsiSolverInterface * | solver | ) | const |
Construct an OsiSOS object.
|
inline |
Number of members.
Definition at line 92 of file CbcSOS.hpp.
|
inline |
Members (indices in range 0 ... numberColumns-1)
Definition at line 98 of file CbcSOS.hpp.
|
inline |
SOS type.
Definition at line 104 of file CbcSOS.hpp.
|
inline |
Down number times.
Definition at line 109 of file CbcSOS.hpp.
|
inline |
Up number times.
Definition at line 114 of file CbcSOS.hpp.
|
inline |
Array of weights.
Definition at line 120 of file CbcSOS.hpp.
|
inline |
Set number of members.
Definition at line 126 of file CbcSOS.hpp.
|
inline |
Members (indices in range 0 ... numberColumns-1)
Definition at line 132 of file CbcSOS.hpp.
|
inline |
Array of weights.
Definition at line 138 of file CbcSOS.hpp.
|
inlinevirtual |
Return true if object can take part in normal heuristics.
Definition at line 145 of file CbcSOS.hpp.
|
inline |
Set whether set is integer valued or not.
Definition at line 150 of file CbcSOS.hpp.
virtual void CbcObject::feasibleRegion |
For the variable(s) referenced by the object, look at the current solution and set bounds to match the solution.
virtual double CbcObject::feasibleRegion |
Dummy one for compatibility.
virtual double CbcObject::feasibleRegion |
For the variable(s) referenced by the object, look at the current solution and set bounds to match the solution.
Returns measure of how much it had to move solution to make feasible
virtual OsiSolverBranch* CbcObject::solverBranch |
Create an OsiSolverBranch object.
This returns NULL if branch not represented by bound changes
|
protected |
|
protected |
Weights for individual members.
Arbitrary weights for members. Can be used to attach meaning to variable values independent of objective coefficients. For example, if the SOS set comprises binary variables used to choose a facility of a given size, the weight could be the corresponding facilty size. Fractional values of the SOS variables can then be used to estimate ideal facility size.
Weights cannot be completely arbitrary. From the code, they must be differ by at least 1.0e-7
Definition at line 172 of file CbcSOS.hpp.
|
mutableprotected |
Current pseudo-shadow price estimate down.
Definition at line 174 of file CbcSOS.hpp.
|
mutableprotected |
Current pseudo-shadow price estimate up.
Definition at line 176 of file CbcSOS.hpp.
|
protected |
Down pseudo ratio.
Definition at line 178 of file CbcSOS.hpp.
|
protected |
Up pseudo ratio.
Definition at line 180 of file CbcSOS.hpp.
|
protected |
Number of times we have gone down.
Definition at line 182 of file CbcSOS.hpp.
|
protected |
Number of times we have gone up.
Definition at line 184 of file CbcSOS.hpp.
|
protected |
Number of members.
Definition at line 186 of file CbcSOS.hpp.
|
protected |
SOS type.
Definition at line 188 of file CbcSOS.hpp.
|
protected |
Whether integer valued.
Definition at line 190 of file CbcSOS.hpp.
|
protected |
Whether odd values e.g. negative.
Definition at line 192 of file CbcSOS.hpp.