5#ifndef OsiBranchingObject_H
6#define OsiBranchingObject_H
12#include "CoinError.hpp"
13#include "CoinTypes.hpp"
122 throw CoinError(
"Need code",
"createBranch",
"OsiBranchingObject");
179 whichWay_ =
static_cast< short int >(way);
687 int way,
double value,
double downUpperBound,
double upLowerBound);
739 const int *which,
const double *
weights,
int type = 1);
914 int numberPoints,
const double *points,
bool range =
false);
969 bool findRange(
double value,
double integerTolerance)
const;
973 virtual void floorCeiling(
double &floorLotsize,
double &ceilingLotsize,
double value,
974 double tolerance)
const;
Abstract branching object base class.
void setOriginalObject(const OsiObject *object)
Set pointer back to object which created.
OsiBranchingObject()
Default Constructor.
virtual double branch(OsiSolverInterface *solver)=0
Execute the actions required to branch, as specified by the current state of the branching object,...
virtual double branch()
Execute the actions required to branch, as specified by the current state of the branching object,...
void setNumberBranchesLeft(int)
Set the number of branch arms left for this branching object Just for forcing.
int numberBranchesLeft() const
The number of branch arms left for this branching object.
virtual bool boundBranch() const
Return true if branch should fix variables.
virtual ~OsiBranchingObject()
Destructor.
int branchIndex() const
Get the state of the branching object This is just the branch index.
OsiBranchingObject(const OsiBranchingObject &)
Copy constructor.
void decrementNumberBranchesLeft()
Decrement the number of branch arms left for this branching object.
int columnNumber() const
For debug.
const OsiObject * originalObject_
Pointer back to object which created.
virtual OsiBranchingObject * clone() const =0
Clone.
int numberBranches() const
The number of branch arms created for this branching object.
OsiBranchingObject(OsiSolverInterface *solver, double value)
Constructor.
double value() const
Current value.
OsiBranchingObject & operator=(const OsiBranchingObject &rhs)
Assignment operator.
int numberBranches_
Number of branches.
double value_
Current value - has some meaning about branch.
short branchIndex_
The state of the branching object.
void setBranchingIndex(int branchIndex)
Set the state of the branching object.
void incrementNumberBranchesLeft()
Increment the number of branch arms left for this branching object.
const OsiObject * originalObject() const
Return pointer back to object which created.
virtual void print(const OsiSolverInterface *=NULL) const
Print something about branch - only if log level high.
virtual void checkIsCutoff(double)
Double checks in case node can change its mind! Returns objective value Can change objective etc.
Simple branching object for an integer variable.
OsiIntegerBranchingObject(OsiSolverInterface *solver, const OsiSimpleInteger *originalObject, int way, double value)
Create a standard floor/ceiling branch object.
virtual ~OsiIntegerBranchingObject()
Destructor.
virtual OsiBranchingObject * clone() const
Clone.
OsiIntegerBranchingObject(OsiSolverInterface *solver, const OsiSimpleInteger *originalObject, int way, double value, double downUpperBound, double upLowerBound)
Create a standard floor/ceiling branch object.
OsiIntegerBranchingObject()
Default constructor.
OsiIntegerBranchingObject & operator=(const OsiIntegerBranchingObject &rhs)
Assignment operator.
OsiIntegerBranchingObject(const OsiIntegerBranchingObject &)
Copy constructor.
double up_[2]
Lower [0] and upper [1] bounds for the up arm (way_ = 1)
virtual void print(const OsiSolverInterface *solver=NULL)
Print something about branch - only if log level high.
virtual double branch(OsiSolverInterface *solver)
Sets the bounds for the variable according to the current arm of the branch and advances the object s...
double down_[2]
Lower [0] and upper [1] bounds for the down arm (way_ = -1)
Lotsize branching object.
OsiLotsizeBranchingObject(OsiSolverInterface *solver, const OsiLotsize *originalObject, int way, double value)
Create a lotsize floor/ceiling branch object.
virtual ~OsiLotsizeBranchingObject()
Destructor.
OsiLotsizeBranchingObject()
Default constructor.
OsiLotsizeBranchingObject & operator=(const OsiLotsizeBranchingObject &rhs)
Assignment operator.
double down_[2]
Lower [0] and upper [1] bounds for the down arm (way_ = -1)
OsiLotsizeBranchingObject(const OsiLotsizeBranchingObject &)
Copy constructor.
virtual void print(const OsiSolverInterface *solver=NULL)
Print something about branch - only if log level high.
double up_[2]
Lower [0] and upper [1] bounds for the up arm (way_ = 1)
virtual OsiBranchingObject * clone() const
Clone.
virtual double branch(OsiSolverInterface *solver)
Sets the bounds for the variable according to the current arm of the branch and advances the object s...
double originalLowerBound() const
Original bounds.
virtual bool canDoHeuristics() const
Return true if object can take part in normal heuristics.
virtual OsiBranchingObject * createBranch(OsiSolverInterface *solver, const OsiBranchingInformation *info, int way) const
Creates a branching object.
virtual double downEstimate() const
Return "down" estimate (default 1.0e-5)
OsiLotsize & operator=(const OsiLotsize &rhs)
virtual double upEstimate() const
Return "up" estimate (default 1.0e-5)
double originalUpperBound() const
virtual void resetBounds(const OsiSolverInterface *solver)
Reset original upper and lower bound values from the solver.
virtual void floorCeiling(double &floorLotsize, double &ceilingLotsize, double value, double tolerance) const
Returns floor and ceiling.
OsiLotsize(const OsiSolverInterface *solver, int iColumn, int numberPoints, const double *points, bool range=false)
int rangeType() const
Type - 1 points, 2 ranges.
void setColumnNumber(int value)
Set solver column number.
int rangeType_
Type - 1 points, 2 ranges.
virtual double feasibleRegion(OsiSolverInterface *solver, const OsiBranchingInformation *info) const
Set bounds to contain the current solution.
OsiLotsize(const OsiLotsize &)
virtual int columnNumber() const
Column number if single column object -1 otherwise, so returns >= 0 Used by heuristics.
int numberRanges() const
Number of points.
int numberRanges_
Number of points.
virtual OsiObject * clone() const
Clone.
virtual double infeasibility(const OsiBranchingInformation *info, int &whichWay) const
Infeasibility - large is 0.5.
double * bound() const
Ranges.
virtual void resetSequenceEtc(int numberColumns, const int *originalColumns)
Change column numbers after preprocessing.
virtual bool canHandleShadowPrices() const
Return true if knows how to deal with Pseudo Shadow Prices.
bool findRange(double value, double integerTolerance) const
Finds range of interest so value is feasible in range range_ or infeasible between hi[range_] and lo[...
Define a class to add a bit of complexity to OsiObject This assumes 2 way branching.
virtual int preferredWay() const
Get preferred way of branching - -1 off, 0 down, 1 up (for 2-way)
double otherInfeasibility_
"Infeasibility" on other way
int preferredWay_
Preferred way of branching - -1 off, 0 down, 1 up (for 2-way)
virtual ~OsiObject2()
Destructor.
OsiObject2 & operator=(const OsiObject2 &rhs)
Assignment operator.
OsiObject2()
Default Constructor.
OsiObject2(const OsiObject2 &)
Copy constructor.
void setPreferredWay(int value)
Set preferred way of branching - -1 off, 0 down, 1 up (for 2-way)
Abstract base class for ‘objects’.
double infeasibility() const
Return infeasibility.
virtual bool canMoveToNearest() const
Return true if object can take part in move to nearest heuristic.
double infeasibility_
data
virtual OsiObject * clone() const =0
Clone.
virtual bool canHandleShadowPrices() const
Return true if knows how to deal with Pseudo Shadow Prices.
virtual void updateAfter(const OsiObject *, const OsiObject *)
Updates stuff like pseudocosts after threads finished.
int numberWays() const
Return maximum number of ways branch may have.
short numberWays_
Maximum number of ways on branch.
virtual double checkInfeasibility(const OsiBranchingInformation *info) const
short whichWay_
Computed preferred way to branch.
virtual void resetSequenceEtc(int, const int *)
Change column numbers after preprocessing.
virtual void updateBefore(const OsiObject *)
Updates stuff like pseudocosts before threads.
virtual double infeasibility(const OsiBranchingInformation *info, int &whichWay) const =0
virtual OsiBranchingObject * createBranch(OsiSolverInterface *, const OsiBranchingInformation *, int) const
Create a branching object and indicate which way to branch first.
double infeasibility(const OsiSolverInterface *solver, int &whichWay) const
Infeasibility of the object.
virtual void resetBounds(const OsiSolverInterface *)
Reset variable bounds to their original values.
virtual double upEstimate() const
Return "up" estimate (default 1.0e-5)
OsiObject(const OsiObject &)
Copy constructor.
int whichWay() const
Return current preferred way to branch.
void setPriority(int priority)
Set priority.
virtual double feasibleRegion(OsiSolverInterface *solver) const
For the variable(s) referenced by the object, look at the current solution and set bounds to match th...
virtual double downEstimate() const
Return "down" estimate (default 1.0e-5)
void setWhichWay(int way)
Return preferred way to branch.
virtual ~OsiObject()
Destructor.
virtual int preferredWay() const
Get pre-emptive preferred way of branching - -1 off, 0 down, 1 up (for 2-way)
virtual bool canDoHeuristics() const
Return true if object can take part in normal heuristics.
void setNumberWays(int numberWays)
Set maximum number of ways branch may have.
OsiObject & operator=(const OsiObject &rhs)
Assignment operator.
OsiObject()
Default Constructor.
int priority() const
Return Priority - note 1 is highest priority.
virtual double feasibleRegion(OsiSolverInterface *solver, const OsiBranchingInformation *info) const =0
For the variable(s) referenced by the object, look at the current solution and set bounds to match th...
virtual int columnNumber() const
Column number if single column object -1 otherwise, Used by heuristics.
virtual bool boundBranch() const
Return true if branch should only bound variables.
Branching object for Special ordered sets.
virtual void print(const OsiSolverInterface *solver=NULL)
Print something about branch - only if log level high.
virtual double branch(OsiSolverInterface *solver)
Does next branch and updates state.
virtual OsiBranchingObject * clone() const
Clone.
OsiSOSBranchingObject & operator=(const OsiSOSBranchingObject &rhs)
OsiSOSBranchingObject(const OsiSOSBranchingObject &)
virtual ~OsiSOSBranchingObject()
OsiSOSBranchingObject(OsiSolverInterface *solver, const OsiSOS *originalObject, int way, double separator)
Define Special Ordered Sets of type 1 and 2.
double * weights_
Weights.
int setType() const
SOS type.
OsiSOS & operator=(const OsiSOS &rhs)
virtual double downEstimate() const
Return "down" estimate (default 1.0e-5)
const int * members() const
Members (indices in range 0 ... numberColumns-1)
double * mutableWeights() const
Array of weights.
virtual double upEstimate() const
Return "up" estimate (default 1.0e-5)
virtual double feasibleRegion(OsiSolverInterface *solver, const OsiBranchingInformation *info) const
Set bounds to fix the variable at the current (integer) value.
virtual void resetSequenceEtc(int numberColumns, const int *originalColumns)
Redoes data when sequence numbers change.
int sosType() const
SOS type.
virtual bool canDoHeuristics() const
Return true if object can take part in normal heuristics.
void setNumberMembers(int value)
Set number of members.
virtual OsiObject * clone() const
Clone.
void setIntegerValued(bool yesNo)
Set whether set is integer valued or not.
int * mutableMembers() const
Members (indices in range 0 ... numberColumns-1)
bool integerValued_
Whether integer valued.
const double * weights() const
Array of weights.
virtual double infeasibility(const OsiBranchingInformation *info, int &whichWay) const
Infeasibility - large is 0.5.
virtual bool canHandleShadowPrices() const
Return true if knows how to deal with Pseudo Shadow Prices.
void setSosType(int value)
Set SOS type.
int numberMembers() const
Number of members.
int numberMembers_
Number of members.
virtual OsiBranchingObject * createBranch(OsiSolverInterface *solver, const OsiBranchingInformation *info, int way) const
Creates a branching object.
OsiSOS(const OsiSolverInterface *solver, int numberMembers, const int *which, const double *weights, int type=1)
Useful constructor - which are indices and weights are also given.
Define a single integer class.
virtual OsiObject * clone() const
Clone.
virtual void resetSequenceEtc(int numberColumns, const int *originalColumns)
Change column numbers after preprocessing.
virtual OsiBranchingObject * createBranch(OsiSolverInterface *solver, const OsiBranchingInformation *info, int way) const
Creates a branching object.
OsiSimpleInteger(int iColumn, double lower, double upper)
Useful constructor - passed solver index and original bounds.
int columnNumber_
Column number in solver.
virtual double upEstimate() const
Return "up" estimate (default 1.0e-5)
virtual int columnNumber() const
Column number if single column object -1 otherwise, so returns >= 0 Used by heuristics.
virtual double downEstimate() const
Return "down" estimate (default 1.0e-5)
void setOriginalUpperBound(double value)
virtual double feasibleRegion(OsiSolverInterface *solver, const OsiBranchingInformation *info) const
Set bounds to fix the variable at the current (integer) value.
double originalUpperBound() const
virtual void resetBounds(const OsiSolverInterface *solver)
Reset variable bounds to their original values.
virtual ~OsiSimpleInteger()
Destructor.
double originalLowerBound() const
Original bounds.
OsiSimpleInteger(const OsiSimpleInteger &)
Copy constructor.
virtual double infeasibility(const OsiBranchingInformation *info, int &whichWay) const
Infeasibility - large is 0.5.
void setOriginalLowerBound(double value)
double originalUpper_
Original upper bound.
OsiSimpleInteger & operator=(const OsiSimpleInteger &rhs)
Assignment operator.
void setColumnNumber(int value)
Set solver column number.
virtual bool canHandleShadowPrices() const
Return true if knows how to deal with Pseudo Shadow Prices.
double originalLower_
data Original lower bound
OsiSimpleInteger(const OsiSolverInterface *solver, int iColumn)
Useful constructor - passed solver index.
OsiSimpleInteger()
Default Constructor.
Abstract Base Class for describing an interface to a solver.
This just adds two-wayness to a branching object.
OsiTwoWayBranchingObject()
Default constructor.
OsiTwoWayBranchingObject(const OsiTwoWayBranchingObject &)
Copy constructor.
int firstBranch_
Which way was first branch -1 = down, +1 = up.
int way() const
Way returns -1 on down +1 on up.
virtual double branch(OsiSolverInterface *solver)=0
Sets the bounds for the variable according to the current arm of the branch and advances the object s...
virtual ~OsiTwoWayBranchingObject()
Destructor.
OsiTwoWayBranchingObject(OsiSolverInterface *solver, const OsiObject *originalObject, int way, double value)
Create a standard tw0-way branch object.
OsiTwoWayBranchingObject & operator=(const OsiTwoWayBranchingObject &rhs)
Assignment operator.