13 #include "CoinModel.hpp" 14 #include "OsiClpSolverInterface.hpp" 15 #include "OsiChooseVariable.hpp" 18 class CoinPackedMatrix;
48 virtual int fathom(
bool allFixed);
55 double *
nonlinearSLP(
int numberPasses,
double deltaTolerance);
93 void load(CoinModel &modelObject,
bool tightenBounds =
false,
int logLevel = 1);
95 virtual OsiSolverInterface *
clone(
bool copyData =
true)
const;
110 void addBoundModifier(
bool upperBoundAffected,
bool useUpperBound,
int whichVariable,
int whichVariableAffected,
112 double multiplier = 1.0);
169 CoinPackedMatrix *
quadraticRow(
int rowNumber,
double *linear)
const;
320 void updateBounds(ClpSimplex *solver);
330 int numberAffected,
const int *positionL,
331 const int *positionU,
const double *multiplier);
346 inline int variable()
const 352 void addBoundModifier(
bool upperBoundAffected,
bool useUpperBound,
int whichVariable,
353 double multiplier = 1.0);
377 OsiSolverInterface *model_;
412 virtual void setModel(
CbcModel *model);
425 virtual int solution(
double &objectiveValue,
426 double *newSolution);
428 virtual void resetModel(
CbcModel *model);
440 #include "OsiBranchingObject.hpp" 445 class CoinWarmStartBasis;
459 OsiOldLink(
const OsiSolverInterface *solver,
int numberMembers,
460 int numberLinks,
int first,
461 const double *weights,
int setNumber);
468 OsiOldLink(
const OsiSolverInterface *solver,
int numberMembers,
469 int numberLinks,
int typeSOS,
const int *which,
470 const double *weights,
int setNumber);
476 virtual OsiObject *
clone()
const;
484 using OsiObject::infeasibility;
486 virtual double infeasibility(
const OsiBranchingInformation *info,
int &whichWay)
const;
488 using OsiObject::feasibleRegion;
494 virtual double feasibleRegion(OsiSolverInterface *solver,
const OsiBranchingInformation *info)
const;
500 virtual OsiBranchingObject *createBranch(OsiSolverInterface *solver,
const OsiBranchingInformation *info,
int way)
const;
503 virtual void resetSequenceEtc(
int numberColumns,
const int *originalColumns);
551 virtual OsiBranchingObject *
clone()
const;
556 using OsiBranchingObject::branch;
558 virtual double branch(OsiSolverInterface *solver);
560 using OsiBranchingObject::print;
563 virtual void print(
const OsiSolverInterface *solver = NULL);
581 OsiOneLink(
const OsiSolverInterface *solver,
int xRow,
int xColumn,
int xyRow,
582 const char *functionString);
621 OsiLink(
const OsiSolverInterface *solver,
int yRow,
622 int yColumn,
double meshSize);
628 virtual OsiObject *
clone()
const;
636 using OsiObject::infeasibility;
638 virtual double infeasibility(
const OsiBranchingInformation *info,
int &whichWay)
const;
640 using OsiObject::feasibleRegion;
646 virtual double feasibleRegion(OsiSolverInterface *solver,
const OsiBranchingInformation *info)
const;
652 virtual OsiBranchingObject *createBranch(OsiSolverInterface *solver,
const OsiBranchingInformation *info,
int way)
const;
655 virtual void resetSequenceEtc(
int numberColumns,
const int *originalColumns);
710 virtual OsiBranchingObject *
clone()
const;
715 using OsiBranchingObject::branch;
717 virtual double branch(OsiSolverInterface *solver);
719 using OsiBranchingObject::print;
722 virtual void print(
const OsiSolverInterface *solver = NULL);
744 OsiBiLinear(OsiSolverInterface *solver,
int xColumn,
745 int yColumn,
int xyRow,
double coefficient,
746 double xMesh,
double yMesh,
747 int numberExistingObjects = 0,
const OsiObject **objects = NULL);
755 int yColumn,
int xyRow,
double coefficient,
756 double xMesh,
double yMesh,
757 int numberExistingObjects = 0,
const OsiObject **objects = NULL);
763 virtual OsiObject *
clone()
const;
771 using OsiObject::infeasibility;
773 virtual double infeasibility(
const OsiBranchingInformation *info,
int &whichWay)
const;
775 using OsiObject::feasibleRegion;
781 virtual double feasibleRegion(OsiSolverInterface *solver,
const OsiBranchingInformation *info)
const;
787 virtual OsiBranchingObject *createBranch(OsiSolverInterface *solver,
const OsiBranchingInformation *info,
int way)
const;
790 virtual void resetSequenceEtc(
int numberColumns,
const int *originalColumns);
793 virtual double checkInfeasibility(
const OsiBranchingInformation *info)
const;
805 return (branchingStrategy_ & 4) != 0;
840 coefficient_ = value;
868 return xOtherSatisfied_;
872 xOtherSatisfied_ = value;
877 return yOtherSatisfied_;
881 yOtherSatisfied_ = value;
908 xySatisfied_ = value;
911 void setMeshSizes(
const OsiSolverInterface *solver,
double x,
double y);
924 return branchingStrategy_;
928 branchingStrategy_ = value;
946 void newBounds(OsiSolverInterface *solver,
int way,
short xOrY,
double separator)
const;
949 CoinPackedMatrix *matrix, CoinWarmStartBasis *basis)
const;
951 double xyCoefficient(
const double *solution)
const;
953 void getCoefficients(
const OsiSolverInterface *solver,
double xB[2],
double yB[2],
double xybar[4])
const;
955 double computeLambdas(
const double xB[3],
const double yB[3],
const double xybar[4],
double lambda[4])
const;
957 void addExtraRow(
int row,
double multiplier);
959 void getPseudoShadow(
const OsiBranchingInformation *info);
961 double getMovement(
const OsiBranchingInformation *info);
965 void computeLambdas(
const OsiSolverInterface *solver,
double lambda[4])
const;
1040 double separator,
int chosen);
1049 virtual OsiBranchingObject *
clone()
const;
1054 using OsiBranchingObject::branch;
1056 virtual double branch(OsiSolverInterface *solver);
1058 using OsiBranchingObject::print;
1061 virtual void print(
const OsiSolverInterface *solver = NULL);
1064 virtual bool boundBranch()
const;
1089 int yColumn,
int xyRow,
double rhs,
1096 virtual OsiObject *
clone()
const;
1105 virtual double improvement(
const OsiSolverInterface *solver)
const;
1111 double newGrid(OsiSolverInterface *solver,
int type)
const;
1115 return numberPoints_;
1119 numberPoints_ = value;
1147 virtual OsiObject *
clone()
const;
1155 using OsiObject::infeasibility;
1157 virtual double infeasibility(
const OsiBranchingInformation *info,
int &whichWay)
const;
1163 virtual OsiBranchingObject *createBranch(OsiSolverInterface *solver,
const OsiBranchingInformation *info,
int way)
const;
1183 OsiUsesBiLinear(
const OsiSolverInterface *solver,
int iColumn,
int type);
1195 virtual OsiObject *
clone()
const;
1203 using OsiObject::infeasibility;
1205 virtual double infeasibility(
const OsiBranchingInformation *info,
int &whichWay)
const;
1211 virtual OsiBranchingObject *createBranch(OsiSolverInterface *solver,
const OsiBranchingInformation *info,
int way)
const;
1213 using OsiObject::feasibleRegion;
1219 virtual double feasibleRegion(OsiSolverInterface *solver,
const OsiBranchingInformation *info)
const;
1256 virtual OsiChooseVariable *
clone()
const;
1265 virtual int setupList(OsiBranchingInformation *info,
bool initialize);
1279 virtual int chooseVariable(OsiSolverInterface *solver, OsiBranchingInformation *info,
bool fixVariables);
1284 return numberObjectsToUse_;
1289 numberObjectsToUse_ = value;
1300 #include "CglStored.hpp" 1302 class CoinWarmStartBasis;
1317 virtual void generateCuts(
const OsiSolverInterface &si, OsiCuts &cs,
1318 const CglTreeInfo info = CglTreeInfo());
1330 virtual CglCutGenerator *
clone()
const;
1369 virtual OsiSolverInterface *
clone(
bool copyData =
true)
const;
1397 specialOptions3_ = value;
1402 return specialOptions3_;
1438 int numberPasses,
double deltaTolerance,
void setXOtherSatisfied(double value)
double xySatisfied() const
XY satisfied if two version differ by less than this.
ClpSimplex * quadraticModel() const
Copy of quadratic model if one.
virtual bool boundBranch() const
Return true if branch should only bound variables.
virtual void initialSolve()
Solve initial LP relaxation.
ClpSimplex * quadraticModel_
Copy of quadratic model if one.
boundElementAction * affected_
Actions.
virtual int fathom(bool allFixed)
Problem specific Returns -1 if node fathomed and no solution 0 if did nothing 1 if node fathomed and ...
int boundType_
Simple quadratic bound marker.
int updateCoefficients(ClpSimplex *solver, CoinPackedMatrix *matrix)
Update coefficients - returns number updated if in updating mode.
OsiSolverLink & operator=(const OsiSolverLink &rhs)
Assignment operator.
double linearizedBAB(CglStored *cut)
Solve linearized quadratic objective branch and bound.
void setBestObjectiveValue(double value)
Set objective value of best solution found internally.
int biLinearPriority_
Priority for bilinear.
int objectiveVariable() const
Objective transfer variable if one.
int numberPoints() const
Number of points.
void setNumberPoints(int value)
void setNumberObjectsToUse(int value)
Set number of objects to use.
int * whichNonLinear_
Indices in a list/row.
Define data for one link.
int firstLambda() const
First lambda (of 4)
int branchingStrategy() const
branching strategy etc bottom 2 bits 0 branch on either, 1 branch on x, 2 branch on y next bit 4 set ...
Define a single variable class which is involved with OsiBiLinear objects.
double * heuristicSolution(int numberPasses, double deltaTolerance, int mode)
Solves nonlinear problem from CoinModel using SLP - and then tries to get heuristic solution Returns ...
int xColumn() const
X column.
int type_
Type of variable - 0 continuous, 1 integer.
double xSatisfied() const
X satisfied if less than this away from mesh.
ClpSimplex * quadraticModel_
Copy of quadratic model if one.
void setBiLinearPriorities(int value, double meshSize=1.0)
Set all biLinear priorities on x-x variables.
double ySatisfied_
y satisfied if less than this away from mesh
heuristic - just picks up any good solution
int * extraRow_
Row number.
int yRow_
y row (-1 if x*x)
int specialOptions3_
0 bit (1) - don't do mini B&B 1 bit (2) - quadratic only in objective
double * multiplier_
Multiplier for coefficient on row.
double meshSize_
data Current increment for y points
double defaultMeshSize() const
Default meshSize.
int * convex_
Indicator whether is convex, concave or neither -1 concave, 0 neither, +1 convex. ...
int doAOCuts(CglTemporary *cutGen, const double *solution, const double *solution2)
Do OA cuts.
void setYMeshSize(double value)
ClpSimplex * approximateSolution(CoinModel &coinModel, int numberPasses, double deltaTolerance, int mode=0)
Return an approximate solution to a CoinModel.
int objectiveVariable_
Objective transfer variable if one.
void setSpecialOptions2(int value)
Set special options.
const double * bestSolution() const
Best solution found internally.
void setBranchingStrategyOnVariables(int strategyValue, int priorityValue=-1, int mode=7)
Set options and priority on all or some biLinear variables 1 - on I-I 2 - on I-x 4 - on x-x or combin...
const double * bestSolution() const
Best solution found internally.
virtual bool boundBranch() const
Return true if branch should only bound variables.
This class chooses a variable to branch on.
void setDefaultMeshSize(double value)
const CoinModel * coinModel() const
Return CoinModel.
void gutsOfCopy(const OsiSolverLink &rhs)
Do real work of copy.
int numberLinks() const
Number of links for each member.
Branching object for Linked ordered sets.
This is for codes where solver needs to know about CbcModel Seems to provide only one value-added fea...
double yMeshSize() const
Y meshSize.
double bestObjectiveValue() const
Objective value of best solution found internally.
std::string function_
Function.
virtual bool canDoHeuristics() const
Return true if object can take part in normal heuristics.
double * bestSolution_
Best solution found internally.
double xyBranchValue_
value of x or y to branch about
int objectiveRow_
Objective transfer row if one.
int numberAffected_
Number of variables/elements affected.
double xSatisfied_
x satisfied if less than this away from mesh
double coefficient() const
Coefficient.
void setBranchingStrategy(int value)
CoinPackedMatrix * matrix_
Clean copy of matrix Marked coefficients will be multiplied by L or U.
double xOtherSatisfied_
X other satisfied if less than this away from mesh.
This is to allow the user to replace initialSolve and resolve.
virtual bool boundBranch() const
Return true if branch should only bound variables.
void setIntegerPriority(int value)
Set integer priority.
double defaultMeshSize_
Default mesh.
int numberPoints_
Number of points.
virtual bool canDoHeuristics() const
Return true if object can take part in normal heuristics.
double defaultBound() const
Default maximumbound.
int yColumn() const
Y column.
void setDefaultBound(double value)
double yOtherSatisfied_
Y other satisfied if less than this away from mesh.
double defaultBound_
Default maximum bound.
void gutsOfDestructor(bool justNullify=false)
Do real work of initialize.
void setFixedPriority(int priorityValue)
Two tier integer problem where when set of variables with priority less than this are fixed the probl...
This is to allow the user to replace initialSolve and resolve This version changes coefficients...
List of bounds which depend on other bounds.
void setMeshSizes(double value)
Set all mesh sizes on x-x variables.
void setSpecialOptions3(int value)
Set special options.
Define Continuous BiLinear objects for an == bound.
void setXYSatisfied(double value)
CoinModel coinModel_
Model in CoinModel format.
double xySatisfied_
xy satisfied if less than this away from true
ClpSimplex * quadraticModel() const
Copy of quadratic model if one.
OsiLinkedBound * info_
Information.
short chosen_
Which chosen -1 none, 0 x, 1 y.
int numberExtraRows_
Number of extra rows (coefficients to be modified)
void setCoefficient(double value)
Set coefficient.
int numberBiLinear_
data Number of bilinear objects (maybe could be more general)
Define Special Linked Ordered Sets.
int numberNonLinearRows_
Number of rows with nonLinearities.
int specialOptions3() const
Get special options.
int branchingStrategy_
branching strategy etc bottom 2 bits 0 branch on either, 1 branch on x, 2 branch on y next bit 4 set ...
int biLinearPriority() const
Get biLinear priority.
Branching object for Linked ordered sets.
int numberVariables_
Number of variables in tightening phase.
int maximumAffected_
Maximum number of variables/elements affected.
OsiObject ** objects_
Objects.
int * rowNonLinear_
Row number for a list.
int numberLinks() const
Number of links for each member.
void sayConvex(bool convex)
Say convex (should work it out) - if convex false then strictly concave.
Stored Temporary Cut Generator Class - destroyed after first use.
int numberObjectsToUse_
Number of objects to be used (and set in solver)
virtual void resolve()
Resolve an LP relaxation after problem modification.
int yRow_
Row which defines y.
virtual int solution(double &objectiveValue, double *newSolution)=0
returns 0 if no solution, 1 if valid solution with better objective value than one passed in Sets sol...
virtual ~OsiSolverLink()
Destructor.
int * startNonLinear_
Starts of lists.
virtual bool canDoHeuristics() const
Return true if object can take part in normal heuristics.
int specialOptions2_
0 bit (1) - call fathom (may do mini B&B) 1 bit (2) - quadratic only in objective (add OA cuts) 2 bit...
virtual bool canDealWithOdd() const
Returns true if can deal with "odd" problems e.g. sos type 2.
int specialOptions2() const
Get special options.
int boundType() const
Simple quadratic bound marker.
CoinPackedMatrix * originalRowCopy() const
Row copy of matrix Just genuine columns and rows Linear part.
double * bestSolution_
Best solution found internally.
CoinPackedMatrix * quadraticRow(int rowNumber, double *linear) const
Gets correct form for a quadratic row - user to delete.
double yOtherSatisfied() const
Y other satisfied if less than this away from mesh.
CoinPackedMatrix * originalRowCopy_
Row copy of matrix Just genuine columns and rows.
void setYOtherSatisfied(double value)
virtual OsiSolverInterface * clone(bool copyData=true) const
Clone.
void setXSatisfied(double value)
void addBoundModifier(bool upperBoundAffected, bool useUpperBound, int whichVariable, int whichVariableAffected, double multiplier=1.0)
Add a bound modifier.
double bestObjectiveValue_
Objective value of best solution found internally.
int convexity_
Convexity row.
int yColumn_
Column which defines y.
void setBiLinearPriority(int value)
Set biLinear priority.
int xColumn_
Column which defines x.
int * fixVariables_
list of fixed variables
void setBoundType(int value)
OsiSolverLink()
Default Constructor.
short chosen_
data 1 means branch on x, 2 branch on y
void addTighterConstraints()
Add reformulated bilinear constraints.
void load(CoinModel &modelObject, bool tightenBounds=false, int logLevel=1)
Simple Branch and bound class.
void analyzeObjects()
Analyze constraints to see which are convex (quadratic)
double * nonlinearSLP(int numberPasses, double deltaTolerance)
Solves nonlinear problem from CoinModel using SLP - may be used as crash for other algorithms when nu...
double xOtherSatisfied() const
X other satisfied if less than this away from mesh.
CoinPackedMatrix * cleanMatrix() const
Clean copy of matrix So we can add rows.
Define a single integer class - but one where you keep branching until fixed even if satisfied...
void setYSatisfied(double value)
int integerPriority_
Priority for integers.
double ySatisfied() const
Y satisfied if less than this away from mesh.
int numberFix_
Number of variables which when fixed help.
int integerPriority() const
Get integer priority.
int numberObjectsToUse() const
Number of objects to use.
int numberLinks_
Number of links.
Branching object for BiLinear objects.
int firstLambda_
First lambda (of 4)
void setXMeshSize(double value)
double xMeshSize() const
X meshSize.
void setBestSolution(const double *solution, int numberColumns)
Set best solution found internally.