6 #ifndef OsiCbcSolverInterface_H
7 #define OsiCbcSolverInterface_H
78 void *otherInformation = NULL);
82 void *&otherInformation)
const;
269 virtual std::vector< double * >
getDualRays(
int maxNumRays,
270 bool fullRay =
false)
const;
282 virtual std::vector< double * >
getPrimalRays(
int maxNumRays)
const;
298 int ndx,
unsigned digits = 7)
const;
302 virtual std::string
getObjName(
unsigned maxLen = std::string::npos)
const;
311 unsigned maxLen = std::string::npos)
const;
319 virtual void setRowName(
int ndx, std::string name);
324 int srcStart,
int len,
int tgtStart);
333 unsigned maxLen = std::string::npos)
const;
341 virtual void setColName(
int ndx, std::string name);
346 int srcStart,
int len,
int tgtStart);
363 virtual void setObjCoeff(
int elementIndex,
double elementValue);
368 virtual void setColLower(
int elementIndex,
double elementValue);
373 virtual void setColUpper(
int elementIndex,
double elementValue);
377 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);
401 double lower,
double upper);
404 virtual void setRowType(
int index,
char sense,
double rightHandSide,
416 const int *indexLast,
417 const double *boundList);
430 const int *indexLast,
431 const char *senseList,
432 const double *rhsList,
433 const double *rangeList);
448 virtual void setInteger(
const int *indices,
int len);
487 const double collb,
const double colub,
490 virtual void addCol(
int numberElements,
const int *rows,
const double *elements,
491 const double collb,
const double colub,
496 virtual void addCols(
const int numcols,
498 const double *collb,
const double *colub,
501 virtual void deleteCols(
const int num,
const int *colIndices);
506 const double rowlb,
const double rowub);
509 const char rowsen,
const double rowrhs,
510 const double rowrng);
514 virtual void addRows(
const int numrows,
516 const double *rowlb,
const double *rowub);
518 virtual void addRows(
const int numrows,
520 const char *rowsen,
const double *rowrhs,
521 const double *rowrng);
523 virtual void deleteRows(
const int num,
const int *rowIndices);
555 const double *collb,
const double *colub,
557 const double *rowlb,
const double *rowub);
567 double *&collb,
double *&colub,
double *&obj,
568 double *&rowlb,
double *&rowub);
583 const double *collb,
const double *colub,
585 const char *rowsen,
const double *rowrhs,
586 const double *rowrng);
596 double *&collb,
double *&colub,
double *&obj,
597 char *&rowsen,
double *&rowrhs,
602 virtual void loadProblem(
const int numcols,
const int numrows,
605 const double *collb,
const double *colub,
607 const double *rowlb,
const double *rowub);
611 virtual void loadProblem(
const int numcols,
const int numrows,
614 const double *collb,
const double *colub,
616 const char *rowsen,
const double *rowrhs,
617 const double *rowrng);
622 virtual int readMps(
const char *filename,
623 const char *extension =
"mps");
629 virtual void writeMps(
const char *filename,
630 const char *extension =
"mps",
631 double objSense = 0.0)
const;
641 const char **rowNames,
const char **columnNames,
642 int formatType = 0,
int numberAcross = 2,
643 double objSense = 0.0)
const;
virtual const double * getColSolution() const
Get pointer to array[getNumCols()] of primal solution vector.
int getNodeCount() const
Get how many Nodes it took to solve the problem.
void setMaximumSeconds(double value)
Set the CbcModel::CbcMaximumSeconds maximum number of seconds.
bool isNodeLimitReached() const
Node limit reached?
virtual void setRowName(int ndx, std::string name)
Set a row name.
bool getIntParam(OsiIntParam key, int &value) const
Get a hint parameter.
friend void OsiCbcSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir)
A function that tests the methods in the OsiCbcSolverInterface class.
virtual void setColLower(int elementIndex, double elementValue)=0
Set a single column lower bound.
virtual void setRowBounds(int elementIndex, double lower, double upper)
Set a single row lower and upper bound.
virtual double getInfinity() const
Get solver's value for infinity.
virtual bool isProvenDualInfeasible() const
Is dual infeasiblity proven?
int getMaximumNodes() const
Get the maximum node limit .
virtual CoinBigIndex getNumElements() const
Get number of nonzero elements.
virtual void applyRowCut(const OsiRowCut &rc)
Apply a row cut (append to constraint matrix).
int status() const
Final status of problem - 0 finished, 1 stopped, 2 difficulties.
virtual void addCol(const CoinPackedVectorBase &vec, const double collb, const double colub, const double obj)
Add a column (primal variable) to the problem.
bool getDblParam(OsiDblParam key, double &value) const
Get a hint parameter.
Base class for message handling.
bool isSolutionLimitReached() const
Solution limit reached?
OsiSolverInterface * solver() const
Returns solver - has current state.
bool setMaximumNodes(int value)
Set the maximum node limit .
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 void setColBounds(int elementIndex, double lower, double upper)
Set a single column lower and upper bound.
virtual void setObjName(std::string name)
Set the name of the objective function.
virtual void addCol(const CoinPackedVectorBase &vec, const double collb, const double colub, const double obj)=0
Add a column (primal variable) to the problem.
CbcModel * getModelPtr() const
Get pointer to Cbc model.
virtual const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
virtual CoinWarmStart * getEmptyWarmStart() const
Get an empty warm start object.
virtual bool setWarmStart(const CoinWarmStart *warmstart)
Set warmstarting information.
virtual void resolve()
Resolve an LP relaxation after problem modification.
virtual void deleteColNames(int tgtStart, int len)
Delete len column names starting at index tgtStart.
bool setStrParam(OsiStrParam key, const std::string &value)
Get a hint parameter.
int getMaximumNodes() const
Get the CbcModel::CbcMaxNumNode maximum node limit.
virtual const double * getReducedCost() const
Get a pointer to array[getNumCols()] of reduced costs.
virtual void deleteRows(const int num, const int *rowIndices)
Add a column (primal variable) to the problem.
virtual const OsiNameVec & getColNames()
Return a pointer to a vector of column names.
virtual int getNumRows() const
Get number of rows.
bool isSolutionLimitReached() const
Solution limit reached?
virtual bool isContinuous(int colNumber) const
Return true if column is continuous.
Sparse Matrix Base Class.
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)
Get a hint parameter.
void setMaximumSolutions(int value)
Set the CbcModel::CbcMaxNumSol maximum number of solutions.
virtual double getObjSense() const
Get objective function sense (1 for min (default), -1 for max)
virtual void setColNames(OsiNameVec &srcNames, int srcStart, int len, int tgtStart)
Set multiple column names.
virtual void setInteger(int index)
Set the index-th variable to be an integer variable.
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...
OsiCbcSolverInterface & operator=(const OsiCbcSolverInterface &rhs)
Assignment operator.
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 int readMps(const char *filename, const char *extension="mps")
Read a problem in MPS format from the given filename.
virtual void setColUpper(int elementIndex, double elementValue)=0
Set a single column upper bound.
virtual std::vector< double * > getDualRays(int maxNumRays, bool fullRay=false) const
Get as many dual rays as the solver can provide.
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...
virtual void setColSolution(const double *colsol)
Set the primal solution column values.
Abstract base class for various sparse vectors.
virtual const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
void setCutoff(double value)
Set cutoff bound on the objective function.
int getMaximumSolutions() const
Get the maximum number of solutions desired.
virtual void markHotStart()
Create a hotstart point of the optimization process.
double getCutoff() const
Get the cutoff bound on the objective function - always as minimize.
virtual void applyColCut(const OsiColCut &cc)
Apply a column cut (adjust one or more bounds).
virtual void setRowType(int index, char sense, double rightHandSide, double range)
Set the type of a single row
virtual void addRow(const CoinPackedVectorBase &vec, const double rowlb, const double rowub)
Add a column (primal variable) to the problem.
virtual const OsiNameVec & getRowNames()
Return a pointer to a vector of row names.
bool setMaximumSeconds(double value)
Set the maximum number of seconds desired.
virtual bool isIterationLimitReached() const
Iteration limit reached?
virtual void addCols(const int numcols, const CoinPackedVectorBase *const *cols, const double *collb, const double *colub, const double *obj)
Add a column (primal variable) to the problem.
virtual bool isProvenPrimalInfeasible() const
Is primal infeasiblity proven?
virtual void addCols(const int numcols, const CoinPackedVectorBase *const *cols, const double *collb, const double *colub, const double *obj)
Add a set of columns (primal variables) to the problem.
int getMaximumSolutions() const
Get the CbcModel::CbcMaxNumSol maximum number of solutions.
virtual std::string getObjName(unsigned maxLen=std::string::npos) const
Return the name of the objective function.
double getCutoff() const
Get the cutoff bound on the objective function - always as minimize.
int getNodeCount() const
Get how many Nodes it took to solve the problem (including those in complete fathoming B&B inside CLP...
virtual void setRowLower(int elementIndex, double elementValue)
Set a single row lower bound Use -DBL_MAX for -infinity.
bool setDblParam(OsiDblParam key, double value)
Get a hint parameter.
virtual ~OsiCbcSolverInterface()
Destructor.
virtual void addRows(const int numrows, const CoinPackedVectorBase *const *rows, const double *rowlb, const double *rowub)
void setMaximumNodes(int value)
Set the CbcModel::CbcMaxNumNode maximum node limit.
void OsiCbcSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir)
A function that tests the methods in the OsiCbcSolverInterface class.
virtual std::string getRowName(int rowIndex, unsigned maxLen=std::string::npos) const
Return the name of the row.
virtual bool isDualObjectiveLimitReached() const
Is the given dual objective limit reached?
bool isNodeLimitReached() const
Node limit reached?
OsiCbcSolverInterface(OsiSolverInterface *solver=NULL, CbcStrategy *strategy=NULL)
Default Constructor.
std::vector< std::string > OsiNameVec
Data type for name vectors.
Abstract Base Class for describing an interface to a solver.
virtual const double * getRightHandSide() const
Get pointer to array[getNumRows()] of rows right-hand sides.
virtual bool isProvenOptimal() const
Is optimality proven?
virtual void setRowPrice(const double *rowprice)
Set dual solution vector.
bool setMaximumSolutions(int value)
Set the maximum number of solutions desired.
bool getStrParam(OsiStrParam key, std::string &value) const
Get a hint parameter.
const double COIN_DBL_MAX
OsiSolverInterface * getRealSolverPtr() const
Get pointer to underlying solver.
virtual void setContinuous(int index)
Set the index-th variable to be a continuous variable.
virtual const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
bool setIntParam(OsiIntParam key, int value)
Get a hint parameter.
virtual void setColUpper(int elementIndex, double elementValue)
Set a single column upper bound Use DBL_MAX for infinity.
virtual void initialSolve()
Solve initial LP relaxation.
virtual int getNumCols() const
Get number of columns.
virtual double getObjValue() const
Get objective function value.
virtual void addRow(const CoinPackedVectorBase &vec, const double rowlb, const double rowub)=0
Add a row (constraint) to the problem.
Abstract base class for warm start information.
virtual void deleteRowNames(int tgtStart, int len)
Delete len row names starting at index tgtStart.
virtual OsiSolverInterface * clone(bool copyData=true) const
Clone.
void setCutoff(double value)
Set cutoff bound on the objective function.
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 double * getRowPrice() const
Get pointer to array[getNumRows()] of dual prices.
virtual void setColLower(int elementIndex, double elementValue)
Set a single column lower bound Use -DBL_MAX for -infinity.
void setLanguage(CoinMessages::Language language)
Set language.
virtual CoinWarmStart * getWarmStart() const
Get warmstarting information.
virtual bool getHintParam(OsiHintParam key, bool &yesNo, OsiHintStrength &strength, void *&otherInformation) const
Get a hint parameter (all information)
virtual void unmarkHotStart()
Delete the snapshot.
double getMaximumSeconds() const
Get the CbcModel::CbcMaximumSeconds maximum number of seconds.
virtual void addRows(const int numrows, const CoinPackedVectorBase *const *rows, const double *rowlb, const double *rowub)
Add a column (primal variable) to the problem.
int status() const
Final status of problem Some of these can be found out by is......
virtual void branchAndBound()
Invoke solver's built-in enumeration algorithm.
virtual void passInMessageHandler(CoinMessageHandler *handler)
Pass in a message handler.
virtual const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
static const double OsiCbcInfinity
virtual void setRowUpper(int elementIndex, double elementValue)
Set a single row upper bound Use DBL_MAX for infinity.
virtual std::string getColName(int colIndex, unsigned maxLen=std::string::npos) const
Return the name of the column.
CbcModel * modelPtr_
Cbc model represented by this class instance.
virtual const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
virtual int getIterationCount() const
Get how many iterations it took to solve the problem (whatever "iteration" mean to the solver...
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...
This means it is only a hint.
virtual bool getHintParam(OsiHintParam key, bool &yesNo, OsiHintStrength &strength, void *&otherInformation) const
Get a hint parameter.
virtual void solveFromHotStart()
Optimize starting from the hotstart.
void newLanguage(CoinMessages::Language language)
Set language.
double getMaximumSeconds() const
Get the maximum number of seconds desired.
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 const double * getRowActivity() const
Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vecto...
virtual const char * getRowSense() const
Get pointer to array[getNumRows()] of row constraint senses.
virtual bool isAbandoned() const
Are there a numerical difficulties?
virtual bool isPrimalObjectiveLimitReached() const
Is the given primal objective limit reached?
virtual void setObjCoeff(int elementIndex, double elementValue)
Set an objective function coefficient.
virtual void setRowNames(OsiNameVec &srcNames, int srcStart, int len, int tgtStart)
Set multiple row names.
Language
Supported languages.
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 const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
virtual std::vector< double * > getPrimalRays(int maxNumRays) const
Get as many primal rays as the solver can provide.
virtual void deleteCols(const int num, const int *colIndices)
Add a column (primal variable) to the problem.
Simple Branch and bound class.
virtual void applyRowCuts(int numberCuts, const OsiRowCut *cuts)
Apply a collection of row cuts which are all effective.
virtual void setObjSense(double s)
Set objective function sense (1 for min (default), -1 for max,)
virtual void setColName(int ndx, std::string name)
Set a column name.
virtual const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of matrix.
virtual std::string dfltRowColName(char rc, int ndx, unsigned digits=7) const
Generate a standard name of the form Rnnnnnnn or Cnnnnnnn.