3 #ifndef OsiNullSolverInterface_H 4 #define OsiNullSolverInterface_H 9 #include "CoinMessageHandler.hpp" 10 #include "CoinPackedVectorBase.hpp" 13 #include "OsiCollections.hpp" 14 #include "OsiSolverParameters.hpp" 16 class CoinPackedMatrix;
22 class OsiRowCutDebugger;
26 class OsiSolverBranch;
27 class OsiSolverResult;
28 #include "CoinFinite.hpp" 45 CoinAssertHint(0,
"OsiNull does not have a solver");
50 CoinAssertHint(0,
"OsiNull does not have a solver");
55 CoinAssertHint(0,
"OsiNull does not have a solver");
68 CoinAssertHint(0,
"OsiNull does not have a solver");
73 CoinAssertHint(0,
"OsiNull does not have a solver");
78 CoinAssertHint(0,
"OsiNull does not have a solver");
83 CoinAssertHint(0,
"OsiNull does not have a solver");
88 CoinAssertHint(0,
"OsiNull does not have a solver");
93 CoinAssertHint(0,
"OsiNull does not have a solver");
98 CoinAssertHint(0,
"OsiNull does not have a solver");
122 CoinAssertHint(0,
"OsiNull does not have a solver");
133 CoinAssertHint(0,
"OsiNull does not have a solver");
145 CoinAssertHint(0,
"OsiNull does not have a solver");
176 return Mrow->getNumElements();
178 return Mcol->getNumElements();
188 if(colType[i] ==
'B' || colType[i] ==
'I')
264 CoinAssertHint(0,
"Sorry, not implemented yet.");
312 CoinAssertHint(0,
"Sorry, not implemented yet.");
318 CoinAssertHint(0,
"Sorry, not implemented yet.");
330 CoinAssertHint(0,
"Sorry, not implemented yet.");
337 CoinAssertHint(0,
"OsiNull does not have a solver");
365 CoinAssertHint(0,
"OsiNull does not have a solver");
369 CoinAssertHint(0,
"OsiNull does not have a solver");
385 virtual void setObjCoeff(
int elementIndex,
double elementValue ) {
386 CoinAssertHint(0,
"Sorry, not implemented yet.");
391 virtual void setColLower(
int elementIndex,
double elementValue ) {
392 CoinAssertHint(0,
"Sorry, not implemented yet.");
397 virtual void setColUpper(
int elementIndex,
double elementValue ) {
398 CoinAssertHint(0,
"Sorry, not implemented yet.");
403 virtual void setRowLower(
int elementIndex,
double elementValue ) {
404 CoinAssertHint(0,
"Sorry, not implemented yet.");
409 virtual void setRowUpper(
int elementIndex,
double elementValue ) {
410 CoinAssertHint(0,
"Sorry, not implemented yet.");
414 virtual void setRowType(
int index,
char sense,
double rightHandSide,
416 CoinAssertHint(0,
"Sorry, not implemented yet.");
422 CoinAssertHint(0,
"Sorry, not implemented yet.");
463 CoinAssertHint(0,
"Sorry, not implemented yet.");
471 CoinAssertHint(0,
"Sorry, not implemented yet.");
476 CoinAssertHint(0,
"Sorry, not implemented yet.");
492 virtual void addCol(
const CoinPackedVectorBase& vec,
493 const double collb,
const double colub,
495 CoinAssertHint(0,
"Sorry, not implemented yet.");
504 virtual void deleteCols(
const int num,
const int * colIndices) {
505 CoinAssertHint(0,
"Sorry, not implemented yet.");
509 virtual void addRow(
const CoinPackedVectorBase& vec,
510 const double rowlb,
const double rowub) {
511 CoinAssertHint(0,
"Sorry, not implemented yet.");
515 virtual void addRow(
const CoinPackedVectorBase& vec,
516 const char rowsen,
const double rowrhs,
517 const double rowrng) {
518 CoinAssertHint(0,
"Sorry, not implemented yet.");
526 virtual void deleteRows(
const int num,
const int * rowIndices) {
527 CoinAssertHint(0,
"Sorry, not implemented yet.");
536 const CoinPackedMatrix & colMatrix,
537 const double * collb,
538 const double * colub,
540 const double * rowlb,
541 const double * rowub,
542 const char * colType,
543 const double * primalSol,
544 const double infinity){
575 const double * collb,
576 const double * colub,
578 const double * rowlb,
579 const double * rowub){
580 CoinAssertHint(0,
"Sorry, not implemented yet.");
595 double*& collb,
double*& colub,
double*& obj,
596 double*& rowlb,
double*& rowub) {
597 CoinAssertHint(0,
"Sorry, not implemented yet.");
613 const double* collb,
const double* colub,
615 const char* rowsen,
const double* rowrhs,
616 const double* rowrng) {
617 CoinAssertHint(0,
"Sorry, not implemented yet.");
630 double*& collb,
double*& colub,
double*& obj,
631 char*& rowsen,
double*& rowrhs,
633 CoinAssertHint(0,
"Sorry, not implemented yet.");
639 const CoinBigIndex * start,
const int* index,
641 const double* collb,
const double* colub,
643 const double* rowlb,
const double* rowub) {
644 CoinAssertHint(0,
"Sorry, not implemented yet.");
650 const CoinBigIndex * start,
const int* index,
652 const double* collb,
const double* colub,
654 const char* rowsen,
const double* rowrhs,
655 const double* rowrng) {
656 CoinAssertHint(0,
"Sorry, not implemented yet.");
666 const char *extension =
"mps",
667 double objSense=0.0)
const {
668 CoinAssertHint(0,
"Sorry, not implemented yet.");
677 OsiSolverInterface(),
689 CoinAssertHint(0,
"Sorry, not implemented yet.");
713 CoinAssertHint(0,
"OsiNull does not have a solver");
718 CoinAssertHint(0,
"OsiNull does not have a solver");
722 template <
class T>
inline T
724 return value < lower ? lower : (value > upper ? upper : value);
virtual const double * getRightHandSide() const
virtual void setNcol(const int givenNcol)
Set ncol to the number of variables.
virtual void setColSolution(const double *colsol)
virtual void applyColCut(const OsiColCut &cc)
Apply a column cut (adjust the bounds of one or more variables).
const double * getColUpper() const
Get colUpper.
virtual void addRow(const CoinPackedVectorBase &vec, const char rowsen, const double rowrhs, const double rowrng)
virtual bool isProvenOptimal() const
Is optimality proven?
const double * getRowRhs() const
Set rowRhs to point on a vector holding the right hand side of the constraints (for a ranged constrai...
virtual void initialSolve()
Solve initial LP relaxation.
virtual void assignProblem(CoinPackedMatrix *&matrix, double *&collb, double *&colub, double *&obj, double *&rowlb, double *&rowub)
Load in an problem by assuming ownership of the arguments (the constraints on the rows are given by l...
virtual void deleteCols(const int num, const int *colIndices)
Remove a set of columns (primal variables) from the problem.
virtual void setRowUpper(int elementIndex, double elementValue)
Set a single row upper bound.
virtual void addCol(const CoinPackedVectorBase &vec, const double collb, const double colub, const double obj)
Add a column (primal variable) to the problem.
virtual void addRow(const CoinPackedVectorBase &vec, const double rowlb, const double rowub)
Add a row (constraint) to the problem.
virtual void setRowLower(const double *givenRowLower)
Set rowLower to point on a vector holding the lower bounds on the constraints.
const double * getPrimalSol() const
Get primal solution.
virtual std::vector< double * > getPrimalRays(int maxNumRays) const
Class collecting pointers on data for OsiEmpty.
virtual const double * getColSolution() const
Get pointer to array[getNumCols()] of primal variable values.
virtual double getObjValue() const
Get objective function value.
OsiNullSolverInterface & operator=(const OsiNullSolverInterface &rhs)
Assignment operator (disabled)
void loadDataAndSolution(const CoinPackedMatrix &rowMatrix, const CoinPackedMatrix &colMatrix, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub, const char *colType, const double *primalSol, const double infinity)
virtual void setRowPrice(const double *rowprice)
Set dual solution variable values.
virtual void setRowUpper(const double *givenRowUpper)
Set rowUpper to point on a vector holding the upper bounds on the constraints.
const double * getRowLower() const
Get rowLower.
virtual double getObjSense() const
Get objective function sense (1 for min (default), -1 for max)
const double * getRowActivity() const
Set rowActivity to point on a vector holding the activity of the constraints (i.e.
virtual OsiNullSolverInterface * clone(bool copyData=true) const
Clone.
virtual const double * getReducedCost() const
Get a pointer to array[getNumCols()] of reduced costs.
virtual CoinWarmStart * getEmptyWarmStart() const
Get an empty warm start object.
virtual int getNumIntegers() const
Get number of integer variables.
virtual bool isInteger(int colIndex) const
Return true if column is integer.
virtual void setColUpper(const double *givenColUpper)
Set colUpper to point on a vector holding the upper bounds on the variables.
virtual bool isIterationLimitReached() const
Iteration limit reached?
int getNcol() const
Get ncol.
void copyParameters(OsiNullSolverInterface &rhs)
virtual bool isBinary(int colIndex) const
Return true if variable is binary.
const double * getObj() const
Get obj.
virtual void setMatrixByCol(const CoinPackedMatrix *givenMatrixByCol)
Set matrixByCol to point on the coefficient matrix ordered by columns.
virtual void setInteger(int index)
Set the index-th variable to be an integer variable.
virtual const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
virtual const double * getRowActivity() const
Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vecto...
virtual const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
virtual int getNumRows() const
Get number of rows.
virtual void setContinuous(int index)
Set the index-th variable to be a continuous variable.
virtual int getNumCols() const
Get number of columns.
virtual void applyRowCut(const OsiRowCut &rc)
Apply a row cut (append to the constraint matrix).
virtual void setRowLower(int elementIndex, double elementValue)
Set a single row lower bound.
virtual void loadProblem(const CoinPackedMatrix &matrix, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub)
Load in an problem by copying the arguments (the constraints on the rows are given by lower and upper...
const double * getRowUpper() const
Get rowUpper.
virtual void setColUpper(int elementIndex, double elementValue)
Set a single column upper bound.
virtual void loadProblem(const int numcols, const int numrows, const CoinBigIndex *start, const int *index, const double *value, const double *collb, const double *colub, const double *obj, const char *rowsen, const double *rowrhs, const double *rowrng)
Just like the other loadProblem() methods except that the matrix is given in a standard column major ...
virtual bool setWarmStart(const CoinWarmStart *warmstart)
Set warm start information.
virtual const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of matrix.
virtual void setColType(const char *givenColType)
Set colType to point on a vector holding the type of the variables ('B', 'I', or 'C' for Binary...
virtual const char * getRowSense() const
Get pointer to array[getNumRows()] of row constraint senses.
virtual int getIterationCount() const
Get the number of iterations it took to solve the problem (whatever `‘iteration’' means to the so...
T forceIntoRange(const T value, const T lower, const T upper) const
A quick inlined function to force a value to be between a minimum and a maximum value.
const CoinPackedMatrix * getMatrixByRow() const
Get matrixByRow.
virtual void writeMps(const char *filename, const char *extension="mps", double objSense=0.0) const
Write the problem in MPS format to the specified file.
virtual const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
virtual void setColType(const char *colType)
Set characters for columns types.
virtual void setInfinity(const double givenInfinity)
Set infinity.
virtual bool isDualObjectiveLimitReached() const
Is the given dual objective limit reached?
virtual void setMatrixByRow(const CoinPackedMatrix *givenMatrixByRow)
Set matrixByRow to point on the coefficient matrix ordered by rows.
const double * getColLower() const
Get colLower.
virtual const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
const CoinPackedMatrix * getMatrixByCol() const
Get matrixByCol.
virtual ~OsiNullSolverInterface()
Destructor.
static const double OsiNullInfinity
virtual void branchAndBound()
Invoke solver's built-in enumeration algorithm.
virtual bool isProvenPrimalInfeasible() const
Is primal infeasiblity proven?
virtual const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
virtual void resolve()
Resolve an LP relaxation after problem modification.
virtual void setObjCoeff(int elementIndex, double elementValue)
Set an objective function coefficient.
virtual void setRowType(int index, char sense, double rightHandSide, double range)
Set the type of a single row.
double getInfinity() const
Get infinity.
virtual void setNrow(const int givenNrow)
Set nrow to the number of rows.
virtual void assignProblem(CoinPackedMatrix *&matrix, double *&collb, double *&colub, double *&obj, char *&rowsen, double *&rowrhs, double *&rowrng)
Load in an problem by assuming ownership of the arguments (the constraints on the rows are given by s...
virtual void deleteRows(const int num, const int *rowIndices)
Delete a set of rows (constraints) from the problem.
OsiNullSolverInterface()
Default Constructor.
virtual const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of matrix.
virtual void setObj(const double *givenObj)
Set obj to point on a vector holding the objective coefficient values.
virtual std::vector< double * > getDualRays(int maxNumRays) const
Get as many dual rays as the solver can provide.
virtual void loadProblem(const int numcols, const int numrows, const CoinBigIndex *start, const int *index, const double *value, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub)
Just like the other loadProblem() methods except that the matrix is given in a standard column major ...
virtual const double * getRowRange() const
virtual void setPrimalSol(const double *givenPrimalSol)
Set primal solution.
virtual bool isContinuous(int colIndex) const
Return true if variable is continuous.
virtual bool isProvenDualInfeasible() const
Is dual infeasiblity proven?
void initializeOtherData()
initialize the non-const data
const char * getColType() const
Get colType.
virtual CoinWarmStart * getWarmStart() const
Get warm start information.
virtual void setObjSense(double s)
Set the objective function sense.
const char * getRowSense() const
Get rowSense.
virtual void setColLower(const double *givenColLower)
Set colLower to point on a vector holding the lower bounds on the variables.
const double * getRowRange() const
Get rowRange.
int getNrow() const
Get nrow.
virtual bool isAbandoned() const
Are there numerical difficulties?
virtual int getNumElements() const
Get number of nonzero elements.
virtual const double * getRowPrice() const
Get pointer to array[getNumRows()] of dual variable values.
virtual void loadProblem(const CoinPackedMatrix &matrix, const double *collb, const double *colub, const double *obj, const char *rowsen, const double *rowrhs, const double *rowrng)
Load in an problem by copying the arguments (the constraints on the rows are given by sense/rhs/range...
virtual double getInfinity() const
Get solver's value for infinity.
virtual bool isPrimalObjectiveLimitReached() const
Is the given primal objective limit reached?
virtual void setColLower(int elementIndex, double elementValue)
Set a single column lower bound.