6#ifndef OsiCbcSolverInterface_2_10_H
7#define OsiCbcSolverInterface_2_10_H
12#include "CbcModel.hpp"
13#include "CoinPackedMatrix.hpp"
14#include "OsiSolverInterface.hpp"
15#include "CbcStrategy.hpp"
16#include "CoinWarmStartBasis.hpp"
19class OsiClpSolverInterface;
32 const std::string& netlibDir);
69 bool setStrParam(OsiStrParam key,
const std::string& value);
71 bool getIntParam(OsiIntParam key,
int& value)
const;
73 bool getDblParam(OsiDblParam key,
double& value)
const;
75 bool getStrParam(OsiStrParam key, std::string& value)
const;
77 virtual bool setHintParam(OsiHintParam key,
bool yesNo =
true,
78 OsiHintStrength strength = OsiHintTry,
79 void* otherInformation = NULL);
82 OsiHintStrength& strength,
83 void*& otherInformation)
const;
85 using OsiSolverInterface::getHintParam;
88 OsiHintStrength& strength)
const;
127 virtual bool setWarmStart(
const CoinWarmStart* warmstart);
270 virtual std::vector<double*>
getDualRays(
int maxNumRays,
271 bool fullRay =
false)
const;
283 virtual std::vector<double*>
getPrimalRays(
int maxNumRays)
const;
299 unsigned digits = 7)
const;
303 virtual std::string
getObjName(
unsigned maxLen = std::string::npos)
const;
312 unsigned maxLen = std::string::npos)
const;
320 virtual void setRowName(
int ndx, std::string name);
324 virtual void setRowNames(OsiNameVec& srcNames,
int srcStart,
int len,
334 unsigned maxLen = std::string::npos)
const;
342 virtual void setColName(
int ndx, std::string name);
346 virtual void setColNames(OsiNameVec& srcNames,
int srcStart,
int len,
364 virtual void setObjCoeff(
int elementIndex,
double elementValue);
366 using OsiSolverInterface::setColLower;
369 virtual void setColLower(
int elementIndex,
double elementValue);
371 using OsiSolverInterface::setColUpper;
374 virtual void setColUpper(
int elementIndex,
double elementValue);
377 virtual void setColBounds(
int elementIndex,
double lower,
double upper);
388 const int* indexLast,
389 const double* boundList);
393 virtual void setRowLower(
int elementIndex,
double elementValue);
397 virtual void setRowUpper(
int elementIndex,
double elementValue);
400 virtual void setRowBounds(
int elementIndex,
double lower,
double upper);
403 virtual void setRowType(
int index,
char sense,
double rightHandSide,
415 const int* indexLast,
416 const double* boundList);
429 const int* indexLast,
430 const char* senseList,
431 const double* rhsList,
432 const double* rangeList);
447 virtual void setInteger(
const int* indices,
int len);
483 using OsiSolverInterface::addCol;
485 virtual void addCol(
const CoinPackedVectorBase& vec,
const double collb,
486 const double colub,
const double obj);
488 virtual void addCol(
int numberElements,
const int* rows,
489 const double* elements,
const double collb,
490 const double colub,
const double obj);
492 using OsiSolverInterface::addCols;
494 virtual void addCols(
const int numcols,
495 const CoinPackedVectorBase*
const* cols,
496 const double* collb,
const double* colub,
499 virtual void deleteCols(
const int num,
const int* colIndices);
501 using OsiSolverInterface::addRow;
503 virtual void addRow(
const CoinPackedVectorBase& vec,
const double rowlb,
506 virtual void addRow(
const CoinPackedVectorBase& vec,
const char rowsen,
507 const double rowrhs,
const double rowrng);
509 using OsiSolverInterface::addRows;
511 virtual void addRows(
const int numrows,
512 const CoinPackedVectorBase*
const* rows,
513 const double* rowlb,
const double* rowub);
515 virtual void addRows(
const int numrows,
516 const CoinPackedVectorBase*
const* rows,
517 const char* rowsen,
const double* rowrhs,
518 const double* rowrng);
520 virtual void deleteRows(
const int num,
const int* rowIndices);
526 virtual void applyRowCuts(
int numberCuts,
const OsiRowCut* cuts);
531 virtual void applyRowCuts(
int numberCuts,
const OsiRowCut** cuts);
551 virtual void loadProblem(
const CoinPackedMatrix& matrix,
const double* collb,
552 const double* colub,
const double* obj,
553 const double* rowlb,
const double* rowub);
562 virtual void assignProblem(CoinPackedMatrix*& matrix,
double*& collb,
563 double*& colub,
double*& obj,
double*& rowlb,
578 virtual void loadProblem(
const CoinPackedMatrix& matrix,
const double* collb,
579 const double* colub,
const double* obj,
580 const char* rowsen,
const double* rowrhs,
581 const double* rowrng);
590 virtual void assignProblem(CoinPackedMatrix*& matrix,
double*& collb,
591 double*& colub,
double*& obj,
char*& rowsen,
592 double*& rowrhs,
double*& rowrng);
596 virtual void loadProblem(
const int numcols,
const int numrows,
597 const CoinBigIndex* start,
const int* index,
598 const double* value,
const double* collb,
599 const double* colub,
const double* obj,
600 const double* rowlb,
const double* rowub);
604 virtual void loadProblem(
const int numcols,
const int numrows,
605 const CoinBigIndex* start,
const int* index,
606 const double* value,
const double* collb,
607 const double* colub,
const double* obj,
608 const char* rowsen,
const double* rowrhs,
609 const double* rowrng);
611 using OsiSolverInterface::readMps;
614 virtual int readMps(
const char* filename,
const char* extension =
"mps");
620 virtual void writeMps(
const char* filename,
621 const char* extension =
"mps",
622 double objSense = 0.0)
const;
631 virtual int writeMpsNative(
const char* filename,
const char** rowNames,
632 const char** columnNames,
int formatType = 0,
633 int numberAcross = 2,
double objSense = 0.0)
const;
684 return modelPtr_->isSolutionLimitReached();
705 CbcStrategy* strategy = NULL);
708 virtual OsiSolverInterface*
clone(
bool copyData =
true)
const;
749 const std::string& netlibDir);
void OsiCbcSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir)
A function that tests the methods in the OsiCbcSolverInterface class.
static const double OsiCbcInfinity
virtual void setInteger(int index)
Set the index-th variable to be an integer variable.
virtual bool isIterationLimitReached() const
Iteration limit reached?
virtual const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
CbcModel * getModelPtr() const
Get pointer to Cbc model.
int getMaximumSolutions() const
Get the CbcModel::CbcMaxNumSol maximum number of solutions.
virtual double getObjValue() const
Get objective function value.
void setMaximumSeconds(double value)
Set the CbcModel::CbcMaximumSeconds maximum number of seconds.
virtual const char * getRowSense() const
Get pointer to array[getNumRows()] of row constraint senses.
virtual int getNumElements() const
Get number of nonzero elements.
virtual std::string getObjName(unsigned maxLen=std::string::npos) const
Return the name of the objective function.
virtual bool setWarmStart(const CoinWarmStart *warmstart)
Set warmstarting information.
double getCutoff() const
Get the cutoff bound on the objective function - always as minimize.
virtual const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
virtual void initialSolve()
Solve initial LP relaxation.
virtual const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of matrix.
virtual void deleteRows(const int num, const int *rowIndices)
virtual void deleteCols(const int num, const int *colIndices)
virtual void setContinuous(int index)
Set the index-th variable to be a continuous variable.
virtual void setRowSetTypes(const int *indexFirst, const int *indexLast, const char *senseList, const double *rhsList, const double *rangeList)
Set the type of a number of rows simultaneously The default implementation just invokes setRowType()...
virtual void setObjName(std::string name)
Set the name of the objective function.
virtual void resolve()
Resolve an LP relaxation after problem modification.
virtual bool isDualObjectiveLimitReached() const
Is the given dual objective limit reached?
virtual int writeMpsNative(const char *filename, const char **rowNames, const char **columnNames, int formatType=0, int numberAcross=2, double objSense=0.0) const
Write the problem into an mps file of the given filename, names may be null.
virtual const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of matrix.
virtual bool setHintParam(OsiHintParam key, bool yesNo=true, OsiHintStrength strength=OsiHintTry, void *otherInformation=NULL)
virtual bool getHintParam(OsiHintParam key, bool &yesNo, OsiHintStrength &strength, void *&otherInformation) const
Get a hint parameter.
virtual void addCols(const int numcols, const CoinPackedVectorBase *const *cols, const double *collb, const double *colub, const double *obj)
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...
int getNodeCount() const
Get how many Nodes it took to solve the problem.
virtual ~OsiCbcSolverInterface()
Destructor.
bool getIntParam(OsiIntParam key, int &value) const
virtual void branchAndBound()
Invoke solver's built-in enumeration algorithm.
bool isSolutionLimitReached() const
Solution limit reached?
virtual int getNumRows() const
Get number of rows.
friend void OsiCbcSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir)
A function that tests the methods in the OsiCbcSolverInterface class.
virtual bool isContinuous(int colNumber) const
Return true if column is continuous.
virtual std::vector< double * > getPrimalRays(int maxNumRays) const
Get as many primal rays as the solver can provide.
int getMaximumNodes() const
Get the CbcModel::CbcMaxNumNode maximum node limit.
virtual void setColLower(int elementIndex, double elementValue)
Set a single column lower bound Use -DBL_MAX for -infinity.
virtual const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
virtual void setRowNames(OsiNameVec &srcNames, int srcStart, int len, int tgtStart)
Set multiple row names.
void setCutoff(double value)
Set cutoff bound on the objective function.
virtual bool isProvenOptimal() const
Is optimality proven?
virtual int getIterationCount() const
Get how many iterations it took to solve the problem (whatever "iteration" mean to the solver.
virtual const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
double getMaximumSeconds() const
Get the CbcModel::CbcMaximumSeconds maximum number of seconds.
virtual void applyRowCuts(int numberCuts, const OsiRowCut *cuts)
Apply a collection of row cuts which are all effective.
bool getStrParam(OsiStrParam key, std::string &value) const
virtual void applyRowCut(const OsiRowCut &rc)
Apply a row cut (append to constraint matrix).
virtual const double * getRightHandSide() const
Get pointer to array[getNumRows()] of rows right-hand sides.
virtual std::string getRowName(int rowIndex, unsigned maxLen=std::string::npos) const
Return the name of the row.
virtual void setColName(int ndx, std::string name)
Set a column name.
virtual const double * getReducedCost() const
Get a pointer to array[getNumCols()] of reduced costs.
virtual void setColSetBounds(const int *indexFirst, const int *indexLast, const double *boundList)
Set the bounds on a number of columns simultaneously The default implementation just invokes setColL...
bool setIntParam(OsiIntParam key, int value)
virtual void setObjSense(double s)
Set objective function sense (1 for min (default), -1 for max,)
virtual bool isPrimalObjectiveLimitReached() const
Is the given primal objective limit reached?
virtual const double * getColSolution() const
Get pointer to array[getNumCols()] of primal solution vector.
virtual int readMps(const char *filename, const char *extension="mps")
Read an mps file from the given filename (defaults to Osi reader) - returns number of errors (see Osi...
virtual void setRowUpper(int elementIndex, double elementValue)
Set a single row upper bound Use DBL_MAX for infinity.
virtual void setRowPrice(const double *rowprice)
Set dual solution vector.
OsiCbcSolverInterface(OsiSolverInterface *solver=NULL, CbcStrategy *strategy=NULL)
Default Constructor.
virtual void unmarkHotStart()
Delete the snapshot.
virtual const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
virtual void deleteRowNames(int tgtStart, int len)
Delete len row names starting at index tgtStart.
bool setStrParam(OsiStrParam key, const std::string &value)
virtual void applyColCut(const OsiColCut &cc)
Apply a column cut (adjust one or more bounds).
virtual OsiSolverInterface * clone(bool copyData=true) const
Clone.
virtual void setObjCoeff(int elementIndex, double elementValue)
Set an objective function coefficient.
virtual void passInMessageHandler(CoinMessageHandler *handler)
Pass in a message handler.
virtual CoinWarmStart * getWarmStart() const
Get warmstarting information.
virtual void solveFromHotStart()
Optimize starting from the hotstart.
virtual void setColUpper(int elementIndex, double elementValue)
Set a single column upper bound Use DBL_MAX for infinity.
virtual std::vector< double * > getDualRays(int maxNumRays, bool fullRay=false) const
Get as many dual rays as the solver can provide.
virtual const double * getRowActivity() const
Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vecto...
void newLanguage(CoinMessages::Language language)
Set language.
virtual bool isProvenDualInfeasible() const
Is dual infeasiblity proven?
void setMaximumSolutions(int value)
Set the CbcModel::CbcMaxNumSol maximum number of solutions.
virtual void setColNames(OsiNameVec &srcNames, int srcStart, int len, int tgtStart)
Set multiple column names.
virtual void writeMps(const char *filename, const char *extension="mps", double objSense=0.0) const
Write the problem into an mps file of the given filename.
virtual CoinWarmStart * getEmptyWarmStart() const
Get an empty warm start object.
int status() const
Final status of problem - 0 finished, 1 stopped, 2 difficulties.
virtual void setRowBounds(int elementIndex, double lower, double upper)
Set a single row lower and upper bound.
OsiCbcSolverInterface & operator=(const OsiCbcSolverInterface &rhs)
Assignment operator.
virtual bool isAbandoned() const
Are there a numerical difficulties?
bool isNodeLimitReached() const
Node limit reached?
virtual void markHotStart()
Create a hotstart point of the optimization process.
virtual int getNumCols() const
Get number of columns.
virtual double getInfinity() const
Get solver's value for infinity.
OsiSolverInterface * getRealSolverPtr() const
Get pointer to underlying solver.
bool setDblParam(OsiDblParam key, double value)
virtual void setRowName(int ndx, std::string name)
Set a row name.
virtual double getObjSense() const
Get objective function sense (1 for min (default), -1 for max)
virtual void addRow(const CoinPackedVectorBase &vec, const double rowlb, const double rowub)
void setLanguage(CoinMessages::Language language)
virtual void setRowLower(int elementIndex, double elementValue)
Set a single row lower bound Use -DBL_MAX for -infinity.
virtual const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
virtual bool isProvenPrimalInfeasible() const
Is primal infeasiblity proven?
CbcModel * modelPtr_
Cbc model represented by this class instance.
virtual void addRows(const int numrows, const CoinPackedVectorBase *const *rows, const double *rowlb, const double *rowub)
virtual std::string getColName(int colIndex, unsigned maxLen=std::string::npos) const
Return the name of the column.
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 const OsiNameVec & getColNames()
Return a pointer to a vector of column names.
virtual void setRowType(int index, char sense, double rightHandSide, double range)
Set the type of a single row
virtual const OsiNameVec & getRowNames()
Return a pointer to a vector of row names.
virtual void addCol(const CoinPackedVectorBase &vec, const double collb, const double colub, const double obj)
virtual const double * getRowPrice() const
Get pointer to array[getNumRows()] of dual prices.
virtual void setColSolution(const double *colsol)
Set the primal solution column values.
virtual std::string dfltRowColName(char rc, int ndx, unsigned digits=7) const
Generate a standard name of the form Rnnnnnnn or Cnnnnnnn.
bool getDblParam(OsiDblParam key, double &value) const
void setMaximumNodes(int value)
Set the CbcModel::CbcMaxNumNode maximum node limit.
virtual void setRowSetBounds(const int *indexFirst, const int *indexLast, const double *boundList)
Set the bounds on a number of rows simultaneously The default implementation just invokes setRowLowe...
virtual void setColBounds(int elementIndex, double lower, double upper)
Set a single column lower and upper bound.
virtual void deleteColNames(int tgtStart, int len)
Delete len column names starting at index tgtStart.