6 #ifndef OsiCbcSolverInterface_2_5_HPP 7 #define OsiCbcSolverInterface_2_5_HPP 12 #include "CbcModel.hpp" 13 #include "CoinPackedMatrix.hpp" 14 #include "OsiSolverInterface.hpp" 15 #include "CbcStrategy.hpp" 16 #include "CoinWarmStartBasis.hpp" 19 class OsiClpSolverInterface;
31 virtual public OsiSolverInterface {
71 bool getIntParam(OsiIntParam key,
int& value)
const;
73 bool getDblParam(OsiDblParam key,
double& 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);
274 virtual std::vector<double*>
getDualRays(
int maxNumRays)
const;
287 virtual std::vector<double*>
getPrimalRays(
int maxNumRays)
const;
303 int ndx,
unsigned digits = 7)
const ;
316 unsigned maxLen = std::string::npos)
const ;
329 int srcStart,
int len,
int tgtStart) ;
338 unsigned maxLen = std::string::npos)
const ;
351 int srcStart,
int len,
int tgtStart) ;
368 virtual void setObjCoeff(
int elementIndex,
double elementValue );
370 using OsiSolverInterface::setColLower ;
373 virtual void setColLower(
int elementIndex,
double elementValue );
375 using OsiSolverInterface::setColUpper ;
378 virtual void setColUpper(
int elementIndex,
double elementValue );
382 double lower,
double upper );
393 const int* indexLast,
394 const double* boundList);
398 virtual void setRowLower(
int elementIndex,
double elementValue );
402 virtual void setRowUpper(
int elementIndex,
double elementValue ) ;
406 double lower,
double upper ) ;
409 virtual void setRowType(
int index,
char sense,
double rightHandSide,
421 const int* indexLast,
422 const double* boundList);
435 const int* indexLast,
436 const char* senseList,
437 const double* rhsList,
438 const double* rangeList);
453 virtual void setInteger(
const int* indices,
int len);
489 using OsiSolverInterface::addCol ;
491 virtual void addCol(
const CoinPackedVectorBase& vec,
492 const double collb,
const double colub,
495 virtual void addCol(
int numberElements,
const int * rows,
const double * elements,
496 const double collb,
const double colub,
499 using OsiSolverInterface::addCols ;
501 virtual void addCols(
const int numcols,
502 const CoinPackedVectorBase *
const * cols,
503 const double* collb,
const double* colub,
506 virtual void deleteCols(
const int num,
const int * colIndices);
508 using OsiSolverInterface::addRow ;
510 virtual void addRow(
const CoinPackedVectorBase& vec,
511 const double rowlb,
const double rowub);
513 virtual void addRow(
const CoinPackedVectorBase& vec,
514 const char rowsen,
const double rowrhs,
515 const double rowrng);
517 using OsiSolverInterface::addRows ;
519 virtual void addRows(
const int numrows,
520 const CoinPackedVectorBase *
const * rows,
521 const double* rowlb,
const double* rowub);
523 virtual void addRows(
const int numrows,
524 const CoinPackedVectorBase *
const * rows,
525 const char* rowsen,
const double* rowrhs,
526 const double* rowrng);
528 virtual void deleteRows(
const int num,
const int * rowIndices);
534 virtual void applyRowCuts(
int numberCuts,
const OsiRowCut * cuts);
539 virtual void applyRowCuts(
int numberCuts,
const OsiRowCut ** cuts);
560 virtual void loadProblem(
const CoinPackedMatrix& matrix,
561 const double* collb,
const double* colub,
563 const double* rowlb,
const double* rowub);
573 double*& collb,
double*& colub,
double*& obj,
574 double*& rowlb,
double*& rowub);
588 virtual void loadProblem(
const CoinPackedMatrix& matrix,
589 const double* collb,
const double* colub,
591 const char* rowsen,
const double* rowrhs,
592 const double* rowrng);
602 double*& collb,
double*& colub,
double*& obj,
603 char*& rowsen,
double*& rowrhs,
608 virtual void loadProblem(
const int numcols,
const int numrows,
609 const CoinBigIndex * start,
const int* index,
611 const double* collb,
const double* colub,
613 const double* rowlb,
const double* rowub);
617 virtual void loadProblem(
const int numcols,
const int numrows,
618 const CoinBigIndex * start,
const int* index,
620 const double* collb,
const double* colub,
622 const char* rowsen,
const double* rowrhs,
623 const double* rowrng);
625 using OsiSolverInterface::readMps ;
628 virtual int readMps(
const char *filename,
629 const char *extension =
"mps") ;
635 virtual void writeMps(
const char *filename,
636 const char *extension =
"mps",
637 double objSense=0.0)
const;
647 const char ** rowNames,
const char ** columnNames,
648 int formatType=0,
int numberAcross=2,
649 double objSense=0.0)
const ;
685 {
agentPtr_->setMaximumSolutions(value);}
688 {
return agentPtr_->getMaximumSolutions();}
694 {
return agentPtr_->getMaximumSeconds();}
697 {
return agentPtr_->isNodeLimitReached();}
700 {
return agentPtr_->isSolutionLimitReached();}
722 CbcStrategy * strategy=NULL);
725 virtual OsiSolverInterface *
clone(
bool copyData =
true)
const;
void setMaximumNodes(int value)
Set the CbcModel::CbcMaxNumNode maximum node limit.
virtual bool isProvenDualInfeasible() const
Is dual infeasiblity proven?
virtual void setObjName(std::string name)
Set the name of the objective function.
virtual void applyRowCuts(int numberCuts, const OsiRowCut *cuts)
Apply a collection of row cuts which are all effective.
virtual void setColUpper(int elementIndex, double elementValue)
Set a single column upper bound Use DBL_MAX for infinity.
friend void OsiCbcSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir)
A function that tests the methods in the OsiCbcSolverInterface class.
virtual int getIterationCount() const
Get how many iterations it took to solve the problem (whatever "iteration" mean to the solver...
virtual void resolve()
Resolve an LP relaxation after problem modification.
CbcModel * agentPtr_
Cbc agent represented by this class instance.
bool isNodeLimitReached() const
Node limit reached?
virtual void setRowLower(int elementIndex, double elementValue)
Set a single row lower bound Use -DBL_MAX for -infinity.
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 addRows(const int numrows, const CoinPackedVectorBase *const *rows, const double *rowlb, const double *rowub)
virtual const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of matrix.
virtual void addCol(const CoinPackedVectorBase &vec, const double collb, const double colub, const double obj)
virtual const double * getColSolution() const
Get pointer to array[getNumCols()] of primal solution vector.
virtual void deleteCols(const int num, const int *colIndices)
virtual void markHotStart()
Create a hotstart point of the optimization process.
virtual const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
virtual bool setHintParam(OsiHintParam key, bool yesNo=true, OsiHintStrength strength=OsiHintTry, void *otherInformation=NULL)
bool getIntParam(OsiIntParam key, int &value) const
virtual void initialSolve()
Solve initial LP relaxation.
void setLanguage(CoinMessages::Language language)
virtual void setColBounds(int elementIndex, double lower, double upper)
Set a single column lower and upper bound.
virtual const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of matrix.
virtual const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
int status() const
Final status of problem - 0 finished, 1 stopped, 2 difficulties.
virtual void passInMessageHandler(CoinMessageHandler *handler)
Pass in a message handler.
virtual void setRowPrice(const double *rowprice)
Set dual solution vector.
virtual std::string getRowName(int rowIndex, unsigned maxLen=std::string::npos) const
Return the name of the row.
virtual const double * getReducedCost() const
Get a pointer to array[getNumCols()] of reduced costs.
virtual OsiSolverInterface * clone(bool copyData=true) const
Clone.
virtual void setRowType(int index, char sense, double rightHandSide, double range)
Set the type of a single row
virtual std::vector< double * > getDualRays(int maxNumRays) const
Get as many dual rays as the solver can provide.
std::string name(int nuc)
virtual const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
virtual const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
virtual bool isPrimalObjectiveLimitReached() const
Is the given primal objective limit reached?
virtual bool getHintParam(OsiHintParam key, bool &yesNo, OsiHintStrength &strength, void *&otherInformation) const
Get a hint parameter.
virtual void setObjSense(double s)
Set objective function sense (1 for min (default), -1 for max,)
virtual void addRow(const CoinPackedVectorBase &vec, const double rowlb, const double rowub)
virtual double getInfinity() const
Get solver's value for infinity.
virtual std::string getObjName(unsigned maxLen=std::string::npos) const
Return the name of the objective function.
bool isSolutionLimitReached() const
Solution limit reached?
virtual const OsiNameVec & getRowNames()
Return a pointer to a vector of row names.
double getMaximumSeconds() const
Get the CbcModel::CbcMaximumSeconds maximum number of seconds.
void setMaximumSeconds(double value)
Set the CbcModel::CbcMaximumSeconds maximum number of seconds.
virtual void deleteRowNames(int tgtStart, int len)
Delete len row names starting at index tgtStart.
CbcModel * getAgentPtr() const
Get pointer to Cbc agent.
bool getDblParam(OsiDblParam key, double &value) const
bool getStrParam(OsiStrParam key, std::string &value) const
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...
int getNodeCount() const
Get how many Nodes it took to solve the problem.
virtual int getNumElements() const
Get number of nonzero elements.
double getCutoff() const
Get the cutoff bound on the objective function - always as minimize.
static const double OsiCbcInfinity
virtual void applyRowCut(const OsiRowCut &rc)
Apply a row cut (append to constraint matrix).
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 setColNames(OsiNameVec &srcNames, int srcStart, int len, int tgtStart)
Set multiple column names.
virtual int getNumRows() const
Get number of rows.
virtual void applyColCut(const OsiColCut &cc)
Apply a column cut (adjust one or more bounds).
virtual const double * getRowActivity() const
Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vecto...
virtual bool isProvenPrimalInfeasible() const
Is primal infeasiblity proven?
virtual ~OsiCbcSolverInterface()
Destructor.
int getMaximumSolutions() const
Get the CbcModel::CbcMaxNumSol maximum number of solutions.
OsiSolverInterface * getRealSolverPtr() const
Get pointer to underlying solver.
bool setStrParam(OsiStrParam key, const std::string &value)
virtual void solveFromHotStart()
Optimize starting from the hotstart.
virtual bool isAbandoned() const
Are there a numerical difficulties?
virtual void deleteColNames(int tgtStart, int len)
Delete len column names starting at index tgtStart.
int getMaximumNodes() const
Get the CbcModel::CbcMaxNumNode maximum node limit.
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...
OsiCbcSolverInterface(OsiSolverInterface *solver=NULL, CbcStrategy *strategy=NULL)
Default Constructor.
virtual double getObjValue() const
Get objective function value.
virtual bool setWarmStart(const CoinWarmStart *warmstart)
Set warmstarting information.
virtual void branchAndBound()
Invoke solver's built-in enumeration algorithm.
virtual double getObjSense() const
Get objective function sense (1 for min (default), -1 for max)
virtual void setColSolution(const double *colsol)
Set the primal solution column values.
static std::string digits
string of digit characters
virtual const OsiNameVec & getColNames()
Return a pointer to a vector of column names.
virtual void setColLower(int elementIndex, double elementValue)
Set a single column lower bound Use -DBL_MAX for -infinity.
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 setRowBounds(int elementIndex, double lower, double upper)
Set a single row lower and upper bound.
virtual void deleteRows(const int num, const int *rowIndices)
virtual bool isDualObjectiveLimitReached() const
Is the given dual objective limit reached?
virtual CoinWarmStart * getWarmStart() const
Get warmstarting information.
virtual bool isProvenOptimal() const
Is optimality proven?
virtual void addCols(const int numcols, const CoinPackedVectorBase *const *cols, const double *collb, const double *colub, const double *obj)
virtual std::string dfltRowColName(char rc, int ndx, unsigned digits=7) const
Generate a standard name of the form Rnnnnnnn or Cnnnnnnn.
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 setRowNames(OsiNameVec &srcNames, int srcStart, int len, int tgtStart)
Set multiple row names.
virtual void setRowName(int ndx, std::string name)
Set a row name.
virtual const double * getRightHandSide() const
Get pointer to array[getNumRows()] of rows right-hand sides.
virtual void setRowUpper(int elementIndex, double elementValue)
Set a single row upper bound Use DBL_MAX for infinity.
virtual int getNumCols() const
Get number of columns.
bool setIntParam(OsiIntParam key, int value)
virtual void unmarkHotStart()
Delete the snapshot.
virtual void setObjCoeff(int elementIndex, double elementValue)
Set an objective function coefficient.
virtual const double * getRowPrice() const
Get pointer to array[getNumRows()] of dual prices.
virtual bool isContinuous(int colNumber) const
Return true if column is continuous.
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.
void setMaximumSolutions(int value)
Set the CbcModel::CbcMaxNumSol maximum number of solutions.
virtual void setColName(int ndx, std::string name)
Set a column name.
virtual bool isIterationLimitReached() const
Iteration limit reached?
virtual void setInteger(int index)
Set the index-th variable to be an integer variable.
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.
void newLanguage(CoinMessages::Language language)
Set language.
virtual const char * getRowSense() const
Get pointer to array[getNumRows()] of row constraint senses.
virtual CoinWarmStart * getEmptyWarmStart() const
Get an empty warm start object.
OsiCbcSolverInterface & operator=(const OsiCbcSolverInterface &rhs)
Assignment operator.
void setCutoff(double value)
Set cutoff bound on the objective function.
virtual const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
bool setDblParam(OsiDblParam key, double value)
virtual void setContinuous(int index)
Set the index-th variable to be a continuous variable.
virtual std::vector< double * > getPrimalRays(int maxNumRays) const
Get as many primal rays as the solver can provide.
virtual const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.