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);
94 void load( CoinModel & modelObject,
bool tightenBounds =
false,
int logLevel = 1);
96 virtual OsiSolverInterface *
clone(
bool copyData =
true)
const;
112 void addBoundModifier(
bool upperBoundAffected,
bool useUpperBound,
int whichVariable,
int whichVariableAffected,
114 double multiplier = 1.0);
163 CoinPackedMatrix *
quadraticRow(
int rowNumber,
double * linear)
const;
306 void updateBounds(ClpSimplex * solver);
317 int numberAffected,
const int * positionL,
318 const int * positionU,
const double * multiplier);
333 inline int variable()
const {
338 void addBoundModifier(
bool upperBoundAffected,
bool useUpperBound,
int whichVariable,
339 double multiplier = 1.0);
351 unsigned char affect;
352 unsigned char ubUsed;
359 } boundElementAction;
363 OsiSolverInterface * model_;
370 int maximumAffected_;
372 boundElementAction * affected_;
399 virtual void setModel(
CbcModel * model);
412 virtual int solution(
double & objectiveValue,
413 double * newSolution);
415 virtual void resetModel(
CbcModel * model);
427 #include "OsiBranchingObject.hpp" 432 class CoinWarmStartBasis;
447 OsiOldLink (
const OsiSolverInterface * solver,
int numberMembers,
448 int numberLinks,
int first,
449 const double * weights,
int setNumber);
456 OsiOldLink (
const OsiSolverInterface * solver,
int numberMembers,
457 int numberLinks,
int typeSOS,
const int * which,
458 const double * weights,
int setNumber);
464 virtual OsiObject *
clone()
const;
472 using OsiObject::infeasibility ;
474 virtual double infeasibility(
const OsiBranchingInformation * info,
int & whichWay)
const;
476 using OsiObject::feasibleRegion ;
482 virtual double feasibleRegion(OsiSolverInterface * solver,
const OsiBranchingInformation * info)
const;
488 virtual OsiBranchingObject * createBranch(OsiSolverInterface * solver,
const OsiBranchingInformation * info,
int way)
const;
491 virtual void resetSequenceEtc(
int numberColumns,
const int * originalColumns);
537 virtual OsiBranchingObject *
clone()
const;
542 using OsiBranchingObject::branch ;
544 virtual double branch(OsiSolverInterface * solver);
546 using OsiBranchingObject::print ;
549 virtual void print(
const OsiSolverInterface * solver = NULL);
568 OsiOneLink (
const OsiSolverInterface * solver,
int xRow,
int xColumn,
int xyRow,
569 const char * functionString);
610 OsiLink (
const OsiSolverInterface * solver,
int yRow,
611 int yColumn,
double meshSize);
617 virtual OsiObject *
clone()
const;
625 using OsiObject::infeasibility ;
627 virtual double infeasibility(
const OsiBranchingInformation * info,
int & whichWay)
const;
629 using OsiObject::feasibleRegion ;
635 virtual double feasibleRegion(OsiSolverInterface * solver,
const OsiBranchingInformation * info)
const;
641 virtual OsiBranchingObject * createBranch(OsiSolverInterface * solver,
const OsiBranchingInformation * info,
int way)
const;
644 virtual void resetSequenceEtc(
int numberColumns,
const int * originalColumns);
697 virtual OsiBranchingObject *
clone()
const;
702 using OsiBranchingObject::branch ;
704 virtual double branch(OsiSolverInterface * solver);
706 using OsiBranchingObject::print ;
709 virtual void print(
const OsiSolverInterface * solver = NULL);
732 OsiBiLinear (OsiSolverInterface * solver,
int xColumn,
733 int yColumn,
int xyRow,
double coefficient,
734 double xMesh,
double yMesh,
735 int numberExistingObjects = 0,
const OsiObject ** objects = NULL );
743 int yColumn,
int xyRow,
double coefficient,
744 double xMesh,
double yMesh,
745 int numberExistingObjects = 0,
const OsiObject ** objects = NULL );
751 virtual OsiObject *
clone()
const;
759 using OsiObject::infeasibility ;
761 virtual double infeasibility(
const OsiBranchingInformation * info,
int & whichWay)
const;
763 using OsiObject::feasibleRegion ;
769 virtual double feasibleRegion(OsiSolverInterface * solver,
const OsiBranchingInformation * info)
const;
775 virtual OsiBranchingObject * createBranch(OsiSolverInterface * solver,
const OsiBranchingInformation * info,
int way)
const;
778 virtual void resetSequenceEtc(
int numberColumns,
const int * originalColumns);
781 virtual double checkInfeasibility(
const OsiBranchingInformation * info)
const;
791 return (branchingStrategy_&4) != 0;
819 coefficient_ = value;
841 return xOtherSatisfied_;
844 xOtherSatisfied_ = value;
848 return yOtherSatisfied_;
851 yOtherSatisfied_ = value;
872 xySatisfied_ = value;
875 void setMeshSizes(
const OsiSolverInterface * solver,
double x,
double y);
887 return branchingStrategy_;
890 branchingStrategy_ = value;
906 void newBounds(OsiSolverInterface * solver,
int way,
short xOrY,
double separator)
const;
908 int updateCoefficients(
const double * lower,
const double * upper,
double * objective,
909 CoinPackedMatrix * matrix, CoinWarmStartBasis * basis)
const;
911 double xyCoefficient(
const double * solution)
const;
913 void getCoefficients(
const OsiSolverInterface * solver,
double xB[2],
double yB[2],
double xybar[4])
const;
915 double computeLambdas(
const double xB[3],
const double yB[3],
const double xybar[4],
double lambda[4])
const;
917 void addExtraRow(
int row,
double multiplier);
919 void getPseudoShadow(
const OsiBranchingInformation * info);
921 double getMovement(
const OsiBranchingInformation * info);
925 void computeLambdas(
const OsiSolverInterface * solver,
double lambda[4])
const;
1001 double separator,
int chosen);
1010 virtual OsiBranchingObject *
clone()
const;
1015 using OsiBranchingObject::branch ;
1017 virtual double branch(OsiSolverInterface * solver);
1019 using OsiBranchingObject::print ;
1022 virtual void print(
const OsiSolverInterface * solver = NULL);
1025 virtual bool boundBranch()
const;
1051 int yColumn,
int xyRow,
double rhs,
1058 virtual OsiObject *
clone()
const;
1067 virtual double improvement(
const OsiSolverInterface * solver)
const;
1073 double newGrid(OsiSolverInterface * solver,
int type)
const;
1076 return numberPoints_;
1079 numberPoints_ = value;
1109 virtual OsiObject *
clone()
const;
1117 using OsiObject::infeasibility ;
1119 virtual double infeasibility(
const OsiBranchingInformation * info,
int & whichWay)
const;
1125 virtual OsiBranchingObject * createBranch(OsiSolverInterface * solver,
const OsiBranchingInformation * info,
int way)
const;
1147 OsiUsesBiLinear (
const OsiSolverInterface * solver,
int iColumn,
int type);
1159 virtual OsiObject *
clone()
const;
1167 using OsiObject::infeasibility ;
1169 virtual double infeasibility(
const OsiBranchingInformation * info,
int & whichWay)
const;
1175 virtual OsiBranchingObject * createBranch(OsiSolverInterface * solver,
const OsiBranchingInformation * info,
int way)
const;
1177 using OsiObject::feasibleRegion ;
1183 virtual double feasibleRegion(OsiSolverInterface * solver,
const OsiBranchingInformation * info)
const;
1220 virtual OsiChooseVariable *
clone()
const;
1229 virtual int setupList ( OsiBranchingInformation *info,
bool initialize);
1243 virtual int chooseVariable( OsiSolverInterface * solver, OsiBranchingInformation *info,
bool fixVariables);
1247 return numberObjectsToUse_;
1251 numberObjectsToUse_ = value;
1262 #include "CglStored.hpp" 1264 class CoinWarmStartBasis;
1281 virtual void generateCuts(
const OsiSolverInterface & si, OsiCuts & cs,
1282 const CglTreeInfo info = CglTreeInfo());
1294 virtual CglCutGenerator *
clone()
const;
1336 virtual OsiSolverInterface *
clone(
bool copyData =
true)
const;
1362 specialOptions3_ = value;
1366 return specialOptions3_;
1403 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.
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 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.
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.
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.
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.
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.
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.
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.
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.