Osi  0.107.9
OsiSolverInterface.hpp
Go to the documentation of this file.
1 // Copyright (C) 2000, International Business Machines
2 // Corporation and others. All Rights Reserved.
3 // This code is licensed under the terms of the Eclipse Public License (EPL).
4 
5 #ifndef OsiSolverInterface_H
6 #define OsiSolverInterface_H
7 
8 #include <cstdlib>
9 #include <string>
10 #include <vector>
11 
12 #include "CoinTypes.hpp"
13 #include "CoinMessageHandler.hpp"
14 #include "CoinPackedVectorBase.hpp"
15 #include "CoinPackedMatrix.hpp"
16 #include "CoinWarmStart.hpp"
17 #include "CoinFinite.hpp"
18 #include "CoinError.hpp"
19 
20 #include "OsiCollections.hpp"
21 #include "OsiSolverParameters.hpp"
22 
23 class CoinSnapshot;
24 class CoinLpIO;
25 class CoinMpsIO;
26 
27 class OsiCuts;
28 class OsiAuxInfo;
29 class OsiRowCut;
30 class OsiRowCutDebugger;
31 class CoinSet;
32 class CoinBuild;
33 class CoinModel;
34 class OsiSolverBranch;
35 class OsiSolverResult;
36 class OsiObject;
37 
38 
39 //#############################################################################
40 
64  const OsiSolverInterface* emptySi,
65  const std::string & mpsDir,
66  const std::string & netlibDir);
68  const std::vector<OsiSolverInterface*> & vecSiP,
69  const std::string & mpsDir);
70 
71 public:
72 
75  friend class OsiSolverInterface;
76  friend class OsiClpSolverInterface;
77  friend class OsiGrbSolverInterface;
78 
79  public:
81 
86  infeasible_(0),
87  ineffective_(0),
88  applied_(0) {}
95  applied_(rhs.applied_) {}
98  {
99  if (this != &rhs) {
102  infeasible_ = rhs.infeasible_;
104  applied_ = rhs.applied_;
105  }
106  return *this;
107  }
111 
114  inline int getNumInconsistent() const
116  {return intInconsistent_;}
119  {return extInconsistent_;}
121  inline int getNumInfeasible() const
122  {return infeasible_;}
124  inline int getNumIneffective() const
125  {return ineffective_;}
127  inline int getNumApplied() const
128  {return applied_;}
130 
131  private:
143  inline void incrementApplied(){applied_++;}
145 
147 
148  int intInconsistent_;
157  int applied_;
159  };
160 
161  //---------------------------------------------------------------------------
162 
164 
165  virtual void initialSolve() = 0;
167 
173  virtual void resolve() = 0;
174 
176  virtual void branchAndBound() = 0;
177 
178 #ifdef CBC_NEXT_VERSION
179  /*
180  Would it make sense to collect all of these routines in a `MIP Helper'
181  section? It'd make it easier for users and implementors to find them.
182  */
200  virtual int solveBranches(int depth,const OsiSolverBranch * branch,
201  OsiSolverResult * result,
202  int & numberSolves, int & numberIterations,
203  bool forceBranch=false);
204 #endif
205 
206 
207  //---------------------------------------------------------------------------
265  virtual bool setIntParam(OsiIntParam key, int value) {
267  if (key == OsiLastIntParam) return (false) ;
268  intParam_[key] = value;
269  return true;
270  }
272  virtual bool setDblParam(OsiDblParam key, double value) {
273  if (key == OsiLastDblParam) return (false) ;
274  dblParam_[key] = value;
275  return true;
276  }
278  virtual bool setStrParam(OsiStrParam key, const std::string & value) {
279  if (key == OsiLastStrParam) return (false) ;
280  strParam_[key] = value;
281  return true;
282  }
294  virtual bool setHintParam(OsiHintParam key, bool yesNo=true,
295  OsiHintStrength strength=OsiHintTry,
296  void * /*otherInformation*/ = NULL) {
297  if (key==OsiLastHintParam)
298  return false;
299  hintParam_[key] = yesNo;
300  hintStrength_[key] = strength;
301  if (strength == OsiForceDo)
302  throw CoinError("OsiForceDo illegal",
303  "setHintParam", "OsiSolverInterface");
304  return true;
305  }
307  virtual bool getIntParam(OsiIntParam key, int& value) const {
308  if (key == OsiLastIntParam) return (false) ;
309  value = intParam_[key];
310  return true;
311  }
313  virtual bool getDblParam(OsiDblParam key, double& value) const {
314  if (key == OsiLastDblParam) return (false) ;
315  value = dblParam_[key];
316  return true;
317  }
319  virtual bool getStrParam(OsiStrParam key, std::string& value) const {
320  if (key == OsiLastStrParam) return (false) ;
321  value = strParam_[key];
322  return true;
323  }
333  virtual bool getHintParam(OsiHintParam key, bool& yesNo,
334  OsiHintStrength& strength,
335  void *& otherInformation) const {
336  if (key==OsiLastHintParam)
337  return false;
338  yesNo = hintParam_[key];
339  strength = hintStrength_[key];
340  otherInformation=NULL;
341  return true;
342  }
347  virtual bool getHintParam(OsiHintParam key, bool& yesNo,
348  OsiHintStrength& strength) const {
349  if (key==OsiLastHintParam)
350  return false;
351  yesNo = hintParam_[key];
352  strength = hintStrength_[key];
353  return true;
354  }
359  virtual bool getHintParam(OsiHintParam key, bool& yesNo) const {
360  if (key==OsiLastHintParam)
361  return false;
362  yesNo = hintParam_[key];
363  return true;
364  }
372 
386  inline double getIntegerTolerance() const
387  { return dblParam_[OsiPrimalTolerance];}
389 
390  //---------------------------------------------------------------------------
392 
393  virtual bool isAbandoned() const = 0;
396  virtual bool isProvenOptimal() const = 0;
398  virtual bool isProvenPrimalInfeasible() const = 0;
400  virtual bool isProvenDualInfeasible() const = 0;
402  virtual bool isPrimalObjectiveLimitReached() const;
404  virtual bool isDualObjectiveLimitReached() const;
406  virtual bool isIterationLimitReached() const = 0;
408 
409  //---------------------------------------------------------------------------
427  virtual CoinWarmStart *getEmptyWarmStart () const = 0 ;
428 
435  virtual CoinWarmStart* getWarmStart() const = 0;
444  virtual CoinWarmStart* getPointerToWarmStart(bool & mustDelete) ;
445 
454  virtual bool setWarmStart(const CoinWarmStart* warmstart) = 0;
456 
457  //---------------------------------------------------------------------------
478  virtual void markHotStart();
481  virtual void solveFromHotStart();
483  virtual void unmarkHotStart();
485 
486  //---------------------------------------------------------------------------
497  virtual int getNumCols() const = 0;
499 
501  virtual int getNumRows() const = 0;
502 
504  virtual int getNumElements() const = 0;
505 
507  virtual int getNumIntegers() const ;
508 
510  virtual const double * getColLower() const = 0;
511 
513  virtual const double * getColUpper() const = 0;
514 
525  virtual const char * getRowSense() const = 0;
526 
540  virtual const double * getRightHandSide() const = 0;
541 
551  virtual const double * getRowRange() const = 0;
552 
554  virtual const double * getRowLower() const = 0;
555 
557  virtual const double * getRowUpper() const = 0;
558 
562  virtual const double * getObjCoefficients() const = 0;
563 
569  virtual double getObjSense() const = 0;
570 
572  virtual bool isContinuous(int colIndex) const = 0;
573 
575  virtual bool isBinary(int colIndex) const;
576 
581  virtual bool isInteger(int colIndex) const;
582 
584  virtual bool isIntegerNonBinary(int colIndex) const;
585 
587  virtual bool isFreeBinary(int colIndex) const;
588 
593  inline const char *columnType(bool refresh=false) const
594  { return getColType(refresh); }
595 
607  virtual const char * getColType(bool refresh=false) const;
608 
610  virtual const CoinPackedMatrix * getMatrixByRow() const = 0;
611 
613  virtual const CoinPackedMatrix * getMatrixByCol() const = 0;
614 
620  virtual CoinPackedMatrix * getMutableMatrixByRow() const {return NULL;}
621 
627  virtual CoinPackedMatrix * getMutableMatrixByCol() const {return NULL;}
628 
630  virtual double getInfinity() const = 0;
632 
635  virtual const double * getColSolution() const = 0;
637 
641  virtual const double * getStrictColSolution();
642 
644  virtual const double * getRowPrice() const = 0;
645 
647  virtual const double * getReducedCost() const = 0;
648 
654  virtual const double * getRowActivity() const = 0;
655 
657  virtual double getObjValue() const = 0;
658 
662  virtual int getIterationCount() const = 0;
663 
686  virtual std::vector<double*> getDualRays(int maxNumRays,
687  bool fullRay = false) const = 0;
688 
704  virtual std::vector<double*> getPrimalRays(int maxNumRays) const = 0;
705 
708  virtual OsiVectorInt getFractionalIndices(const double etol=1.e-05)
709  const;
711 
712  //-------------------------------------------------------------------------
725  virtual void setObjCoeff( int elementIndex, double elementValue ) = 0;
726 
728  virtual void setObjCoeffSet(const int* indexFirst,
729  const int* indexLast,
730  const double* coeffList);
731 
737  virtual void setObjective(const double * array);
738 
749  virtual void setObjSense(double s) = 0;
750 
751 
754  virtual void setColLower( int elementIndex, double elementValue ) = 0;
755 
761  virtual void setColLower(const double * array);
762 
765  virtual void setColUpper( int elementIndex, double elementValue ) = 0;
766 
772  virtual void setColUpper(const double * array);
773 
774 
778  virtual void setColBounds( int elementIndex,
779  double lower, double upper ) {
780  setColLower(elementIndex, lower);
781  setColUpper(elementIndex, upper);
782  }
783 
790  virtual void setColSetBounds(const int* indexFirst,
791  const int* indexLast,
792  const double* boundList);
793 
796  virtual void setRowLower( int elementIndex, double elementValue ) = 0;
797 
800  virtual void setRowUpper( int elementIndex, double elementValue ) = 0;
801 
805  virtual void setRowBounds( int elementIndex,
806  double lower, double upper ) {
807  setRowLower(elementIndex, lower);
808  setRowUpper(elementIndex, upper);
809  }
810 
817  virtual void setRowSetBounds(const int* indexFirst,
818  const int* indexLast,
819  const double* boundList);
820 
821 
823  virtual void setRowType(int index, char sense, double rightHandSide,
824  double range) = 0;
825 
830  virtual void setRowSetTypes(const int* indexFirst,
831  const int* indexLast,
832  const char* senseList,
833  const double* rhsList,
834  const double* rangeList);
835 
845  virtual void setColSolution(const double *colsol) = 0;
846 
856  virtual void setRowPrice(const double * rowprice) = 0;
857 
866  virtual int reducedCostFix(double gap, bool justInteger=true);
868 
869  //-------------------------------------------------------------------------
873  virtual void setContinuous(int index) = 0;
875  virtual void setInteger(int index) = 0;
878  virtual void setContinuous(const int* indices, int len);
881  virtual void setInteger(const int* indices, int len);
883  //-------------------------------------------------------------------------
884 
885  //-------------------------------------------------------------------------
886 
888  typedef std::vector<std::string> OsiNameVec ;
889 
910 
920  virtual std::string dfltRowColName(char rc,
921  int ndx, unsigned digits = 7) const ;
922 
925  virtual std::string getObjName (unsigned maxLen = static_cast<unsigned>(std::string::npos)) const ;
926 
929  virtual inline void setObjName (std::string name)
930  { objName_ = name ; }
931 
938  virtual std::string getRowName(int rowIndex,
939  unsigned maxLen = static_cast<unsigned>(std::string::npos)) const ;
940 
952  virtual const OsiNameVec &getRowNames() ;
953 
959  virtual void setRowName(int ndx, std::string name) ;
960 
967  virtual void setRowNames(OsiNameVec &srcNames,
968  int srcStart, int len, int tgtStart) ;
969 
975  virtual void deleteRowNames(int tgtStart, int len) ;
976 
983  virtual std::string getColName(int colIndex,
984  unsigned maxLen = static_cast<unsigned>(std::string::npos)) const ;
985 
995  virtual const OsiNameVec &getColNames() ;
996 
1002  virtual void setColName(int ndx, std::string name) ;
1003 
1010  virtual void setColNames(OsiNameVec &srcNames,
1011  int srcStart, int len, int tgtStart) ;
1012 
1018  virtual void deleteColNames(int tgtStart, int len) ;
1019 
1020 
1027  void setRowColNames(const CoinMpsIO &mps) ;
1028 
1034  void setRowColNames(CoinModel &mod) ;
1035 
1042  void setRowColNames(CoinLpIO &mod) ;
1043 
1045  //-------------------------------------------------------------------------
1046 
1047  //-------------------------------------------------------------------------
1053 
1055  virtual void addCol(const CoinPackedVectorBase& vec,
1056  const double collb, const double colub,
1057  const double obj) = 0;
1058 
1064  virtual void addCol(const CoinPackedVectorBase& vec,
1065  const double collb, const double colub,
1066  const double obj, std::string name) ;
1067 
1069  virtual void addCol(int numberElements,
1070  const int* rows, const double* elements,
1071  const double collb, const double colub,
1072  const double obj) ;
1073 
1079  virtual void addCol(int numberElements,
1080  const int* rows, const double* elements,
1081  const double collb, const double colub,
1082  const double obj, std::string name) ;
1083 
1089  virtual void addCols(const int numcols,
1090  const CoinPackedVectorBase * const * cols,
1091  const double* collb, const double* colub,
1092  const double* obj);
1093 
1099  virtual void addCols(const int numcols, const int* columnStarts,
1100  const int* rows, const double* elements,
1101  const double* collb, const double* colub,
1102  const double* obj);
1103 
1105  void addCols(const CoinBuild & buildObject);
1106 
1112  int addCols(CoinModel & modelObject);
1113 
1114 #if 0
1115 
1116  virtual void addCols(const CoinPackedMatrix& matrix,
1117  const double* collb, const double* colub,
1118  const double* obj);
1119 #endif
1120 
1127  virtual void deleteCols(const int num, const int * colIndices) = 0;
1128 
1130  virtual void addRow(const CoinPackedVectorBase& vec,
1131  const double rowlb, const double rowub) = 0;
1132 
1138  virtual void addRow(const CoinPackedVectorBase& vec,
1139  const double rowlb, const double rowub,
1140  std::string name) ;
1141 
1143  virtual void addRow(const CoinPackedVectorBase& vec,
1144  const char rowsen, const double rowrhs,
1145  const double rowrng) = 0;
1146 
1152  virtual void addRow(const CoinPackedVectorBase& vec,
1153  const char rowsen, const double rowrhs,
1154  const double rowrng, std::string name) ;
1155 
1160  virtual void addRow(int numberElements,
1161  const int *columns, const double *element,
1162  const double rowlb, const double rowub) ;
1163 
1169  virtual void addRows(const int numrows,
1170  const CoinPackedVectorBase * const * rows,
1171  const double* rowlb, const double* rowub);
1172 
1178  virtual void addRows(const int numrows,
1179  const CoinPackedVectorBase * const * rows,
1180  const char* rowsen, const double* rowrhs,
1181  const double* rowrng);
1182 
1188  virtual void addRows(const int numrows, const int *rowStarts,
1189  const int *columns, const double *element,
1190  const double *rowlb, const double *rowub);
1191 
1193  void addRows(const CoinBuild &buildObject);
1194 
1203  int addRows(CoinModel &modelObject);
1204 
1205 #if 0
1206 
1207  virtual void addRows(const CoinPackedMatrix& matrix,
1208  const double* rowlb, const double* rowub);
1210  virtual void addRows(const CoinPackedMatrix& matrix,
1211  const char* rowsen, const double* rowrhs,
1212  const double* rowrng);
1213 #endif
1214 
1220  virtual void deleteRows(const int num, const int * rowIndices) = 0;
1221 
1228  virtual void replaceMatrixOptional(const CoinPackedMatrix & ) {}
1229 
1234  virtual void replaceMatrix(const CoinPackedMatrix & ) {abort();}
1235 
1240  virtual void saveBaseModel() {}
1241 
1255  virtual void restoreBaseModel(int numberRows);
1256  //-----------------------------------------------------------------------
1280  double effectivenessLb = 0.0);
1281 
1286  virtual void applyRowCuts(int numberCuts, const OsiRowCut * cuts);
1287 
1291  virtual void applyRowCuts(int numberCuts, const OsiRowCut ** cuts);
1292 
1294  void deleteBranchingInfo(int numberDeleted, const int * which);
1295 
1297 
1298  //---------------------------------------------------------------------------
1299 
1317  virtual void loadProblem (const CoinPackedMatrix& matrix,
1318  const double* collb, const double* colub,
1319  const double* obj,
1320  const double* rowlb, const double* rowub) = 0;
1321 
1331  virtual void assignProblem (CoinPackedMatrix*& matrix,
1332  double*& collb, double*& colub, double*& obj,
1333  double*& rowlb, double*& rowub) = 0;
1334 
1351  virtual void loadProblem (const CoinPackedMatrix& matrix,
1352  const double* collb, const double* colub,
1353  const double* obj,
1354  const char* rowsen, const double* rowrhs,
1355  const double* rowrng) = 0;
1356 
1366  virtual void assignProblem (CoinPackedMatrix*& matrix,
1367  double*& collb, double*& colub, double*& obj,
1368  char*& rowsen, double*& rowrhs,
1369  double*& rowrng) = 0;
1370 
1383  virtual void loadProblem (const int numcols, const int numrows,
1384  const CoinBigIndex * start, const int* index,
1385  const double* value,
1386  const double* collb, const double* colub,
1387  const double* obj,
1388  const double* rowlb, const double* rowub) = 0;
1389 
1402  virtual void loadProblem (const int numcols, const int numrows,
1403  const CoinBigIndex * start, const int* index,
1404  const double* value,
1405  const double* collb, const double* colub,
1406  const double* obj,
1407  const char* rowsen, const double* rowrhs,
1408  const double* rowrng) = 0;
1409 
1416  virtual int loadFromCoinModel (CoinModel & modelObject,
1417  bool keepSolution=false);
1418 
1424  virtual int readMps (const char *filename,
1425  const char *extension = "mps") ;
1426 
1433  virtual int readMps (const char *filename, const char*extension,
1434  int & numberSets, CoinSet ** & sets);
1435 
1441  virtual int readGMPL (const char *filename, const char *dataname=NULL);
1442 
1449  virtual void writeMps (const char *filename,
1450  const char *extension = "mps",
1451  double objSense=0.0) const = 0;
1452 
1466  int writeMpsNative (const char *filename,
1467  const char ** rowNames, const char ** columnNames,
1468  int formatType=0,int numberAcross=2,
1469  double objSense=0.0, int numberSOS=0,
1470  const CoinSet * setInfo=NULL) const ;
1471 
1472 /***********************************************************************/
1473 // Lp files
1474 
1494  virtual void writeLp(const char *filename,
1495  const char *extension = "lp",
1496  double epsilon = 1e-5,
1497  int numberAcross = 10,
1498  int decimals = 5,
1499  double objSense = 0.0,
1500  bool useRowNames = true) const;
1501 
1506  virtual void writeLp(FILE *fp,
1507  double epsilon = 1e-5,
1508  int numberAcross = 10,
1509  int decimals = 5,
1510  double objSense = 0.0,
1511  bool useRowNames = true) const;
1512 
1531  int writeLpNative(const char *filename,
1532  char const * const * const rowNames,
1533  char const * const * const columnNames,
1534  const double epsilon = 1.0e-5,
1535  const int numberAcross = 10,
1536  const int decimals = 5,
1537  const double objSense = 0.0,
1538  const bool useRowNames = true) const;
1539 
1544  int writeLpNative(FILE *fp,
1545  char const * const * const rowNames,
1546  char const * const * const columnNames,
1547  const double epsilon = 1.0e-5,
1548  const int numberAcross = 10,
1549  const int decimals = 5,
1550  const double objSense = 0.0,
1551  const bool useRowNames = true) const;
1552 
1555  virtual int readLp(const char *filename, const double epsilon = 1e-5);
1556 
1559  int readLp(FILE *fp, const double epsilon = 1e-5);
1560 
1562 
1563  //---------------------------------------------------------------------------
1564 
1573  bool ignoreNames=true);
1574 #ifdef COIN_SNAPSHOT
1575  virtual CoinSnapshot * snapshot(bool createArrays=true) const;
1577 #endif
1578 #ifdef COIN_FACTORIZATION_INFO
1579  virtual CoinBigIndex getSizeL() const;
1582  virtual CoinBigIndex getSizeU() const;
1583 #endif
1584 
1585 
1586  //---------------------------------------------------------------------------
1587 
1597  void setApplicationData (void * appData);
1604  void setAuxiliaryInfo(OsiAuxInfo * auxiliaryInfo);
1605 
1607  void * getApplicationData() const;
1611  //---------------------------------------------------------------------------
1612 
1626  virtual void passInMessageHandler(CoinMessageHandler * handler);
1628  void newLanguage(CoinMessages::Language language);
1629  inline void setLanguage(CoinMessages::Language language)
1630  {newLanguage(language);}
1632  inline CoinMessageHandler * messageHandler() const
1633  {return handler_;}
1635  inline CoinMessages messages()
1636  {return messages_;}
1638  inline CoinMessages * messagesPointer()
1639  {return &messages_;}
1641  inline bool defaultHandler() const
1642  { return defaultHandler_;}
1644  //---------------------------------------------------------------------------
1659  void findIntegers(bool justCount);
1670  virtual int findIntegersAndSOS(bool justCount);
1672  inline int numberObjects() const { return numberObjects_;}
1674  inline void setNumberObjects(int number)
1675  { numberObjects_=number;}
1676 
1678  inline OsiObject ** objects() const { return object_;}
1679 
1681  const inline OsiObject * object(int which) const { return object_[which];}
1683  inline OsiObject * modifiableObject(int which) const { return object_[which];}
1684 
1687 
1697  double forceFeasible();
1699  //---------------------------------------------------------------------------
1700 
1712  virtual void activateRowCutDebugger (const char *modelName);
1713 
1727  virtual void activateRowCutDebugger(const double *solution,
1728  bool enforceOptimality = true);
1729 
1742 
1752 
1761 
1772  virtual int canDoSimplexInterface() const ;
1774 
1782 
1791  virtual void enableFactorization() const ;
1792 
1794  virtual void disableFactorization() const ;
1795 
1806  virtual bool basisIsAvailable() const ;
1807 
1809  inline bool optimalBasisIsAvailable() const { return basisIsAvailable() ; }
1810 
1834  virtual void getBasisStatus(int* cstat, int* rstat) const ;
1835 
1850  virtual int setBasisStatus(const int* cstat, const int* rstat) ;
1851 
1857  virtual void getReducedGradient(double* columnReducedCosts,
1858  double* duals, const double* c) const ;
1859 
1865  virtual void getBInvARow(int row, double* z, double* slack = NULL) const ;
1866 
1868  virtual void getBInvRow(int row, double* z) const ;
1869 
1871  virtual void getBInvACol(int col, double* vec) const ;
1872 
1874  virtual void getBInvCol(int col, double* vec) const ;
1875 
1883  virtual void getBasics(int* index) const ;
1884 
1886 
1894 
1901  virtual void enableSimplexInterface(bool doingPrimal) ;
1902 
1904  virtual void disableSimplexInterface() ;
1912  virtual int pivot(int colIn, int colOut, int outStatus) ;
1913 
1925  virtual int primalPivotResult(int colIn, int sign,
1926  int& colOut, int& outStatus,
1927  double& t, CoinPackedVector* dx);
1928 
1935  virtual int dualPivotResult(int& colIn, int& sign,
1936  int colOut, int outStatus,
1937  double& t, CoinPackedVector* dx) ;
1939 
1940  //---------------------------------------------------------------------------
1941 
1943 
1944  OsiSolverInterface();
1946 
1952  virtual OsiSolverInterface * clone(bool copyData = true) const = 0;
1953 
1956 
1959 
1962 
1969  virtual void reset();
1971 
1972  //---------------------------------------------------------------------------
1973 
1974 protected:
1976 
1977 
1978  virtual void applyRowCut( const OsiRowCut & rc ) = 0;
1979 
1981  virtual void applyColCut( const OsiColCut & cc ) = 0;
1982 
1985  inline void
1986  convertBoundToSense(const double lower, const double upper,
1987  char& sense, double& right, double& range) const;
1990  inline void
1991  convertSenseToBound(const char sense, const double right,
1992  const double range,
1993  double& lower, double& upper) const;
1996  template <class T> inline T
1997  forceIntoRange(const T value, const T lower, const T upper) const {
1998  return value < lower ? lower : (value > upper ? upper : value);
1999  }
2008 
2010 
2011 
2017  // Why not just make useful stuff protected?
2019  CoinMessageHandler * handler_;
2027  CoinMessages messages_;
2032 
2040  mutable char * columnType_;
2041 
2043 
2044  //---------------------------------------------------------------------------
2045 
2046 private:
2048 
2063  CoinWarmStart* ws_;
2065  std::vector<double> strictColSolution_;
2066 
2072  std::string objName_ ;
2073 
2075 };
2076 
2077 //#############################################################################
2080 inline void
2081 OsiSolverInterface::convertBoundToSense(const double lower, const double upper,
2082  char& sense, double& right,
2083  double& range) const
2084 {
2085  double inf = getInfinity();
2086  range = 0.0;
2087  if (lower > -inf) {
2088  if (upper < inf) {
2089  right = upper;
2090  if (upper==lower) {
2091  sense = 'E';
2092  } else {
2093  sense = 'R';
2094  range = upper - lower;
2095  }
2096  } else {
2097  sense = 'G';
2098  right = lower;
2099  }
2100  } else {
2101  if (upper < inf) {
2102  sense = 'L';
2103  right = upper;
2104  } else {
2105  sense = 'N';
2106  right = 0.0;
2107  }
2108  }
2109 }
2110 
2111 //-----------------------------------------------------------------------------
2114 inline void
2115 OsiSolverInterface::convertSenseToBound(const char sense, const double right,
2116  const double range,
2117  double& lower, double& upper) const
2118 {
2119  double inf=getInfinity();
2120  switch (sense) {
2121  case 'E':
2122  lower = upper = right;
2123  break;
2124  case 'L':
2125  lower = -inf;
2126  upper = right;
2127  break;
2128  case 'G':
2129  lower = right;
2130  upper = inf;
2131  break;
2132  case 'R':
2133  lower = right - range;
2134  upper = right;
2135  break;
2136  case 'N':
2137  lower = -inf;
2138  upper = inf;
2139  break;
2140  }
2141 }
2142 
2143 #endif
OsiSolverInterface::ApplyCutsReturnCode::incrementIneffective
void incrementIneffective()
Increment ineffective cut counter.
Definition: OsiSolverInterface.hpp:141
OsiSolverInterface::OsiSolverInterface
OsiSolverInterface()
Default Constructor.
OsiSolverInterface::setRowName
virtual void setRowName(int ndx, std::string name)
Set a row name.
OsiSolverInterface::getMatrixByCol
virtual const CoinPackedMatrix * getMatrixByCol() const =0
Get a pointer to a column-wise copy of the matrix.
OsiSolverInterface::getIterationCount
virtual int getIterationCount() const =0
Get the number of iterations it took to solve the problem (whatever ‘iteration’ means to the solver).
OsiSolverInterface::OsiSolverInterface
OsiSolverInterface(const OsiSolverInterface &)
Copy constructor.
OsiSolverInterface::ApplyCutsReturnCode::getNumApplied
int getNumApplied() const
Number of cuts applied.
Definition: OsiSolverInterface.hpp:127
OsiForceDo
@ OsiForceDo
And this means throw an exception if not possible.
Definition: OsiSolverParameters.hpp:139
OsiSolverInterface::object_
OsiObject ** object_
Integer and ... information (integer info normally at beginning)
Definition: OsiSolverInterface.hpp:2034
OsiSolverInterface::ApplyCutsReturnCode::operator=
ApplyCutsReturnCode & operator=(const ApplyCutsReturnCode &rhs)
Assignment operator.
Definition: OsiSolverInterface.hpp:97
OsiSolverInterface::getRowPrice
virtual const double * getRowPrice() const =0
Get pointer to array[getNumRows()] of dual variable values.
OsiSolverBranch
Solver Branch Class.
Definition: OsiSolverBranch.hpp:18
OsiSolverInterface::setColUpper
virtual void setColUpper(int elementIndex, double elementValue)=0
Set a single column upper bound.
OsiSolverInterface::enableSimplexInterface
virtual void enableSimplexInterface(bool doingPrimal)
Enables normal operation of subsequent functions.
OsiSolverInterface::setBasisStatus
virtual int setBasisStatus(const int *cstat, const int *rstat)
Set the status of column and row variables and update the basis factorization and solution.
OsiSolverInterface::ApplyCutsReturnCode::incrementExternallyInconsistent
void incrementExternallyInconsistent()
Increment model-inconsistent counter.
Definition: OsiSolverInterface.hpp:137
OsiHintParam
OsiHintParam
Definition: OsiSolverParameters.hpp:107
OsiSolverInterface::getRowNames
virtual const OsiNameVec & getRowNames()
Return a pointer to a vector of row names.
OsiSolverInterface::disableFactorization
virtual void disableFactorization() const
Undo the effects of enableFactorization.
OsiSolverInterface::isBinary
virtual bool isBinary(int colIndex) const
Return true if the variable is binary.
OsiObject
Abstract base class for ‘objects’.
Definition: OsiBranchingObject.hpp:56
OsiSolverInterface::assignProblem
virtual void assignProblem(CoinPackedMatrix *&matrix, double *&collb, double *&colub, double *&obj, char *&rowsen, double *&rowrhs, double *&rowrng)=0
Load in a problem by assuming ownership of the arguments.
OsiSolverInterface::setNumberObjects
void setNumberObjects(int number)
Set the number of objects.
Definition: OsiSolverInterface.hpp:1674
OsiSolverInterface::setRowNames
virtual void setRowNames(OsiNameVec &srcNames, int srcStart, int len, int tgtStart)
Set multiple row names.
OsiSolverParameters.hpp
OsiSolverInterface::object
const OsiObject * object(int which) const
Get the specified object.
Definition: OsiSolverInterface.hpp:1681
OsiSolverInterface::getNumRows
virtual int getNumRows() const =0
Get the number of rows.
OsiPrimalTolerance
@ OsiPrimalTolerance
Primal feasibility tolerance.
Definition: OsiSolverParameters.hpp:76
OsiSolverInterface::columnType_
char * columnType_
Column type 0 - continuous 1 - binary (may get fixed later) 2 - general integer (may get fixed later)
Definition: OsiSolverInterface.hpp:2040
OsiSolverInterface::messages
CoinMessages messages()
Return the current set of messages.
Definition: OsiSolverInterface.hpp:1635
OsiSolverInterface::ApplyCutsReturnCode::incrementApplied
void incrementApplied()
Increment applied cut counter.
Definition: OsiSolverInterface.hpp:143
OsiSolverInterface::ApplyCutsReturnCode::~ApplyCutsReturnCode
~ApplyCutsReturnCode()
Destructor.
Definition: OsiSolverInterface.hpp:109
OsiSolverInterface::setInteger
virtual void setInteger(const int *indices, int len)
Set the variables listed in indices (which is of length len) to be integer variables.
OsiSolverInterface::replaceMatrixOptional
virtual void replaceMatrixOptional(const CoinPackedMatrix &)
Replace the constraint matrix.
Definition: OsiSolverInterface.hpp:1228
OsiSolverInterface::numberObjects
int numberObjects() const
Get the number of objects.
Definition: OsiSolverInterface.hpp:1672
OsiCollections.hpp
OsiSolverInterface::ApplyCutsReturnCode::extInconsistent_
int extInconsistent_
Counter for model-inconsistent cuts.
Definition: OsiSolverInterface.hpp:151
OsiSolverInterface::getReducedCost
virtual const double * getReducedCost() const =0
Get a pointer to an array[getNumCols()] of reduced costs.
OsiSolverInterface::ApplyCutsReturnCode::ApplyCutsReturnCode
ApplyCutsReturnCode()
Default constructor.
Definition: OsiSolverInterface.hpp:83
OsiSolverInterface::readLp
int readLp(FILE *fp, const double epsilon=1e-5)
Read file in LP format from the file pointed to by fp.
OsiSolverInterface::ApplyCutsReturnCode::incrementInternallyInconsistent
void incrementInternallyInconsistent()
Increment logically inconsistent cut counter.
Definition: OsiSolverInterface.hpp:135
OsiSolverInterface::isInteger
virtual bool isInteger(int colIndex) const
Return true if the variable is integer.
OsiSolverInterface::setRowPrice
virtual void setRowPrice(const double *rowprice)=0
Set dual solution variable values.
OsiSolverInterface::ApplyCutsReturnCode::ineffective_
int ineffective_
Counter for ineffective cuts.
Definition: OsiSolverInterface.hpp:155
OsiSolverInterface::newLanguage
void newLanguage(CoinMessages::Language language)
Set language.
OsiSolverInterface::deleteBranchingInfo
void deleteBranchingInfo(int numberDeleted, const int *which)
Deletes branching information before columns deleted.
OsiSolverInterface::getWarmStart
virtual CoinWarmStart * getWarmStart() const =0
Get warm start information.
OsiSolverInterface::getObjValue
virtual double getObjValue() const =0
Get the objective function value.
OsiSolverInterface::handler_
CoinMessageHandler * handler_
Message handler.
Definition: OsiSolverInterface.hpp:2019
OsiSolverInterface::getNumElements
virtual int getNumElements() const =0
Get the number of nonzero elements.
OsiSolverInterface::getRowCutDebugger
const OsiRowCutDebugger * getRowCutDebugger() const
Get the row cut debugger provided the solution known to the debugger is within the feasible region he...
OsiSolverInterface::setApplicationData
void setApplicationData(void *appData)
Set application data.
OsiSolverInterface::loadFromCoinModel
virtual int loadFromCoinModel(CoinModel &modelObject, bool keepSolution=false)
Load a model from a CoinModel object.
OsiSolverInterface::setColBounds
virtual void setColBounds(int elementIndex, double lower, double upper)
Set a single column lower and upper bound.
Definition: OsiSolverInterface.hpp:778
OsiSolverInterface::getRowCutDebuggerAlways
OsiRowCutDebugger * getRowCutDebuggerAlways() const
Get the row cut debugger object.
OsiSolverInterface::ApplyCutsReturnCode::getNumInfeasible
int getNumInfeasible() const
Number of cuts that cause obvious infeasibility.
Definition: OsiSolverInterface.hpp:121
OsiSolverInterface::getRowRange
virtual const double * getRowRange() const =0
Get a pointer to an array[getNumRows()] of row ranges.
OsiSolverInterface::isAbandoned
virtual bool isAbandoned() const =0
Are there numerical difficulties?
OsiSolverInterface::disableSimplexInterface
virtual void disableSimplexInterface()
Undo whatever setting changes the above method had to make.
OsiSolverInterface::setObjective
virtual void setObjective(const double *array)
Set the objective coefficients for all columns.
OsiSolverInterface::getRightHandSide
virtual const double * getRightHandSide() const =0
Get a pointer to an array[getNumRows()] of row right-hand sides.
OsiSolverInterface::ApplyCutsReturnCode::ApplyCutsReturnCode
ApplyCutsReturnCode(const ApplyCutsReturnCode &rhs)
Copy constructor.
Definition: OsiSolverInterface.hpp:90
OsiSolverInterface::getBasisStatus
virtual void getBasisStatus(int *cstat, int *rstat) const
Retrieve status information for column and row variables.
OsiSolverInterface::setObjSense
virtual void setObjSense(double s)=0
Set the objective function sense.
OsiSolverInterface::getPrimalRays
virtual std::vector< double * > getPrimalRays(int maxNumRays) const =0
Get as many primal rays as the solver can provide.
OsiSolverInterface::applyRowCuts
virtual void applyRowCuts(int numberCuts, const OsiRowCut **cuts)
Apply a collection of row cuts which are all effective.
OsiSolverInterface::ApplyCutsReturnCode::intInconsistent_
int intInconsistent_
Counter for logically inconsistent cuts.
Definition: OsiSolverInterface.hpp:149
OsiSolverInterface::readMps
virtual int readMps(const char *filename, const char *extension="mps")
Read a problem in MPS format from the given filename.
OsiHintTry
@ OsiHintTry
This means it is only a hint.
Definition: OsiSolverParameters.hpp:135
OsiSolverInterface::deleteRowNames
virtual void deleteRowNames(int tgtStart, int len)
Delete len row names starting at index tgtStart.
OsiSolverInterface::getInfinity
virtual double getInfinity() const =0
Get the solver's value for infinity.
OsiSolverInterface::setRowSetTypes
virtual void setRowSetTypes(const int *indexFirst, const int *indexLast, const char *senseList, const double *rhsList, const double *rangeList)
Set the type of a set of rows.
OsiSolverInterface::readLp
virtual int readLp(const char *filename, const double epsilon=1e-5)
Read file in LP format from file with name filename.
OsiSolverInterface::writeMps
virtual void writeMps(const char *filename, const char *extension="mps", double objSense=0.0) const =0
Write the problem in MPS format to the specified file.
OsiSolverInterface::isFreeBinary
virtual bool isFreeBinary(int colIndex) const
Return true if the variable is binary and not fixed.
OsiSolverInterface::getBInvARow
virtual void getBInvARow(int row, double *z, double *slack=NULL) const
Get a row of the tableau.
OsiSolverInterface::getBInvCol
virtual void getBInvCol(int col, double *vec) const
Get a column of the basis inverse.
OsiSolverInterface::setColSolution
virtual void setColSolution(const double *colsol)=0
Set the primal solution variable values.
OsiCuts
Collections of row cuts and column cuts.
Definition: OsiCuts.hpp:19
OsiSolverInterface::addRows
virtual void addRows(const int numrows, const CoinPackedVectorBase *const *rows, const double *rowlb, const double *rowub)
Add a set of rows (constraints) to the problem.
OsiSolverInterface::getRowActivity
virtual const double * getRowActivity() const =0
Get a pointer to array[getNumRows()] of row activity levels.
OsiSolverInterface::passInMessageHandler
virtual void passInMessageHandler(CoinMessageHandler *handler)
Pass in a message handler.
OsiLastDblParam
@ OsiLastDblParam
End marker.
Definition: OsiSolverParameters.hpp:84
OsiSolverInterface::setLanguage
void setLanguage(CoinMessages::Language language)
Definition: OsiSolverInterface.hpp:1629
OsiSolverInterface::forceIntoRange
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.
Definition: OsiSolverInterface.hpp:1997
OsiSolverInterface::getColName
virtual std::string getColName(int colIndex, unsigned maxLen=static_cast< unsigned >(std::string::npos)) const
Return the name of the column.
OsiSolverInterface::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)=0
Load in a problem by copying the arguments.
OsiSolverInterface::ApplyCutsReturnCode::getNumInconsistentWrtIntegerModel
int getNumInconsistentWrtIntegerModel() const
Number of cuts inconsistent with the current model.
Definition: OsiSolverInterface.hpp:118
OsiAuxInfo
This class allows for a more structured use of algorithmic tweaking to an OsiSolverInterface.
Definition: OsiAuxInfo.hpp:21
OsiSolverInterface::modifiableObject
OsiObject * modifiableObject(int which) const
Get the specified object.
Definition: OsiSolverInterface.hpp:1683
OsiSolverInterface::findIntegersAndSOS
virtual int findIntegersAndSOS(bool justCount)
Identify integer variables and SOS and create corresponding objects.
OsiSolverInterface::addObjects
void addObjects(int numberObjects, OsiObject **objects)
Add in object information.
OsiSolverInterface::isContinuous
virtual bool isContinuous(int colIndex) const =0
Return true if the variable is continuous.
OsiSolverInterface::strictColSolution_
std::vector< double > strictColSolution_
Column solution satisfying lower and upper column bounds.
Definition: OsiSolverInterface.hpp:2065
OsiSolverInterface::dfltRowColName
virtual std::string dfltRowColName(char rc, int ndx, unsigned digits=7) const
Generate a standard name of the form Rnnnnnnn or Cnnnnnnn.
OsiSolverInterface::getColType
virtual const char * getColType(bool refresh=false) const
Return an array[getNumCols()] of column types.
OsiSolverInterface::setColSetBounds
virtual void setColSetBounds(const int *indexFirst, const int *indexLast, const double *boundList)
Set the upper and lower bounds of a set of columns.
OsiColCut
Column Cut Class.
Definition: OsiColCut.hpp:23
OsiSolverInterface::deleteObjects
void deleteObjects()
Delete all object information.
OsiSolverInterface::readGMPL
virtual int readGMPL(const char *filename, const char *dataname=NULL)
Read a problem in GMPL format from the given filenames.
OsiSolverInterface::getStrictColSolution
virtual const double * getStrictColSolution()
Get a pointer to an array[getNumCols()] of primal variable values guaranteed to be between the column...
OsiSolverInterface::isIntegerNonBinary
virtual bool isIntegerNonBinary(int colIndex) const
Return true if the variable is general integer.
OsiSolverInterface::branchAndBound
virtual void branchAndBound()=0
Invoke solver's built-in enumeration algorithm.
OsiSolverInterface::getRowUpper
virtual const double * getRowUpper() const =0
Get a pointer to an array[getNumRows()] of row upper bounds.
OsiLastIntParam
@ OsiLastIntParam
End marker.
Definition: OsiSolverParameters.hpp:49
OsiSolverInterface::setInitialData
void setInitialData()
Set OsiSolverInterface object state for default constructor.
OsiSolverInterface::getDualRays
virtual std::vector< double * > getDualRays(int maxNumRays, bool fullRay=false) const =0
Get as many dual rays as the solver can provide.
OsiSolverInterface::writeMpsNative
int writeMpsNative(const char *filename, const char **rowNames, const char **columnNames, int formatType=0, int numberAcross=2, double objSense=0.0, int numberSOS=0, const CoinSet *setInfo=NULL) const
Write the problem in MPS format to the specified file with more control over the output.
OsiSolverInterface::getPointerToWarmStart
virtual CoinWarmStart * getPointerToWarmStart(bool &mustDelete)
Get warm start information.
OsiSolverInterface::getNumIntegers
virtual int getNumIntegers() const
Get the number of integer variables.
OsiSolverInterface::columnType
const char * columnType(bool refresh=false) const
Return an array[getNumCols()] of column types.
Definition: OsiSolverInterface.hpp:593
OsiSolverInterface::getColSolution
virtual const double * getColSolution() const =0
Get a pointer to an array[getNumCols()] of primal variable values.
OsiSolverInterface::hintParam_
bool hintParam_[OsiLastHintParam]
Array of hint parameters.
Definition: OsiSolverInterface.hpp:2058
OsiSolverInterface::ws_
CoinWarmStart * ws_
Warm start information used for hot starts when the default hot start implementation is used.
Definition: OsiSolverInterface.hpp:2063
OsiSolverInterface::appDataEtc_
OsiAuxInfo * appDataEtc_
Pointer to user-defined data structure - and more if user wants.
Definition: OsiSolverInterface.hpp:2050
OsiSolverInterface::writeLpNative
int writeLpNative(FILE *fp, char const *const *const rowNames, char const *const *const columnNames, const double epsilon=1.0e-5, const int numberAcross=10, const int decimals=5, const double objSense=0.0, const bool useRowNames=true) const
Write the problem into the file pointed to by the parameter fp.
OsiSolverInterface::activateRowCutDebugger
virtual void activateRowCutDebugger(const double *solution, bool enforceOptimality=true)
Activate the row cut debugger using a full solution array.
OsiSolverInterface::objects
OsiObject ** objects() const
Get the array of objects.
Definition: OsiSolverInterface.hpp:1678
OsiSolverInterface::setAuxiliaryInfo
void setAuxiliaryInfo(OsiAuxInfo *auxiliaryInfo)
Create a clone of an Auxiliary Information object.
OsiSolverInterface::setObjCoeff
virtual void setObjCoeff(int elementIndex, double elementValue)=0
Set an objective function coefficient.
OsiSolverInterface::convertBoundToSense
void convertBoundToSense(const double lower, const double upper, char &sense, double &right, double &range) const
A quick inlined function to convert from the lb/ub style of constraint definition to the sense/rhs/ra...
Definition: OsiSolverInterface.hpp:2081
OsiSolverInterface::addCol
virtual void addCol(const CoinPackedVectorBase &vec, const double collb, const double colub, const double obj)=0
Add a column (primal variable) to the problem.
OsiRowCut
Row Cut Class.
Definition: OsiRowCut.hpp:29
OsiSolverInterface::messages_
CoinMessages messages_
Messages.
Definition: OsiSolverInterface.hpp:2027
OsiSolverInterface::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)=0
Load in a problem by copying the arguments.
OsiSolverInterface::reducedCostFix
virtual int reducedCostFix(double gap, bool justInteger=true)
Fix variables at bound based on reduced cost.
OsiSolverInterface::intParam_
int intParam_[OsiLastIntParam]
Array of integer parameters.
Definition: OsiSolverInterface.hpp:2052
OsiSolverInterface::ApplyCutsReturnCode::infeasible_
int infeasible_
Counter for infeasible cuts.
Definition: OsiSolverInterface.hpp:153
OsiSolverInterface::findIntegers
void findIntegers(bool justCount)
Identify integer variables and create corresponding objects.
OsiSolverInterface::isProvenDualInfeasible
virtual bool isProvenDualInfeasible() const =0
Is dual infeasibility proven?
OsiSolverInterface::writeLp
virtual void writeLp(FILE *fp, double epsilon=1e-5, int numberAcross=10, int decimals=5, double objSense=0.0, bool useRowNames=true) const
Write the problem into the file pointed to by the parameter fp.
OsiSolverInterface::getApplicationData
void * getApplicationData() const
Get application data.
OsiSolverInterface::colNames_
OsiNameVec colNames_
Column names.
Definition: OsiSolverInterface.hpp:2070
OsiSolverInterface::numberIntegers_
int numberIntegers_
Number of integers.
Definition: OsiSolverInterface.hpp:2029
OsiSolverInterface::unmarkHotStart
virtual void unmarkHotStart()
Delete the hot start snapshot.
OsiSolverInterface::dblParam_
double dblParam_[OsiLastDblParam]
Array of double parameters.
Definition: OsiSolverInterface.hpp:2054
OsiSolverInterface::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)=0
Load in a problem by copying the arguments.
OsiIntParam
OsiIntParam
Definition: OsiSolverParameters.hpp:8
OsiSolverInterface::setRowUpper
virtual void setRowUpper(int elementIndex, double elementValue)=0
Set a single row upper bound.
OsiSolverInterface::resolve
virtual void resolve()=0
Resolve an LP relaxation after problem modification.
OsiSolverInterface::enableFactorization
virtual void enableFactorization() const
Prepare the solver for the use of tableau access methods.
OsiSolverInterface::setRowType
virtual void setRowType(int index, char sense, double rightHandSide, double range)=0
Set the type of a single row.
OsiSolverInterface::ApplyCutsReturnCode::applied_
int applied_
Counter for applied cuts.
Definition: OsiSolverInterface.hpp:157
OsiSolverInterface::setHintParam
virtual bool setHintParam(OsiHintParam key, bool yesNo=true, OsiHintStrength strength=OsiHintTry, void *=NULL)
Set a hint parameter.
Definition: OsiSolverInterface.hpp:294
OsiSolverInterface::restoreBaseModel
virtual void restoreBaseModel(int numberRows)
Reduce the constraint system to the specified number of constraints.
OsiSolverInterface::isIterationLimitReached
virtual bool isIterationLimitReached() const =0
Iteration limit reached?
OsiSolverInterface::isProvenPrimalInfeasible
virtual bool isProvenPrimalInfeasible() const =0
Is primal infeasibility proven?
OsiSolverInterface::operator=
OsiSolverInterface & operator=(const OsiSolverInterface &rhs)
Assignment operator.
OsiSolverInterface::saveBaseModel
virtual void saveBaseModel()
Save a copy of the base model.
Definition: OsiSolverInterface.hpp:1240
OsiSolverInterface::clone
virtual OsiSolverInterface * clone(bool copyData=true) const =0
Clone.
OsiSolverInterface::solveFromHotStart
virtual void solveFromHotStart()
Optimize starting from the hot start snapshot.
OsiSolverInterface::ApplyCutsReturnCode::getNumInconsistent
int getNumInconsistent() const
Number of logically inconsistent cuts.
Definition: OsiSolverInterface.hpp:115
OsiLastHintParam
@ OsiLastHintParam
Just a marker, so that OsiSolverInterface can allocate a static sized array to store parameters.
Definition: OsiSolverParameters.hpp:128
OsiSolverInterface::deleteColNames
virtual void deleteColNames(int tgtStart, int len)
Delete len column names starting at index tgtStart.
OsiSolverInterface::getHintParam
virtual bool getHintParam(OsiHintParam key, bool &yesNo, OsiHintStrength &strength, void *&otherInformation) const
Get a hint parameter (all information)
Definition: OsiSolverInterface.hpp:333
OsiSolverInterface::copyParameters
void copyParameters(OsiSolverInterface &rhs)
Copy all parameters in this section from one solver to another.
OsiSolverInterface::ApplyCutsReturnCode::OsiClpSolverInterface
friend class OsiClpSolverInterface
Definition: OsiSolverInterface.hpp:76
OsiSolverInterface::ApplyCutsReturnCode
Internal class for obtaining status from the applyCuts method.
Definition: OsiSolverInterface.hpp:74
OsiSolverInterface::getObjSense
virtual double getObjSense() const =0
Get the objective function sense.
OsiSolverInterface::dualPivotResult
virtual int dualPivotResult(int &colIn, int &sign, int colOut, int outStatus, double &t, CoinPackedVector *dx)
Obtain a result of the dual pivot (similar to the previous method) Differences: entering variable and...
OsiSolverInterface::applyRowCuts
virtual void applyRowCuts(int numberCuts, const OsiRowCut *cuts)
Apply a collection of row cuts which are all effective.
OsiSolverInterface::differentModel
int differentModel(OsiSolverInterface &other, bool ignoreNames=true)
Check two models against each other.
OsiSolverInterface::getAuxiliaryInfo
OsiAuxInfo * getAuxiliaryInfo() const
Get pointer to auxiliary info object.
OsiSolverInterface::reset
virtual void reset()
Reset the solver interface.
OsiSolverInterface::applyRowCut
virtual void applyRowCut(const OsiRowCut &rc)=0
Apply a row cut (append to the constraint matrix).
OsiSolverInterface::setColNames
virtual void setColNames(OsiNameVec &srcNames, int srcStart, int len, int tgtStart)
Set multiple column names.
OsiSolverInterface::ApplyCutsReturnCode::getNumIneffective
int getNumIneffective() const
Number of redundant or ineffective cuts.
Definition: OsiSolverInterface.hpp:124
OsiSolverInterface::writeLp
virtual void writeLp(const char *filename, const char *extension="lp", double epsilon=1e-5, int numberAcross=10, int decimals=5, double objSense=0.0, bool useRowNames=true) const
Write the problem into an Lp file of the given filename with the specified extension.
OsiSolverInterface::getIntegerTolerance
double getIntegerTolerance() const
Return the integrality tolerance of the underlying solver.
Definition: OsiSolverInterface.hpp:386
OsiSolverInterface::OsiSolverInterfaceCommonUnitTest
friend void OsiSolverInterfaceCommonUnitTest(const OsiSolverInterface *emptySi, const std::string &mpsDir, const std::string &netlibDir)
A function that tests the methods in the OsiSolverInterface class.
OsiSolverInterface::setInteger
virtual void setInteger(int index)=0
Set the index-th variable to be an integer variable.
OsiSolverInterface::getBasics
virtual void getBasics(int *index) const
Get indices of basic variables.
OsiSolverInterface::setRowColNames
void setRowColNames(CoinLpIO &mod)
Set row and column names from a CoinLpIO object.
OsiSolverInterface::getHintParam
virtual bool getHintParam(OsiHintParam key, bool &yesNo) const
Get a hint parameter (sense only)
Definition: OsiSolverInterface.hpp:359
OsiSolverInterface::replaceMatrix
virtual void replaceMatrix(const CoinPackedMatrix &)
Replace the constraint matrix.
Definition: OsiSolverInterface.hpp:1234
OsiSolverInterface::setObjName
virtual void setObjName(std::string name)
Set the name of the objective function.
Definition: OsiSolverInterface.hpp:929
OsiDblParam
OsiDblParam
Definition: OsiSolverParameters.hpp:52
OsiSolverInterface::setContinuous
virtual void setContinuous(int index)=0
Set the index-th variable to be a continuous variable.
OsiSolverInterface::getMutableMatrixByRow
virtual CoinPackedMatrix * getMutableMatrixByRow() const
Get a pointer to a mutable row-wise copy of the matrix.
Definition: OsiSolverInterface.hpp:620
OsiSolverInterface::basisIsAvailable
virtual bool basisIsAvailable() const
Check if an optimal basis is available.
OsiVectorInt
std::vector< int > OsiVectorInt
Vector of int.
Definition: OsiCollections.hpp:22
OsiSolverInterface::getHintParam
virtual bool getHintParam(OsiHintParam key, bool &yesNo, OsiHintStrength &strength) const
Get a hint parameter (sense and strength only)
Definition: OsiSolverInterface.hpp:347
OsiSolverInterface::isProvenOptimal
virtual bool isProvenOptimal() const =0
Is optimality proven?
OsiSolverInterface::getRowSense
virtual const char * getRowSense() const =0
Get a pointer to an array[getNumRows()] of row constraint senses.
OsiSolverInterface::getIntParam
virtual bool getIntParam(OsiIntParam key, int &value) const
Get an integer parameter.
Definition: OsiSolverInterface.hpp:307
OsiGrbSolverInterface
Gurobi Solver Interface.
Definition: OsiGrbSolverInterface.hpp:29
OsiSolverInterface::isDualObjectiveLimitReached
virtual bool isDualObjectiveLimitReached() const
Is the given dual objective limit reached?
OsiSolverInterface::pivot
virtual int pivot(int colIn, int colOut, int outStatus)
Perform a pivot by substituting a colIn for colOut in the basis.
OsiSolverInterface::assignProblem
virtual void assignProblem(CoinPackedMatrix *&matrix, double *&collb, double *&colub, double *&obj, double *&rowlb, double *&rowub)=0
Load in a problem by assuming ownership of the arguments.
OsiSolverInterface::rowCutDebugger_
OsiRowCutDebugger * rowCutDebugger_
Pointer to row cut debugger object.
Definition: OsiSolverInterface.hpp:2016
OsiSolverInterface::isPrimalObjectiveLimitReached
virtual bool isPrimalObjectiveLimitReached() const
Is the given primal objective limit reached?
OsiSolverInterface::OsiSolverInterfaceMpsUnitTest
friend void OsiSolverInterfaceMpsUnitTest(const std::vector< OsiSolverInterface * > &vecSiP, const std::string &mpsDir)
A function that tests that a lot of problems given in MPS files (mostly the NETLIB problems) solve pr...
OsiRowCutDebugger
Validate cuts against a known solution.
Definition: OsiRowCutDebugger.hpp:42
OsiSolverInterface::getColUpper
virtual const double * getColUpper() const =0
Get a pointer to an array[getNumCols()] of column upper bounds.
OsiSolverInterface::numberObjects_
int numberObjects_
Total number of objects.
Definition: OsiSolverInterface.hpp:2031
OsiSolverInterface::optimalBasisIsAvailable
bool optimalBasisIsAvailable() const
Synonym for basisIsAvailable.
Definition: OsiSolverInterface.hpp:1809
OsiSolverInterface::ApplyCutsReturnCode::incrementInfeasible
void incrementInfeasible()
Increment infeasible cut counter.
Definition: OsiSolverInterface.hpp:139
OsiHintStrength
OsiHintStrength
Definition: OsiSolverParameters.hpp:131
OsiSolverInterface::~OsiSolverInterface
virtual ~OsiSolverInterface()
Destructor.
OsiSolverInterface::getEmptyWarmStart
virtual CoinWarmStart * getEmptyWarmStart() const =0
Get an empty warm start object.
OsiSolverInterface::primalPivotResult
virtual int primalPivotResult(int colIn, int sign, int &colOut, int &outStatus, double &t, CoinPackedVector *dx)
Obtain a result of the primal pivot Outputs: colOut – leaving column, outStatus – its status,...
OsiSolverInterface::getRowLower
virtual const double * getRowLower() const =0
Get a pointer to an array[getNumRows()] of row lower bounds.
OsiSolverInterface::getRowName
virtual std::string getRowName(int rowIndex, unsigned maxLen=static_cast< unsigned >(std::string::npos)) const
Return the name of the row.
OsiSolverInterface::addCols
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.
OsiSolverInterface::setContinuous
virtual void setContinuous(const int *indices, int len)
Set the variables listed in indices (which is of length len) to be continuous variables.
OsiSolverInterface::getMutableMatrixByCol
virtual CoinPackedMatrix * getMutableMatrixByCol() const
Get a pointer to a mutable column-wise copy of the matrix.
Definition: OsiSolverInterface.hpp:627
OsiSolverInterface::setIntParam
virtual bool setIntParam(OsiIntParam key, int value)
Set an integer parameter.
Definition: OsiSolverInterface.hpp:266
OsiSolverInterface::canDoSimplexInterface
virtual int canDoSimplexInterface() const
Return the simplex implementation level.
OsiSolverInterface::getReducedGradient
virtual void getReducedGradient(double *columnReducedCosts, double *duals, const double *c) const
Calculate duals and reduced costs for the given objective coefficients.
OsiLastStrParam
@ OsiLastStrParam
End marker.
Definition: OsiSolverParameters.hpp:104
OsiSolverInterface::getObjName
virtual std::string getObjName(unsigned maxLen=static_cast< unsigned >(std::string::npos)) const
Return the name of the objective function.
OsiSolverInterface::setRowLower
virtual void setRowLower(int elementIndex, double elementValue)=0
Set a single row lower bound.
OsiSolverInterface::forceFeasible
double forceFeasible()
Use current solution to set bounds so current integer feasible solution will stay feasible.
OsiSolverInterface::getStrParam
virtual bool getStrParam(OsiStrParam key, std::string &value) const
Get a string parameter.
Definition: OsiSolverInterface.hpp:319
OsiSolverInterface::setRowBounds
virtual void setRowBounds(int elementIndex, double lower, double upper)
Set a single row lower and upper bound.
Definition: OsiSolverInterface.hpp:805
OsiSolverInterface::setRowColNames
void setRowColNames(const CoinMpsIO &mps)
Set row and column names from a CoinMpsIO object.
OsiSolverInterface::applyColCut
virtual void applyColCut(const OsiColCut &cc)=0
Apply a column cut (adjust the bounds of one or more variables).
OsiSolverInterface::objName_
std::string objName_
Objective name.
Definition: OsiSolverInterface.hpp:2072
OsiSolverInterface::setColName
virtual void setColName(int ndx, std::string name)
Set a column name.
OsiSolverInterface::getBInvRow
virtual void getBInvRow(int row, double *z) const
Get a row of the basis inverse.
OsiSolverInterface::setRowSetBounds
virtual void setRowSetBounds(const int *indexFirst, const int *indexLast, const double *boundList)
Set the bounds on a set of rows.
OsiSolverInterface::getFractionalIndices
virtual OsiVectorInt getFractionalIndices(const double etol=1.e-05) const
Get vector of indices of primal variables which are integer variables but have fractional values in t...
OsiSolverInterface::markHotStart
virtual void markHotStart()
Create a hot start snapshot of the optimization process.
OsiSolverInterface::defaultHandler
bool defaultHandler() const
Return true if default handler.
Definition: OsiSolverInterface.hpp:1641
OsiSolverInterface::setColLower
virtual void setColLower(int elementIndex, double elementValue)=0
Set a single column lower bound.
OsiSolverInterface::applyCuts
virtual ApplyCutsReturnCode applyCuts(const OsiCuts &cs, double effectivenessLb=0.0)
Apply a collection of cuts.
OsiSolverInterface::getNumCols
virtual int getNumCols() const =0
Get the number of columns.
OsiSolverInterface::strParam_
std::string strParam_[OsiLastStrParam]
Array of string parameters.
Definition: OsiSolverInterface.hpp:2056
OsiSolverResult
Solver Result Class.
Definition: OsiSolverBranch.hpp:83
OsiSolverInterface::setRowColNames
void setRowColNames(CoinModel &mod)
Set row and column names from a CoinModel object.
OsiSolverInterface::setDblParam
virtual bool setDblParam(OsiDblParam key, double value)
Set a double parameter.
Definition: OsiSolverInterface.hpp:272
OsiSolverInterface::getBInvACol
virtual void getBInvACol(int col, double *vec) const
Get a column of the tableau.
OsiSolverInterface::loadProblem
virtual void loadProblem(const CoinPackedMatrix &matrix, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub)=0
Load in a problem by copying the arguments.
OsiSolverInterface::addRow
virtual void addRow(const CoinPackedVectorBase &vec, const double rowlb, const double rowub)=0
Add a row (constraint) to the problem.
OsiSolverInterface::setStrParam
virtual bool setStrParam(OsiStrParam key, const std::string &value)
Set a string parameter.
Definition: OsiSolverInterface.hpp:278
OsiSolverInterface::deleteRows
virtual void deleteRows(const int num, const int *rowIndices)=0
Delete a set of rows (constraints) from the problem.
OsiSolverInterface::OsiNameVec
std::vector< std::string > OsiNameVec
Data type for name vectors.
Definition: OsiSolverInterface.hpp:888
OsiSolverInterface::convertSenseToBound
void convertSenseToBound(const char sense, const double right, const double range, double &lower, double &upper) const
A quick inlined function to convert from the sense/rhs/range style of constraint definition to the lb...
Definition: OsiSolverInterface.hpp:2115
OsiSolverInterface::messagesPointer
CoinMessages * messagesPointer()
Return a pointer to the current set of messages.
Definition: OsiSolverInterface.hpp:1638
OsiSolverInterface::initialSolve
virtual void initialSolve()=0
Solve initial LP relaxation.
OsiSolverInterface::writeLpNative
int writeLpNative(const char *filename, char const *const *const rowNames, char const *const *const columnNames, const double epsilon=1.0e-5, const int numberAcross=10, const int decimals=5, const double objSense=0.0, const bool useRowNames=true) const
Write the problem into an Lp file.
OsiSolverInterface::rowNames_
OsiNameVec rowNames_
Row names.
Definition: OsiSolverInterface.hpp:2068
OsiSolverInterface::messageHandler
CoinMessageHandler * messageHandler() const
Return a pointer to the current message handler.
Definition: OsiSolverInterface.hpp:1632
OsiSolverInterface::activateRowCutDebugger
virtual void activateRowCutDebugger(const char *modelName)
Activate the row cut debugger.
OsiSolverInterface::defaultHandler_
bool defaultHandler_
Flag to say if the currrent handler is the default handler.
Definition: OsiSolverInterface.hpp:2025
OsiSolverInterface
Abstract Base Class for describing an interface to a solver.
Definition: OsiSolverInterface.hpp:62
OsiSolverInterface::setObjCoeffSet
virtual void setObjCoeffSet(const int *indexFirst, const int *indexLast, const double *coeffList)
Set a set of objective function coefficients.
OsiSolverInterface::getDblParam
virtual bool getDblParam(OsiDblParam key, double &value) const
Get a double parameter.
Definition: OsiSolverInterface.hpp:313
OsiSolverInterface::getColNames
virtual const OsiNameVec & getColNames()
Return a pointer to a vector of column names.
OsiSolverInterface::getColLower
virtual const double * getColLower() const =0
Get a pointer to an array[getNumCols()] of column lower bounds.
OsiSolverInterface::deleteCols
virtual void deleteCols(const int num, const int *colIndices)=0
Remove a set of columns (primal variables) from the problem.
OsiSolverInterface::getObjCoefficients
virtual const double * getObjCoefficients() const =0
Get a pointer to an array[getNumCols()] of objective function coefficients.
OsiSolverInterface::getMatrixByRow
virtual const CoinPackedMatrix * getMatrixByRow() const =0
Get a pointer to a row-wise copy of the matrix.
OsiStrParam
OsiStrParam
Definition: OsiSolverParameters.hpp:88
OsiSolverInterface::hintStrength_
OsiHintStrength hintStrength_[OsiLastHintParam]
Array of hint strengths.
Definition: OsiSolverInterface.hpp:2060
OsiSolverInterface::setWarmStart
virtual bool setWarmStart(const CoinWarmStart *warmstart)=0
Set warm start information.