Cbc  2.9.9
OsiCbcSolverInterface.hpp
Go to the documentation of this file.
1 // $Id: OsiCbcSolverInterface.hpp 1899 2013-04-09 18:12:08Z stefan $
2 // Copyright (C) 2000, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5 
6 #ifndef OsiCbcSolverInterface_H
7 #define OsiCbcSolverInterface_H
8 
9 #include <string>
10 #include <cfloat>
11 #include <map>
12 #include "CbcModel.hpp"
13 #include "CoinPackedMatrix.hpp"
14 #include "OsiSolverInterface.hpp"
15 #include "CbcStrategy.hpp"
16 #include "CoinWarmStartBasis.hpp"
17 
18 class OsiRowCut;
19 class OsiClpSolverInterface;
20 static const double OsiCbcInfinity = COIN_DBL_MAX;
21 
22 //#############################################################################
23 
31  virtual public OsiSolverInterface {
32  friend void OsiCbcSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir);
33 
34 public:
35  //---------------------------------------------------------------------------
38  virtual void initialSolve();
40 
42  virtual void resolve();
43 
45  virtual void branchAndBound();
47 
48  //---------------------------------------------------------------------------
64  // Set an integer parameter
65  bool setIntParam(OsiIntParam key, int value);
66  // Set an double parameter
67  bool setDblParam(OsiDblParam key, double value);
68  // Set a string parameter
69  bool setStrParam(OsiStrParam key, const std::string & value);
70  // Get an integer parameter
71  bool getIntParam(OsiIntParam key, int& value) const;
72  // Get an double parameter
73  bool getDblParam(OsiDblParam key, double& value) const;
74  // Get a string parameter
75  bool getStrParam(OsiStrParam key, std::string& value) const;
76  // Set a hint parameter - overrides OsiSolverInterface
77  virtual bool setHintParam(OsiHintParam key, bool yesNo=true,
78  OsiHintStrength strength=OsiHintTry,
79  void * otherInformation=NULL);
81  virtual bool getHintParam(OsiHintParam key, bool& yesNo,
82  OsiHintStrength& strength,
83  void *& otherInformation) const;
84 
85  using OsiSolverInterface::getHintParam ;
87  virtual bool getHintParam(OsiHintParam key, bool& yesNo,
88  OsiHintStrength& strength) const;
90 
91  //---------------------------------------------------------------------------
93 
94  virtual bool isAbandoned() const;
97  virtual bool isProvenOptimal() const;
99  virtual bool isProvenPrimalInfeasible() const;
101  virtual bool isProvenDualInfeasible() const;
103  virtual bool isPrimalObjectiveLimitReached() const;
105  virtual bool isDualObjectiveLimitReached() const;
107  virtual bool isIterationLimitReached() const;
109 
110  //---------------------------------------------------------------------------
113 
121  virtual CoinWarmStart *getEmptyWarmStart () const;
122 
124  virtual CoinWarmStart* getWarmStart() const;
127  virtual bool setWarmStart(const CoinWarmStart* warmstart);
129 
130  //---------------------------------------------------------------------------
137  virtual void markHotStart();
140  virtual void solveFromHotStart();
142  virtual void unmarkHotStart();
144 
145  //---------------------------------------------------------------------------
160  virtual int getNumCols() const;
162 
164  virtual int getNumRows() const;
165 
167  virtual int getNumElements() const ;
168 
170  virtual const double * getColLower() const;
171 
173  virtual const double * getColUpper() const;
174 
184  virtual const char * getRowSense() const;
185 
194  virtual const double * getRightHandSide() const ;
195 
204  virtual const double * getRowRange() const ;
205 
207  virtual const double * getRowLower() const ;
208 
210  virtual const double * getRowUpper() const ;
211 
213  virtual const double * getObjCoefficients() const;
214 
216  virtual double getObjSense() const ;
217 
219  virtual bool isContinuous(int colNumber) const;
220 
221 
223  virtual const CoinPackedMatrix * getMatrixByRow() const;
224 
226  virtual const CoinPackedMatrix * getMatrixByCol() const;
227 
229  virtual double getInfinity() const;
231 
234  virtual const double * getColSolution() const;
236 
238  virtual const double * getRowPrice() const;
239 
241  virtual const double * getReducedCost() const;
242 
245  virtual const double * getRowActivity() const;
246 
248  virtual double getObjValue() const;
249 
252  virtual int getIterationCount() const ;
253 
271  virtual std::vector<double*> getDualRays(int maxNumRays,
272  bool fullRay = false) const;
284  virtual std::vector<double*> getPrimalRays(int maxNumRays) const;
285 
287 
296 
299  virtual std::string dfltRowColName(char rc,
300  int ndx, unsigned digits = 7) const ;
301 
304  virtual std::string getObjName (unsigned maxLen = std::string::npos) const ;
305 
308  virtual void setObjName (std::string name) ;
309 
312  virtual std::string getRowName(int rowIndex,
313  unsigned maxLen = std::string::npos) const ;
314 
317  virtual const OsiNameVec &getRowNames() ;
318 
321  virtual void setRowName(int ndx, std::string name) ;
322 
325  virtual void setRowNames(OsiNameVec &srcNames,
326  int srcStart, int len, int tgtStart) ;
327 
330  virtual void deleteRowNames(int tgtStart, int len) ;
331 
334  virtual std::string getColName(int colIndex,
335  unsigned maxLen = std::string::npos) const ;
336 
339  virtual const OsiNameVec &getColNames() ;
340 
343  virtual void setColName(int ndx, std::string name) ;
344 
347  virtual void setColNames(OsiNameVec &srcNames,
348  int srcStart, int len, int tgtStart) ;
349 
351  virtual void deleteColNames(int tgtStart, int len) ;
352 
354 
356 
357  //---------------------------------------------------------------------------
358 
361  //-------------------------------------------------------------------------
365  virtual void setObjCoeff( int elementIndex, double elementValue );
366 
367  using OsiSolverInterface::setColLower ;
370  virtual void setColLower( int elementIndex, double elementValue );
371 
372  using OsiSolverInterface::setColUpper ;
375  virtual void setColUpper( int elementIndex, double elementValue );
376 
378  virtual void setColBounds( int elementIndex,
379  double lower, double upper );
380 
389  virtual void setColSetBounds(const int* indexFirst,
390  const int* indexLast,
391  const double* boundList);
392 
395  virtual void setRowLower( int elementIndex, double elementValue );
396 
399  virtual void setRowUpper( int elementIndex, double elementValue ) ;
400 
402  virtual void setRowBounds( int elementIndex,
403  double lower, double upper ) ;
404 
406  virtual void setRowType(int index, char sense, double rightHandSide,
407  double range);
408 
417  virtual void setRowSetBounds(const int* indexFirst,
418  const int* indexLast,
419  const double* boundList);
420 
431  virtual void setRowSetTypes(const int* indexFirst,
432  const int* indexLast,
433  const char* senseList,
434  const double* rhsList,
435  const double* rangeList);
437 
438  //-------------------------------------------------------------------------
442  virtual void setContinuous(int index);
444  virtual void setInteger(int index);
447  virtual void setContinuous(const int* indices, int len);
450  virtual void setInteger(const int* indices, int len);
452 
453  //-------------------------------------------------------------------------
455  virtual void setObjSense(double s );
456 
467  virtual void setColSolution(const double * colsol);
468 
479  virtual void setRowPrice(const double * rowprice);
480 
481  //-------------------------------------------------------------------------
486  using OsiSolverInterface::addCol ;
488  virtual void addCol(const CoinPackedVectorBase& vec,
489  const double collb, const double colub,
490  const double obj);
492  virtual void addCol(int numberElements, const int * rows, const double * elements,
493  const double collb, const double colub,
494  const double obj) ;
495 
496  using OsiSolverInterface::addCols ;
498  virtual void addCols(const int numcols,
499  const CoinPackedVectorBase * const * cols,
500  const double* collb, const double* colub,
501  const double* obj);
503  virtual void deleteCols(const int num, const int * colIndices);
504 
505  using OsiSolverInterface::addRow ;
507  virtual void addRow(const CoinPackedVectorBase& vec,
508  const double rowlb, const double rowub);
510  virtual void addRow(const CoinPackedVectorBase& vec,
511  const char rowsen, const double rowrhs,
512  const double rowrng);
513 
514  using OsiSolverInterface::addRows ;
516  virtual void addRows(const int numrows,
517  const CoinPackedVectorBase * const * rows,
518  const double* rowlb, const double* rowub);
520  virtual void addRows(const int numrows,
521  const CoinPackedVectorBase * const * rows,
522  const char* rowsen, const double* rowrhs,
523  const double* rowrng);
525  virtual void deleteRows(const int num, const int * rowIndices);
526 
527  //-----------------------------------------------------------------------
531  virtual void applyRowCuts(int numberCuts, const OsiRowCut * cuts);
536  virtual void applyRowCuts(int numberCuts, const OsiRowCut ** cuts);
538 
539 
540  //---------------------------------------------------------------------------
541 
542 public:
543 
557  virtual void loadProblem(const CoinPackedMatrix& matrix,
558  const double* collb, const double* colub,
559  const double* obj,
560  const double* rowlb, const double* rowub);
561 
569  virtual void assignProblem(CoinPackedMatrix*& matrix,
570  double*& collb, double*& colub, double*& obj,
571  double*& rowlb, double*& rowub);
572 
585  virtual void loadProblem(const CoinPackedMatrix& matrix,
586  const double* collb, const double* colub,
587  const double* obj,
588  const char* rowsen, const double* rowrhs,
589  const double* rowrng);
590 
598  virtual void assignProblem(CoinPackedMatrix*& matrix,
599  double*& collb, double*& colub, double*& obj,
600  char*& rowsen, double*& rowrhs,
601  double*& rowrng);
602 
605  virtual void loadProblem(const int numcols, const int numrows,
606  const CoinBigIndex * start, const int* index,
607  const double* value,
608  const double* collb, const double* colub,
609  const double* obj,
610  const double* rowlb, const double* rowub);
611 
614  virtual void loadProblem(const int numcols, const int numrows,
615  const CoinBigIndex * start, const int* index,
616  const double* value,
617  const double* collb, const double* colub,
618  const double* obj,
619  const char* rowsen, const double* rowrhs,
620  const double* rowrng);
621 
622  using OsiSolverInterface::readMps ;
625  virtual int readMps(const char *filename,
626  const char *extension = "mps") ;
627 
632  virtual void writeMps(const char *filename,
633  const char *extension = "mps",
634  double objSense=0.0) const;
643  virtual int writeMpsNative(const char *filename,
644  const char ** rowNames, const char ** columnNames,
645  int formatType=0,int numberAcross=2,
646  double objSense=0.0) const ;
648 
653  void newLanguage(CoinMessages::Language language);
655  void setLanguage(CoinMessages::Language language)
656  {newLanguage(language);}
658  //---------------------------------------------------------------------------
659 
662  inline CbcModel * getModelPtr() const
664  { return modelPtr_;}
666  inline OsiSolverInterface * getRealSolverPtr() const
667  { return modelPtr_->solver();}
669  inline void setCutoff(double value)
670  { modelPtr_->setCutoff(value);}
672  inline double getCutoff() const
673  { return modelPtr_->getCutoff();}
675  inline void setMaximumNodes( int value)
676  { modelPtr_->setMaximumNodes(value);}
678  inline int getMaximumNodes() const
679  { return modelPtr_->getMaximumNodes();}
681  inline void setMaximumSolutions( int value)
682  { modelPtr_->setMaximumSolutions(value);}
684  inline int getMaximumSolutions() const
685  { return modelPtr_->getMaximumSolutions();}
687  inline void setMaximumSeconds( double value)
688  { modelPtr_->setMaximumSeconds(value);}
690  inline double getMaximumSeconds() const
691  { return modelPtr_->getMaximumSeconds();}
693  inline bool isNodeLimitReached() const
694  { return modelPtr_->isNodeLimitReached();}
696  inline bool isSolutionLimitReached() const
697  { return modelPtr_->isSolutionLimitReached();}
699  inline int getNodeCount() const
700  { return modelPtr_->getNodeCount();}
702  inline int status() const
703  { return modelPtr_->status();}
710  virtual void passInMessageHandler(CoinMessageHandler * handler);
712 
713  //---------------------------------------------------------------------------
714 
717  OsiCbcSolverInterface (OsiSolverInterface * solver=NULL,
719  CbcStrategy * strategy=NULL);
720 
722  virtual OsiSolverInterface * clone(bool copyData = true) const;
723 
726 #if 0
727  OsiCbcSolverInterface (CbcModel * rhs, bool reallyOwn=false);
729 
731  void releaseCbc();
732 #endif
735 
738 
740  //---------------------------------------------------------------------------
741 
742 protected:
744 
745 
746  virtual void applyRowCut(const OsiRowCut& rc);
747 
749  virtual void applyColCut(const OsiColCut& cc);
751 
753  mutable CbcModel * modelPtr_;
756 };
757 // So unit test can find out if NDEBUG set
759 
760 //#############################################################################
762 void OsiCbcSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir);
763 
764 #endif
OsiCbcSolverInterface::getRowLower
virtual const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
OsiCbcSolverInterface::assignProblem
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...
OsiCbcSolverInterface::setMaximumSolutions
void setMaximumSolutions(int value)
Set the CbcModel::CbcMaxNumSol maximum number of solutions.
Definition: OsiCbcSolverInterface.hpp:681
OsiCbcSolverInterface::setRowSetTypes
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()...
OsiCbcHasNDEBUG
bool OsiCbcHasNDEBUG()
OsiCbcSolverInterface::setRowName
virtual void setRowName(int ndx, std::string name)
Set a row name.
OsiCbcSolverInterface::getColUpper
virtual const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
OsiCbcSolverInterface::getReducedCost
virtual const double * getReducedCost() const
Get a pointer to array[getNumCols()] of reduced costs.
OsiCbcSolverInterface::dfltRowColName
virtual std::string dfltRowColName(char rc, int ndx, unsigned digits=7) const
Generate a standard name of the form Rnnnnnnn or Cnnnnnnn.
CbcModel::getNodeCount
int getNodeCount() const
Get how many Nodes it took to solve the problem (including those in complete fathoming B&B inside CLP...
Definition: CbcModel.hpp:930
OsiCbcSolverInterface::setRowNames
virtual void setRowNames(OsiNameVec &srcNames, int srcStart, int len, int tgtStart)
Set multiple row names.
OsiCbcSolverInterface::addRow
virtual void addRow(const CoinPackedVectorBase &vec, const char rowsen, const double rowrhs, const double rowrng)
OsiCbcSolverInterface::isContinuous
virtual bool isContinuous(int colNumber) const
Return true if column is continuous.
OsiCbcSolverInterface::newLanguage
void newLanguage(CoinMessages::Language language)
Set language.
OsiCbcSolverInterface::setRowLower
virtual void setRowLower(int elementIndex, double elementValue)
Set a single row lower bound Use -DBL_MAX for -infinity.
OsiCbcSolverInterface::applyRowCut
virtual void applyRowCut(const OsiRowCut &rc)
Apply a row cut (append to constraint matrix).
CbcModel::setMaximumNodes
bool setMaximumNodes(int value)
Set the maximum node limit .
Definition: CbcModel.hpp:571
OsiCbcSolverInterface::getMaximumSolutions
int getMaximumSolutions() const
Get the CbcModel::CbcMaxNumSol maximum number of solutions.
Definition: OsiCbcSolverInterface.hpp:684
OsiCbcSolverInterface::setInteger
virtual void setInteger(int index)
Set the index-th variable to be an integer variable.
OsiCbcSolverInterface::addRow
virtual void addRow(const CoinPackedVectorBase &vec, const double rowlb, const double rowub)
OsiCbcSolverInterface::setColBounds
virtual void setColBounds(int elementIndex, double lower, double upper)
Set a single column lower and upper bound.
OsiCbcSolverInterface::isAbandoned
virtual bool isAbandoned() const
Are there a numerical difficulties?
CbcModel::getMaximumSolutions
int getMaximumSolutions() const
Get the maximum number of solutions desired.
Definition: CbcModel.hpp:591
OsiCbcSolverInterface::getObjValue
virtual double getObjValue() const
Get objective function value.
OsiCbcSolverInterface::getIntParam
bool getIntParam(OsiIntParam key, int &value) const
OsiCbcSolverInterface::setDblParam
bool setDblParam(OsiDblParam key, double value)
OsiCbcSolverInterface::getColSolution
virtual const double * getColSolution() const
Get pointer to array[getNumCols()] of primal solution vector.
OsiCbcSolverInterface::getMaximumSeconds
double getMaximumSeconds() const
Get the CbcModel::CbcMaximumSeconds maximum number of seconds.
Definition: OsiCbcSolverInterface.hpp:690
OsiCbcSolverInterface::getModelPtr
CbcModel * getModelPtr() const
Get pointer to Cbc model.
Definition: OsiCbcSolverInterface.hpp:663
OsiCbcSolverInterface::writeMps
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.
OsiCbcSolverInterface::passInMessageHandler
virtual void passInMessageHandler(CoinMessageHandler *handler)
Pass in a message handler.
OsiCbcSolverInterface::setColName
virtual void setColName(int ndx, std::string name)
Set a column name.
OsiCbcSolverInterface::setRowType
virtual void setRowType(int index, char sense, double rightHandSide, double range)
Set the type of a single row
OsiCbcSolverInterface::isSolutionLimitReached
bool isSolutionLimitReached() const
Solution limit reached?
Definition: OsiCbcSolverInterface.hpp:696
OsiCbcSolverInterface::getPrimalRays
virtual std::vector< double * > getPrimalRays(int maxNumRays) const
Get as many primal rays as the solver can provide.
OsiCbcSolverInterface::getObjSense
virtual double getObjSense() const
Get objective function sense (1 for min (default), -1 for max)
OsiCbcSolverInterface::OsiCbcSolverInterface
OsiCbcSolverInterface(const OsiCbcSolverInterface &)
Copy constructor.
CbcModel.hpp
CbcModel::setCutoff
void setCutoff(double value)
Set cutoff bound on the objective function.
OsiCbcSolverInterface::setObjSense
virtual void setObjSense(double s)
Set objective function sense (1 for min (default), -1 for max,)
OsiCbcSolverInterface::setRowUpper
virtual void setRowUpper(int elementIndex, double elementValue)
Set a single row upper bound Use DBL_MAX for infinity.
OsiCbcSolverInterface::getDblParam
bool getDblParam(OsiDblParam key, double &value) const
OsiCbcSolverInterface::getRowSense
virtual const char * getRowSense() const
Get pointer to array[getNumRows()] of row constraint senses.
OsiCbcSolverInterface::isDualObjectiveLimitReached
virtual bool isDualObjectiveLimitReached() const
Is the given dual objective limit reached?
OsiCbcSolverInterface::solveFromHotStart
virtual void solveFromHotStart()
Optimize starting from the hotstart.
OsiCbcSolverInterface::setCutoff
void setCutoff(double value)
Set cutoff bound on the objective function.
Definition: OsiCbcSolverInterface.hpp:669
OsiCbcSolverInterface::readMps
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...
OsiCbcSolverInterface::setColNames
virtual void setColNames(OsiNameVec &srcNames, int srcStart, int len, int tgtStart)
Set multiple column names.
OsiCbcSolverInterface::getEmptyWarmStart
virtual CoinWarmStart * getEmptyWarmStart() const
Get an empty warm start object.
OsiCbcSolverInterface::getHintParam
virtual bool getHintParam(OsiHintParam key, bool &yesNo, OsiHintStrength &strength, void *&otherInformation) const
Get a hint parameter.
OsiCbcSolverInterface::writeMpsNative
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.
OsiCbcSolverInterface::getColName
virtual std::string getColName(int colIndex, unsigned maxLen=std::string::npos) const
Return the name of the column.
OsiCbcSolverInterface::getWarmStart
virtual CoinWarmStart * getWarmStart() const
Get warmstarting information.
OsiCbcSolverInterface::isProvenPrimalInfeasible
virtual bool isProvenPrimalInfeasible() const
Is primal infeasiblity proven?
OsiCbcSolverInterface::setMaximumNodes
void setMaximumNodes(int value)
Set the CbcModel::CbcMaxNumNode maximum node limit.
Definition: OsiCbcSolverInterface.hpp:675
OsiCbcSolverInterface::unmarkHotStart
virtual void unmarkHotStart()
Delete the snapshot.
CbcModel::isNodeLimitReached
bool isNodeLimitReached() const
Node limit reached?
OsiCbcSolverInterface
Cbc Solver Interface.
Definition: OsiCbcSolverInterface.hpp:31
OsiCbcSolverInterface::getColLower
virtual const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
CbcModel::status
int status() const
Final status of problem Some of these can be found out by is......
Definition: CbcModel.hpp:954
CbcModel::solver
OsiSolverInterface * solver() const
Returns solver - has current state.
Definition: CbcModel.hpp:1970
OsiCbcSolverInterface::markHotStart
virtual void markHotStart()
Create a hotstart point of the optimization process.
OsiCbcSolverInterface::setRowBounds
virtual void setRowBounds(int elementIndex, double lower, double upper)
Set a single row lower and upper bound.
OsiCbcSolverInterface::getInfinity
virtual double getInfinity() const
Get solver's value for infinity.
OsiCbcSolverInterface::addRows
virtual void addRows(const int numrows, const CoinPackedVectorBase *const *rows, const char *rowsen, const double *rowrhs, const double *rowrng)
OsiCbcSolverInterface::setInteger
virtual void setInteger(const int *indices, int len)
Set the variables listed in indices (which is of length len) to be integer variables.
OsiCbcSolverInterface::getMaximumNodes
int getMaximumNodes() const
Get the CbcModel::CbcMaxNumNode maximum node limit.
Definition: OsiCbcSolverInterface.hpp:678
OsiCbcSolverInterface::loadProblem
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...
OsiCbcSolverInterface::isProvenDualInfeasible
virtual bool isProvenDualInfeasible() const
Is dual infeasiblity proven?
OsiCbcSolverInterface::setContinuous
virtual void setContinuous(int index)
Set the index-th variable to be a continuous variable.
OsiCbcSolverInterface::OsiCbcSolverInterface
OsiCbcSolverInterface(OsiSolverInterface *solver=NULL, CbcStrategy *strategy=NULL)
Default Constructor.
OsiCbcSolverInterface::setObjCoeff
virtual void setObjCoeff(int elementIndex, double elementValue)
Set an objective function coefficient.
CbcModel
Simple Branch and bound class.
Definition: CbcModel.hpp:101
OsiCbcSolverInterface::getStrParam
bool getStrParam(OsiStrParam key, std::string &value) const
OsiCbcSolverInterface::clone
virtual OsiSolverInterface * clone(bool copyData=true) const
Clone.
CbcStrategy
Strategy base class.
Definition: CbcStrategy.hpp:18
OsiCbcSolverInterface::isProvenOptimal
virtual bool isProvenOptimal() const
Is optimality proven?
OsiCbcSolverInterface::deleteColNames
virtual void deleteColNames(int tgtStart, int len)
Delete len column names starting at index tgtStart.
OsiCbcSolverInterface::setStrParam
bool setStrParam(OsiStrParam key, const std::string &value)
CbcStrategy.hpp
OsiCbcSolverInterface::getNumElements
virtual int getNumElements() const
Get number of nonzero elements.
OsiCbcSolverInterface::getRowName
virtual std::string getRowName(int rowIndex, unsigned maxLen=std::string::npos) const
Return the name of the row.
OsiCbcSolverInterface::resolve
virtual void resolve()
Resolve an LP relaxation after problem modification.
OsiCbcSolverInterface::getHintParam
virtual bool getHintParam(OsiHintParam key, bool &yesNo, OsiHintStrength &strength) const
Get a hint parameter.
OsiCbcSolverInterface::deleteRowNames
virtual void deleteRowNames(int tgtStart, int len)
Delete len row names starting at index tgtStart.
OsiCbcSolverInterface::setRowPrice
virtual void setRowPrice(const double *rowprice)
Set dual solution vector.
OsiCbcSolverInterfaceUnitTest
void OsiCbcSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir)
A function that tests the methods in the OsiCbcSolverInterface class.
OsiCbcSolverInterface::getRightHandSide
virtual const double * getRightHandSide() const
Get pointer to array[getNumRows()] of rows right-hand sides.
CbcModel::setMaximumSeconds
bool setMaximumSeconds(double value)
Set the maximum number of seconds desired.
Definition: CbcModel.hpp:608
OsiCbcSolverInterface::getNumRows
virtual int getNumRows() const
Get number of rows.
OsiCbcSolverInterface::isIterationLimitReached
virtual bool isIterationLimitReached() const
Iteration limit reached?
OsiCbcSolverInterface::setColSetBounds
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...
OsiCbcSolverInterface::getNodeCount
int getNodeCount() const
Get how many Nodes it took to solve the problem.
Definition: OsiCbcSolverInterface.hpp:699
OsiCbcSolverInterface::addCol
virtual void addCol(const CoinPackedVectorBase &vec, const double collb, const double colub, const double obj)
OsiCbcSolverInterface::setRowSetBounds
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::getDualRays
virtual std::vector< double * > getDualRays(int maxNumRays, bool fullRay=false) const
Get as many dual rays as the solver can provide.
OsiCbcSolverInterface::getNumCols
virtual int getNumCols() const
Get number of columns.
OsiCbcSolverInterface::isNodeLimitReached
bool isNodeLimitReached() const
Node limit reached?
Definition: OsiCbcSolverInterface.hpp:693
OsiCbcSolverInterface::~OsiCbcSolverInterface
virtual ~OsiCbcSolverInterface()
Destructor.
OsiCbcSolverInterface::setIntParam
bool setIntParam(OsiIntParam key, int value)
OsiCbcSolverInterface::setObjName
virtual void setObjName(std::string name)
Set the name of the objective function.
CbcModel::getMaximumNodes
int getMaximumNodes() const
Get the maximum node limit .
Definition: CbcModel.hpp:576
CbcModel::getCutoff
double getCutoff() const
Get the cutoff bound on the objective function - always as minimize.
Definition: CbcModel.hpp:564
OsiCbcSolverInterface::branchAndBound
virtual void branchAndBound()
Invoke solver's built-in enumeration algorithm.
OsiCbcSolverInterface::applyRowCuts
virtual void applyRowCuts(int numberCuts, const OsiRowCut *cuts)
Apply a collection of row cuts which are all effective.
OsiCbcSolverInterface::setLanguage
void setLanguage(CoinMessages::Language language)
Definition: OsiCbcSolverInterface.hpp:655
OsiCbcSolverInterface::loadProblem
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 ...
OsiCbcSolverInterface::OsiCbcSolverInterfaceUnitTest
friend void OsiCbcSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir)
A function that tests the methods in the OsiCbcSolverInterface class.
OsiCbcSolverInterface::operator=
OsiCbcSolverInterface & operator=(const OsiCbcSolverInterface &rhs)
Assignment operator.
OsiCbcSolverInterface::modelPtr_
CbcModel * modelPtr_
Cbc model represented by this class instance.
Definition: OsiCbcSolverInterface.hpp:754
OsiCbcSolverInterface::status
int status() const
Final status of problem - 0 finished, 1 stopped, 2 difficulties.
Definition: OsiCbcSolverInterface.hpp:702
OsiCbcSolverInterface::getRowRange
virtual const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
OsiCbcSolverInterface::assignProblem
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::setMaximumSeconds
void setMaximumSeconds(double value)
Set the CbcModel::CbcMaximumSeconds maximum number of seconds.
Definition: OsiCbcSolverInterface.hpp:687
OsiCbcSolverInterface::applyRowCuts
virtual void applyRowCuts(int numberCuts, const OsiRowCut **cuts)
Apply a collection of row cuts which are all effective.
OsiCbcSolverInterface::getRowPrice
virtual const double * getRowPrice() const
Get pointer to array[getNumRows()] of dual prices.
OsiCbcSolverInterface::deleteCols
virtual void deleteCols(const int num, const int *colIndices)
OsiCbcSolverInterface::setContinuous
virtual void setContinuous(const int *indices, int len)
Set the variables listed in indices (which is of length len) to be continuous variables.
OsiCbcSolverInterface::initialSolve
virtual void initialSolve()
Solve initial LP relaxation.
OsiCbcSolverInterface::getColNames
virtual const OsiNameVec & getColNames()
Return a pointer to a vector of column names.
OsiCbcSolverInterface::addCol
virtual void addCol(int numberElements, const int *rows, const double *elements, const double collb, const double colub, const double obj)
Add a column (primal variable) to the problem.
OsiCbcSolverInterface::setColSolution
virtual void setColSolution(const double *colsol)
Set the primal solution column values.
OsiCbcSolverInterface::getObjCoefficients
virtual const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
OsiCbcSolverInterface::loadProblem
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 ...
OsiCbcInfinity
static const double OsiCbcInfinity
Definition: OsiCbcSolverInterface.hpp:20
CbcModel::setMaximumSolutions
bool setMaximumSolutions(int value)
Set the maximum number of solutions desired.
Definition: CbcModel.hpp:584
CbcModel::isSolutionLimitReached
bool isSolutionLimitReached() const
Solution limit reached?
OsiCbcSolverInterface::getObjName
virtual std::string getObjName(unsigned maxLen=std::string::npos) const
Return the name of the objective function.
OsiCbcSolverInterface::getIterationCount
virtual int getIterationCount() const
Get how many iterations it took to solve the problem (whatever "iteration" mean to the solver.
CbcModel::getMaximumSeconds
double getMaximumSeconds() const
Get the maximum number of seconds desired.
Definition: CbcModel.hpp:615
OsiCbcSolverInterface::getMatrixByRow
virtual const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of matrix.
OsiCbcSolverInterface::deleteRows
virtual void deleteRows(const int num, const int *rowIndices)
OsiCbcSolverInterface::getRealSolverPtr
OsiSolverInterface * getRealSolverPtr() const
Get pointer to underlying solver.
Definition: OsiCbcSolverInterface.hpp:666
OsiCbcSolverInterface::setColUpper
virtual void setColUpper(int elementIndex, double elementValue)
Set a single column upper bound Use DBL_MAX for infinity.
OsiCbcSolverInterface::setHintParam
virtual bool setHintParam(OsiHintParam key, bool yesNo=true, OsiHintStrength strength=OsiHintTry, void *otherInformation=NULL)
OsiCbcSolverInterface::loadProblem
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...
OsiCbcSolverInterface::getRowActivity
virtual const double * getRowActivity() const
Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vecto...
OsiCbcSolverInterface::addCols
virtual void addCols(const int numcols, const CoinPackedVectorBase *const *cols, const double *collb, const double *colub, const double *obj)
OsiCbcSolverInterface::getCutoff
double getCutoff() const
Get the cutoff bound on the objective function - always as minimize.
Definition: OsiCbcSolverInterface.hpp:672
OsiCbcSolverInterface::getMatrixByCol
virtual const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of matrix.
OsiCbcSolverInterface::setColLower
virtual void setColLower(int elementIndex, double elementValue)
Set a single column lower bound Use -DBL_MAX for -infinity.
OsiCbcSolverInterface::getRowUpper
virtual const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
OsiCbcSolverInterface::addRows
virtual void addRows(const int numrows, const CoinPackedVectorBase *const *rows, const double *rowlb, const double *rowub)
OsiCbcSolverInterface::setWarmStart
virtual bool setWarmStart(const CoinWarmStart *warmstart)
Set warmstarting information.
OsiCbcSolverInterface::getRowNames
virtual const OsiNameVec & getRowNames()
Return a pointer to a vector of row names.
OsiCbcSolverInterface::isPrimalObjectiveLimitReached
virtual bool isPrimalObjectiveLimitReached() const
Is the given primal objective limit reached?
OsiCbcSolverInterface::applyColCut
virtual void applyColCut(const OsiColCut &cc)
Apply a column cut (adjust one or more bounds).