Osi  0.108.8
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 
63  const OsiSolverInterface *emptySi,
64  const std::string &mpsDir,
65  const std::string &netlibDir);
67  const std::vector< OsiSolverInterface * > &vecSiP,
68  const std::string &mpsDir);
69 
70 public:
73  friend class OsiSolverInterface;
74  friend class OsiClpSolverInterface;
75  friend class OsiGrbSolverInterface;
76 
77  public:
79 
82  : intInconsistent_(0)
83  , extInconsistent_(0)
84  , infeasible_(0)
85  , ineffective_(0)
86  , applied_(0)
87  {
88  }
95  , applied_(rhs.applied_)
96  {
97  }
100  {
101  if (this != &rhs) {
104  infeasible_ = rhs.infeasible_;
106  applied_ = rhs.applied_;
107  }
108  return *this;
109  }
113 
116  inline int getNumInconsistent() const
118  {
119  return intInconsistent_;
120  }
123  {
124  return extInconsistent_;
125  }
127  inline int getNumInfeasible() const
128  {
129  return infeasible_;
130  }
132  inline int getNumIneffective() const
133  {
134  return ineffective_;
135  }
137  inline int getNumApplied() const
138  {
139  return applied_;
140  }
142 
143  private:
151  inline void incrementInfeasible() { infeasible_++; }
153  inline void incrementIneffective() { ineffective_++; }
155  inline void incrementApplied() { applied_++; }
157 
159 
160  int intInconsistent_;
169  int applied_;
171  };
172 
173  //---------------------------------------------------------------------------
174 
176 
177  virtual void initialSolve() = 0;
179 
185  virtual void resolve() = 0;
186 
188  virtual void branchAndBound() = 0;
189 
190 #ifdef CBC_NEXT_VERSION
191  /*
192  Would it make sense to collect all of these routines in a `MIP Helper'
193  section? It'd make it easier for users and implementors to find them.
194  */
212  virtual int solveBranches(int depth, const OsiSolverBranch *branch,
213  OsiSolverResult *result,
214  int &numberSolves, int &numberIterations,
215  bool forceBranch = false);
216 #endif
217 
218 
219  //---------------------------------------------------------------------------
277  virtual bool setIntParam(OsiIntParam key, int value)
279  {
280  if (key == OsiLastIntParam)
281  return (false);
282  intParam_[key] = value;
283  return true;
284  }
286  virtual bool setDblParam(OsiDblParam key, double value)
287  {
288  if (key == OsiLastDblParam)
289  return (false);
290  dblParam_[key] = value;
291  return true;
292  }
294  virtual bool setStrParam(OsiStrParam key, const std::string &value)
295  {
296  if (key == OsiLastStrParam)
297  return (false);
298  strParam_[key] = value;
299  return true;
300  }
312  virtual bool setHintParam(OsiHintParam key, bool yesNo = true,
313  OsiHintStrength strength = OsiHintTry,
314  void * /*otherInformation*/ = NULL)
315  {
316  if (key == OsiLastHintParam)
317  return false;
318  hintParam_[key] = yesNo;
319  hintStrength_[key] = strength;
320  if (strength == OsiForceDo)
321  throw CoinError("OsiForceDo illegal",
322  "setHintParam", "OsiSolverInterface");
323  return true;
324  }
326  virtual bool getIntParam(OsiIntParam key, int &value) const
327  {
328  if (key == OsiLastIntParam)
329  return (false);
330  value = intParam_[key];
331  return true;
332  }
334  virtual bool getDblParam(OsiDblParam key, double &value) const
335  {
336  if (key == OsiLastDblParam)
337  return (false);
338  value = dblParam_[key];
339  return true;
340  }
342  virtual bool getStrParam(OsiStrParam key, std::string &value) const
343  {
344  if (key == OsiLastStrParam)
345  return (false);
346  value = strParam_[key];
347  return true;
348  }
358  virtual bool getHintParam(OsiHintParam key, bool &yesNo,
359  OsiHintStrength &strength,
360  void *&otherInformation) const
361  {
362  if (key == OsiLastHintParam)
363  return false;
364  yesNo = hintParam_[key];
365  strength = hintStrength_[key];
366  otherInformation = NULL;
367  return true;
368  }
373  virtual bool getHintParam(OsiHintParam key, bool &yesNo,
374  OsiHintStrength &strength) const
375  {
376  if (key == OsiLastHintParam)
377  return false;
378  yesNo = hintParam_[key];
379  strength = hintStrength_[key];
380  return true;
381  }
386  virtual bool getHintParam(OsiHintParam key, bool &yesNo) const
387  {
388  if (key == OsiLastHintParam)
389  return false;
390  yesNo = hintParam_[key];
391  return true;
392  }
400 
414  inline double getIntegerTolerance() const
415  {
417  }
419 
420  //---------------------------------------------------------------------------
422 
423  virtual bool isAbandoned() const = 0;
426  virtual bool isProvenOptimal() const = 0;
428  virtual bool isProvenPrimalInfeasible() const = 0;
430  virtual bool isProvenDualInfeasible() const = 0;
432  virtual bool isPrimalObjectiveLimitReached() const;
434  virtual bool isDualObjectiveLimitReached() const;
436  virtual bool isIterationLimitReached() const = 0;
438 
439  //---------------------------------------------------------------------------
457  virtual CoinWarmStart *getEmptyWarmStart() const = 0;
458 
465  virtual CoinWarmStart *getWarmStart() const = 0;
474  virtual CoinWarmStart *getPointerToWarmStart(bool &mustDelete);
475 
484  virtual bool setWarmStart(const CoinWarmStart *warmstart) = 0;
486 
487  //---------------------------------------------------------------------------
508  virtual void markHotStart();
511  virtual void solveFromHotStart();
513  virtual void unmarkHotStart();
515 
516  //---------------------------------------------------------------------------
527  virtual int getNumCols() const = 0;
529 
531  virtual int getNumRows() const = 0;
532 
534  virtual CoinBigIndex getNumElements() const = 0;
535 
537  virtual int getNumIntegers() const;
538 
540  virtual const double *getColLower() const = 0;
541 
543  virtual const double *getColUpper() const = 0;
544 
555  virtual const char *getRowSense() const = 0;
556 
570  virtual const double *getRightHandSide() const = 0;
571 
581  virtual const double *getRowRange() const = 0;
582 
584  virtual const double *getRowLower() const = 0;
585 
587  virtual const double *getRowUpper() const = 0;
588 
592  virtual const double *getObjCoefficients() const = 0;
593 
599  virtual double getObjSense() const = 0;
600 
602  virtual bool isContinuous(int colIndex) const = 0;
603 
605  virtual bool isBinary(int colIndex) const;
606 
611  virtual bool isInteger(int colIndex) const;
612 
614  virtual bool isIntegerNonBinary(int colIndex) const;
615 
617  virtual bool isFreeBinary(int colIndex) const;
618 
623  inline const char *columnType(bool refresh = false) const
624  {
625  return getColType(refresh);
626  }
627 
629  inline void setColumnType(int iColumn, char type)
630  {
631  if (!columnType_)
632  getColType(true);
633  columnType_[iColumn] = type;
634  }
635 
649  virtual const char *getColType(bool refresh = false) const;
650 
652  virtual const CoinPackedMatrix *getMatrixByRow() const = 0;
653 
655  virtual const CoinPackedMatrix *getMatrixByCol() const = 0;
656 
662  virtual CoinPackedMatrix *getMutableMatrixByRow() const { return NULL; }
663 
669  virtual CoinPackedMatrix *getMutableMatrixByCol() const { return NULL; }
670 
672  virtual double getInfinity() const = 0;
674 
677  virtual const double *getColSolution() const = 0;
679 
683  virtual const double *getStrictColSolution();
684 
686  virtual const double *getRowPrice() const = 0;
687 
689  virtual const double *getReducedCost() const = 0;
690 
696  virtual const double *getRowActivity() const = 0;
697 
699  virtual double getObjValue() const = 0;
700 
704  virtual int getIterationCount() const = 0;
705 
728  virtual std::vector< double * > getDualRays(int maxNumRays,
729  bool fullRay = false) const = 0;
730 
746  virtual std::vector< double * > getPrimalRays(int maxNumRays) const = 0;
747 
750  virtual OsiVectorInt getFractionalIndices(const double etol = 1.e-05)
751  const;
753 
754  //-------------------------------------------------------------------------
767  virtual void setObjCoeff(int elementIndex, double elementValue) = 0;
768 
770  virtual void setObjCoeffSet(const int *indexFirst,
771  const int *indexLast,
772  const double *coeffList);
773 
779  virtual void setObjective(const double *array);
780 
791  virtual void setObjSense(double s) = 0;
792 
795  virtual void setColLower(int elementIndex, double elementValue) = 0;
796 
802  virtual void setColLower(const double *array);
803 
806  virtual void setColUpper(int elementIndex, double elementValue) = 0;
807 
813  virtual void setColUpper(const double *array);
814 
818  virtual void setColBounds(int elementIndex,
819  double lower, double upper)
820  {
821  setColLower(elementIndex, lower);
822  setColUpper(elementIndex, upper);
823  }
824 
831  virtual void setColSetBounds(const int *indexFirst,
832  const int *indexLast,
833  const double *boundList);
834 
837  virtual void setRowLower(int elementIndex, double elementValue) = 0;
838 
841  virtual void setRowUpper(int elementIndex, double elementValue) = 0;
842 
846  virtual void setRowBounds(int elementIndex,
847  double lower, double upper)
848  {
849  setRowLower(elementIndex, lower);
850  setRowUpper(elementIndex, upper);
851  }
852 
859  virtual void setRowSetBounds(const int *indexFirst,
860  const int *indexLast,
861  const double *boundList);
862 
864  virtual void setRowType(int index, char sense, double rightHandSide,
865  double range)
866  = 0;
867 
872  virtual void setRowSetTypes(const int *indexFirst,
873  const int *indexLast,
874  const char *senseList,
875  const double *rhsList,
876  const double *rangeList);
877 
887  virtual void setColSolution(const double *colsol) = 0;
888 
898  virtual void setRowPrice(const double *rowprice) = 0;
899 
908  virtual int reducedCostFix(double gap, bool justInteger = true);
910 
911  //-------------------------------------------------------------------------
915  virtual void setContinuous(int index) = 0;
917  virtual void setInteger(int index) = 0;
920  virtual void setContinuous(const int *indices, int len);
923  virtual void setInteger(const int *indices, int len);
925  //-------------------------------------------------------------------------
926 
927  //-------------------------------------------------------------------------
928 
930  typedef std::vector< std::string > OsiNameVec;
931 
952 
962  virtual std::string dfltRowColName(char rc,
963  int ndx, unsigned digits = 7) const;
964 
967  virtual std::string getObjName(unsigned maxLen = static_cast< unsigned >(std::string::npos)) const;
968 
971  virtual inline void setObjName(std::string name)
972  {
973  objName_ = name;
974  }
975 
982  virtual std::string getRowName(int rowIndex,
983  unsigned maxLen = static_cast< unsigned >(std::string::npos)) const;
984 
996  virtual const OsiNameVec &getRowNames();
997 
1003  virtual void setRowName(int ndx, std::string name);
1004 
1011  virtual void setRowNames(OsiNameVec &srcNames,
1012  int srcStart, int len, int tgtStart);
1013 
1019  virtual void deleteRowNames(int tgtStart, int len);
1020 
1027  virtual std::string getColName(int colIndex,
1028  unsigned maxLen = static_cast< unsigned >(std::string::npos)) const;
1029 
1039  virtual const OsiNameVec &getColNames();
1040 
1046  virtual void setColName(int ndx, std::string name);
1047 
1054  virtual void setColNames(OsiNameVec &srcNames,
1055  int srcStart, int len, int tgtStart);
1056 
1062  virtual void deleteColNames(int tgtStart, int len);
1063 
1070  void setRowColNames(const CoinMpsIO &mps);
1071 
1077  void setRowColNames(CoinModel &mod);
1078 
1085  void setRowColNames(CoinLpIO &mod);
1086 
1088  //-------------------------------------------------------------------------
1089 
1090  //-------------------------------------------------------------------------
1096 
1098  virtual void addCol(const CoinPackedVectorBase &vec,
1099  const double collb, const double colub,
1100  const double obj)
1101  = 0;
1102 
1108  virtual void addCol(const CoinPackedVectorBase &vec,
1109  const double collb, const double colub,
1110  const double obj, std::string name);
1111 
1113  virtual void addCol(int numberElements,
1114  const int *rows, const double *elements,
1115  const double collb, const double colub,
1116  const double obj);
1117 
1123  virtual void addCol(int numberElements,
1124  const int *rows, const double *elements,
1125  const double collb, const double colub,
1126  const double obj, std::string name);
1127 
1133  virtual void addCols(const int numcols,
1134  const CoinPackedVectorBase *const *cols,
1135  const double *collb, const double *colub,
1136  const double *obj);
1137 
1143  virtual void addCols(const int numcols, const CoinBigIndex *columnStarts,
1144  const int *rows, const double *elements,
1145  const double *collb, const double *colub,
1146  const double *obj);
1147 
1149  void addCols(const CoinBuild &buildObject);
1150 
1156  int addCols(CoinModel &modelObject);
1157 
1158 #if 0
1159 
1160  virtual void addCols(const CoinPackedMatrix& matrix,
1161  const double* collb, const double* colub,
1162  const double* obj);
1163 #endif
1164 
1171  virtual void deleteCols(const int num, const int *colIndices) = 0;
1172 
1174  virtual void addRow(const CoinPackedVectorBase &vec,
1175  const double rowlb, const double rowub)
1176  = 0;
1177 
1183  virtual void addRow(const CoinPackedVectorBase &vec,
1184  const double rowlb, const double rowub,
1185  std::string name);
1186 
1188  virtual void addRow(const CoinPackedVectorBase &vec,
1189  const char rowsen, const double rowrhs,
1190  const double rowrng)
1191  = 0;
1192 
1198  virtual void addRow(const CoinPackedVectorBase &vec,
1199  const char rowsen, const double rowrhs,
1200  const double rowrng, std::string name);
1201 
1206  virtual void addRow(int numberElements,
1207  const int *columns, const double *element,
1208  const double rowlb, const double rowub);
1209 
1215  virtual void addRows(const int numrows,
1216  const CoinPackedVectorBase *const *rows,
1217  const double *rowlb, const double *rowub);
1218 
1224  virtual void addRows(const int numrows,
1225  const CoinPackedVectorBase *const *rows,
1226  const char *rowsen, const double *rowrhs,
1227  const double *rowrng);
1228 
1234  virtual void addRows(const int numrows, const CoinBigIndex *rowStarts,
1235  const int *columns, const double *element,
1236  const double *rowlb, const double *rowub);
1237 
1239  void addRows(const CoinBuild &buildObject);
1240 
1249  int addRows(CoinModel &modelObject);
1250 
1251 #if 0
1252 
1253  virtual void addRows(const CoinPackedMatrix& matrix,
1254  const double* rowlb, const double* rowub);
1256  virtual void addRows(const CoinPackedMatrix& matrix,
1257  const char* rowsen, const double* rowrhs,
1258  const double* rowrng);
1259 #endif
1260 
1266  virtual void deleteRows(const int num, const int *rowIndices) = 0;
1267 
1274  virtual void replaceMatrixOptional(const CoinPackedMatrix &) {}
1275 
1280  virtual void replaceMatrix(const CoinPackedMatrix &) { abort(); }
1281 
1286  virtual void saveBaseModel() {}
1287 
1301  virtual void restoreBaseModel(int numberRows);
1302  //-----------------------------------------------------------------------
1325  virtual ApplyCutsReturnCode applyCuts(const OsiCuts &cs,
1326  double effectivenessLb = 0.0);
1327 
1332  virtual void applyRowCuts(int numberCuts, const OsiRowCut *cuts);
1333 
1337  virtual void applyRowCuts(int numberCuts, const OsiRowCut **cuts);
1338 
1340  void deleteBranchingInfo(int numberDeleted, const int *which);
1341 
1343 
1344  //---------------------------------------------------------------------------
1345 
1363  virtual void loadProblem(const CoinPackedMatrix &matrix,
1364  const double *collb, const double *colub,
1365  const double *obj,
1366  const double *rowlb, const double *rowub)
1367  = 0;
1368 
1378  virtual void assignProblem(CoinPackedMatrix *&matrix,
1379  double *&collb, double *&colub, double *&obj,
1380  double *&rowlb, double *&rowub)
1381  = 0;
1382 
1399  virtual void loadProblem(const CoinPackedMatrix &matrix,
1400  const double *collb, const double *colub,
1401  const double *obj,
1402  const char *rowsen, const double *rowrhs,
1403  const double *rowrng)
1404  = 0;
1405 
1415  virtual void assignProblem(CoinPackedMatrix *&matrix,
1416  double *&collb, double *&colub, double *&obj,
1417  char *&rowsen, double *&rowrhs,
1418  double *&rowrng)
1419  = 0;
1420 
1433  virtual void loadProblem(const int numcols, const int numrows,
1434  const CoinBigIndex *start, const int *index,
1435  const double *value,
1436  const double *collb, const double *colub,
1437  const double *obj,
1438  const double *rowlb, const double *rowub)
1439  = 0;
1440 
1453  virtual void loadProblem(const int numcols, const int numrows,
1454  const CoinBigIndex *start, const int *index,
1455  const double *value,
1456  const double *collb, const double *colub,
1457  const double *obj,
1458  const char *rowsen, const double *rowrhs,
1459  const double *rowrng)
1460  = 0;
1461 
1468  virtual int loadFromCoinModel(CoinModel &modelObject,
1469  bool keepSolution = false);
1470 
1476  virtual int readMps(const char *filename,
1477  const char *extension = "mps");
1478 
1485  virtual int readMps(const char *filename, const char *extension,
1486  int &numberSets, CoinSet **&sets);
1487 
1493  virtual int readGMPL(const char *filename, const char *dataname = NULL);
1494 
1501  virtual void writeMps(const char *filename,
1502  const char *extension = "mps",
1503  double objSense = 0.0) const = 0;
1504 
1518  int writeMpsNative(const char *filename,
1519  const char **rowNames, const char **columnNames,
1520  int formatType = 0, int numberAcross = 2,
1521  double objSense = 0.0, int numberSOS = 0,
1522  const CoinSet *setInfo = NULL) const;
1523 
1524  /***********************************************************************/
1525  // Lp files
1526 
1546  virtual void writeLp(const char *filename,
1547  const char *extension = "lp",
1548  double epsilon = 1e-5,
1549  int numberAcross = 10,
1550  int decimals = 9,
1551  double objSense = 0.0,
1552  bool useRowNames = true) const;
1553 
1558  virtual void writeLp(FILE *fp,
1559  double epsilon = 1e-5,
1560  int numberAcross = 10,
1561  int decimals = 5,
1562  double objSense = 0.0,
1563  bool useRowNames = true) const;
1564 
1583  int writeLpNative(const char *filename,
1584  char const *const *const rowNames,
1585  char const *const *const columnNames,
1586  const double epsilon = 1.0e-5,
1587  const int numberAcross = 10,
1588  const int decimals = 5,
1589  const double objSense = 0.0,
1590  const bool useRowNames = true) const;
1591 
1596  int writeLpNative(FILE *fp,
1597  char const *const *const rowNames,
1598  char const *const *const columnNames,
1599  const double epsilon = 1.0e-5,
1600  const int numberAcross = 10,
1601  const int decimals = 5,
1602  const double objSense = 0.0,
1603  const bool useRowNames = true) const;
1604 
1607  virtual int readLp(const char *filename, const double epsilon = 1e-5);
1608 
1611  int readLp(FILE *fp, const double epsilon = 1e-5);
1612 
1614 
1615  //---------------------------------------------------------------------------
1616 
1625  bool ignoreNames = true);
1630  void statistics(double &minimumNegative, double &maximumNegative,
1631  double &minimumPositive, double &maximumPositive,
1632  int type = 3) const;
1633 #ifdef COIN_SNAPSHOT
1634  virtual CoinSnapshot *snapshot(bool createArrays = true) const;
1636 #endif
1637 #ifdef COIN_FACTORIZATION_INFO
1638  virtual CoinBigIndex getSizeL() const;
1641  virtual CoinBigIndex getSizeU() const;
1642 #endif
1643 
1644 
1645  //---------------------------------------------------------------------------
1646 
1656  void setApplicationData(void *appData);
1663  void setAuxiliaryInfo(OsiAuxInfo *auxiliaryInfo);
1664 
1666  void *getApplicationData() const;
1668  OsiAuxInfo *getAuxiliaryInfo() const;
1670  //---------------------------------------------------------------------------
1671 
1685  virtual void passInMessageHandler(CoinMessageHandler *handler);
1687  void newLanguage(CoinMessages::Language language);
1688  inline void setLanguage(CoinMessages::Language language)
1689  {
1690  newLanguage(language);
1691  }
1693  inline CoinMessageHandler *messageHandler() const
1694  {
1695  return handler_;
1696  }
1698  inline CoinMessages messages()
1699  {
1700  return messages_;
1701  }
1703  inline CoinMessages *messagesPointer()
1704  {
1705  return &messages_;
1706  }
1708  inline bool defaultHandler() const
1709  {
1710  return defaultHandler_;
1711  }
1713  //---------------------------------------------------------------------------
1728  void findIntegers(bool justCount);
1739  virtual int findIntegersAndSOS(bool justCount);
1741  inline int numberObjects() const { return numberObjects_; }
1743  inline void setNumberObjects(int number)
1744  {
1745  numberObjects_ = number;
1746  }
1747 
1749  inline OsiObject **objects() const { return object_; }
1750 
1752  const inline OsiObject *object(int which) const { return object_[which]; }
1754  inline OsiObject *modifiableObject(int which) const { return object_[which]; }
1755 
1757  void deleteObjects();
1758 
1768  double forceFeasible();
1770  //---------------------------------------------------------------------------
1771 
1783  virtual void activateRowCutDebugger(const char *modelName);
1784 
1798  virtual void activateRowCutDebugger(const double *solution,
1799  bool enforceOptimality = true);
1800 
1812  const OsiRowCutDebugger *getRowCutDebugger() const;
1813 
1823 
1832 
1843  virtual int canDoSimplexInterface() const;
1845 
1853 
1862  virtual void enableFactorization() const;
1863 
1865  virtual void disableFactorization() const;
1866 
1877  virtual bool basisIsAvailable() const;
1878 
1880  inline bool optimalBasisIsAvailable() const { return basisIsAvailable(); }
1881 
1905  virtual void getBasisStatus(int *cstat, int *rstat) const;
1906 
1921  virtual int setBasisStatus(const int *cstat, const int *rstat);
1922 
1928  virtual void getReducedGradient(double *columnReducedCosts,
1929  double *duals, const double *c) const;
1930 
1936  virtual void getBInvARow(int row, double *z, double *slack = NULL) const;
1937 
1939  virtual void getBInvRow(int row, double *z) const;
1940 
1942  virtual void getBInvACol(int col, double *vec) const;
1943 
1945  virtual void getBInvCol(int col, double *vec) const;
1946 
1954  virtual void getBasics(int *index) const;
1955 
1957 
1965 
1972  virtual void enableSimplexInterface(bool doingPrimal);
1973 
1975  virtual void disableSimplexInterface();
1983  virtual int pivot(int colIn, int colOut, int outStatus);
1984 
1996  virtual int primalPivotResult(int colIn, int sign,
1997  int &colOut, int &outStatus,
1998  double &t, CoinPackedVector *dx);
1999 
2006  virtual int dualPivotResult(int &colIn, int &sign,
2007  int colOut, int outStatus,
2008  double &t, CoinPackedVector *dx);
2010 
2011  //---------------------------------------------------------------------------
2012 
2014 
2017 
2023  virtual OsiSolverInterface *clone(bool copyData = true) const = 0;
2024 
2027 
2030 
2032  virtual ~OsiSolverInterface();
2033 
2040  virtual void reset();
2042 
2043  //---------------------------------------------------------------------------
2044 
2045 protected:
2047 
2048 
2049  virtual void applyRowCut(const OsiRowCut &rc) = 0;
2050 
2052  virtual void applyColCut(const OsiColCut &cc) = 0;
2053 
2056  inline void
2057  convertBoundToSense(const double lower, const double upper,
2058  char &sense, double &right, double &range) const;
2061  inline void
2062  convertSenseToBound(const char sense, const double right,
2063  const double range,
2064  double &lower, double &upper) const;
2067  template < class T >
2068  inline T
2069  forceIntoRange(const T value, const T lower, const T upper) const
2070  {
2071  return value < lower ? lower : (value > upper ? upper : value);
2072  }
2079  void setInitialData();
2081 
2083 
2084 
2090  // Why not just make useful stuff protected?
2092  CoinMessageHandler *handler_;
2100  CoinMessages messages_;
2105 
2115  mutable char *columnType_;
2116 
2118 
2119  //---------------------------------------------------------------------------
2120 
2121 private:
2123 
2138  CoinWarmStart *ws_;
2140  std::vector< double > strictColSolution_;
2141 
2147  std::string objName_;
2148 
2150 };
2151 
2152 //#############################################################################
2155 inline void
2156 OsiSolverInterface::convertBoundToSense(const double lower, const double upper,
2157  char &sense, double &right,
2158  double &range) const
2159 {
2160  double inf = getInfinity();
2161  range = 0.0;
2162  if (lower > -inf) {
2163  if (upper < inf) {
2164  right = upper;
2165  if (upper == lower) {
2166  sense = 'E';
2167  } else {
2168  sense = 'R';
2169  range = upper - lower;
2170  }
2171  } else {
2172  sense = 'G';
2173  right = lower;
2174  }
2175  } else {
2176  if (upper < inf) {
2177  sense = 'L';
2178  right = upper;
2179  } else {
2180  sense = 'N';
2181  right = 0.0;
2182  }
2183  }
2184 }
2185 
2186 //-----------------------------------------------------------------------------
2189 inline void
2190 OsiSolverInterface::convertSenseToBound(const char sense, const double right,
2191  const double range,
2192  double &lower, double &upper) const
2193 {
2194  double inf = getInfinity();
2195  switch (sense) {
2196  case 'E':
2197  lower = upper = right;
2198  break;
2199  case 'L':
2200  lower = -inf;
2201  upper = right;
2202  break;
2203  case 'G':
2204  lower = right;
2205  upper = inf;
2206  break;
2207  case 'R':
2208  lower = right - range;
2209  upper = right;
2210  break;
2211  case 'N':
2212  lower = -inf;
2213  upper = inf;
2214  break;
2215  }
2216 }
2217 
2218 #endif
2219 
2220 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
2221 */
OsiSolverInterface::ApplyCutsReturnCode::incrementIneffective
void incrementIneffective()
Increment ineffective cut counter.
Definition: OsiSolverInterface.hpp:153
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::strictColSolution_
std::vector< double > strictColSolution_
Column solution satisfying lower and upper column bounds.
Definition: OsiSolverInterface.hpp:2140
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::ApplyCutsReturnCode::getNumApplied
int getNumApplied() const
Number of cuts applied.
Definition: OsiSolverInterface.hpp:137
OsiForceDo
@ OsiForceDo
And this means throw an exception if not possible.
Definition: OsiSolverParameters.hpp:138
OsiSolverInterface::object_
OsiObject ** object_
Integer and ... information (integer info normally at beginning)
Definition: OsiSolverInterface.hpp:2107
OsiSolverInterface::ApplyCutsReturnCode::operator=
ApplyCutsReturnCode & operator=(const ApplyCutsReturnCode &rhs)
Assignment operator.
Definition: OsiSolverInterface.hpp:99
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:149
OsiHintParam
OsiHintParam
Definition: OsiSolverParameters.hpp:106
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::setNumberObjects
void setNumberObjects(int number)
Set the number of objects.
Definition: OsiSolverInterface.hpp:1743
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:1752
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:2115
OsiSolverInterface::messages
CoinMessages messages()
Return the current set of messages.
Definition: OsiSolverInterface.hpp:1698
OsiSolverInterface::ApplyCutsReturnCode::incrementApplied
void incrementApplied()
Increment applied cut counter.
Definition: OsiSolverInterface.hpp:155
OsiSolverInterface::ApplyCutsReturnCode::~ApplyCutsReturnCode
~ApplyCutsReturnCode()
Destructor.
Definition: OsiSolverInterface.hpp:111
OsiSolverInterface::replaceMatrixOptional
virtual void replaceMatrixOptional(const CoinPackedMatrix &)
Replace the constraint matrix.
Definition: OsiSolverInterface.hpp:1274
OsiSolverInterface::numberObjects
int numberObjects() const
Get the number of objects.
Definition: OsiSolverInterface.hpp:1741
OsiCollections.hpp
OsiSolverInterface::ApplyCutsReturnCode::extInconsistent_
int extInconsistent_
Counter for model-inconsistent cuts.
Definition: OsiSolverInterface.hpp:163
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:81
OsiSolverInterface::ApplyCutsReturnCode::incrementInternallyInconsistent
void incrementInternallyInconsistent()
Increment logically inconsistent cut counter.
Definition: OsiSolverInterface.hpp:147
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:167
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:2092
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:818
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:127
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::ApplyCutsReturnCode::intInconsistent_
int intInconsistent_
Counter for logically inconsistent cuts.
Definition: OsiSolverInterface.hpp:161
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:134
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:1688
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:2069
OsiSolverInterface::getColName
virtual std::string getColName(int colIndex, unsigned maxLen=static_cast< unsigned >(std::string::npos)) const
Return the name of the column.
OsiSolverInterface::ApplyCutsReturnCode::getNumInconsistentWrtIntegerModel
int getNumInconsistentWrtIntegerModel() const
Number of cuts inconsistent with the current model.
Definition: OsiSolverInterface.hpp:122
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:1754
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::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::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::setColumnType
void setColumnType(int iColumn, char type)
Set column type.
Definition: OsiSolverInterface.hpp:629
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:623
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:2133
OsiSolverInterface::ws_
CoinWarmStart * ws_
Warm start information used for hot starts when the default hot start implementation is used.
Definition: OsiSolverInterface.hpp:2138
OsiSolverInterface::appDataEtc_
OsiAuxInfo * appDataEtc_
Pointer to user-defined data structure - and more if user wants.
Definition: OsiSolverInterface.hpp:2125
OsiSolverInterface::objects
OsiObject ** objects() const
Get the array of objects.
Definition: OsiSolverInterface.hpp:1749
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:2156
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:2100
OsiSolverInterface::getNumElements
virtual CoinBigIndex getNumElements() const =0
Get the number of nonzero elements.
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:2127
OsiSolverInterface::ApplyCutsReturnCode::infeasible_
int infeasible_
Counter for infeasible cuts.
Definition: OsiSolverInterface.hpp:165
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::getApplicationData
void * getApplicationData() const
Get application data.
OsiSolverInterface::colNames_
OsiNameVec colNames_
Column names.
Definition: OsiSolverInterface.hpp:2145
OsiSolverInterface::numberIntegers_
int numberIntegers_
Number of integers.
Definition: OsiSolverInterface.hpp:2102
OsiSolverInterface::unmarkHotStart
virtual void unmarkHotStart()
Delete the hot start snapshot.
OsiSolverInterface::dblParam_
double dblParam_[OsiLastDblParam]
Array of double parameters.
Definition: OsiSolverInterface.hpp:2129
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:169
OsiSolverInterface::setHintParam
virtual bool setHintParam(OsiHintParam key, bool yesNo=true, OsiHintStrength strength=OsiHintTry, void *=NULL)
Set a hint parameter.
Definition: OsiSolverInterface.hpp:312
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:1286
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:117
OsiLastHintParam
@ OsiLastHintParam
Just a marker, so that OsiSolverInterface can allocate a static sized array to store parameters.
Definition: OsiSolverParameters.hpp:127
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:358
OsiSolverInterface::getDualRays
virtual std::vector< double * > getDualRays(int maxNumRays, bool fullRay=false) const =0
Get as many dual rays as the solver can provide.
OsiVectorInt
std::vector< int > OsiVectorInt
Vector of int.
Definition: OsiCollections.hpp:20
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:74
OsiSolverInterface::ApplyCutsReturnCode
Internal class for obtaining status from the applyCuts method.
Definition: OsiSolverInterface.hpp:72
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:132
OsiSolverInterface::getIntegerTolerance
double getIntegerTolerance() const
Return the integrality tolerance of the underlying solver.
Definition: OsiSolverInterface.hpp:414
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::getHintParam
virtual bool getHintParam(OsiHintParam key, bool &yesNo) const
Get a hint parameter (sense only)
Definition: OsiSolverInterface.hpp:386
OsiSolverInterface::replaceMatrix
virtual void replaceMatrix(const CoinPackedMatrix &)
Replace the constraint matrix.
Definition: OsiSolverInterface.hpp:1280
OsiSolverInterface::setObjName
virtual void setObjName(std::string name)
Set the name of the objective function.
Definition: OsiSolverInterface.hpp:971
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:662
OsiSolverInterface::basisIsAvailable
virtual bool basisIsAvailable() const
Check if an optimal basis is available.
OsiSolverInterface::getHintParam
virtual bool getHintParam(OsiHintParam key, bool &yesNo, OsiHintStrength &strength) const
Get a hint parameter (sense and strength only)
Definition: OsiSolverInterface.hpp:373
OsiSolverInterface::getPrimalRays
virtual std::vector< double * > getPrimalRays(int maxNumRays) const =0
Get as many primal rays as the solver can provide.
OsiSolverInterface::OsiNameVec
std::vector< std::string > OsiNameVec
Data type for name vectors.
Definition: OsiSolverInterface.hpp:930
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:326
OsiSolverInterface::writeLp
virtual void writeLp(const char *filename, const char *extension="lp", double epsilon=1e-5, int numberAcross=10, int decimals=9, double objSense=0.0, bool useRowNames=true) const
Write the problem into an Lp file of the given filename with the specified extension.
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:2089
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:2104
OsiSolverInterface::optimalBasisIsAvailable
bool optimalBasisIsAvailable() const
Synonym for basisIsAvailable.
Definition: OsiSolverInterface.hpp:1880
OsiSolverInterface::ApplyCutsReturnCode::incrementInfeasible
void incrementInfeasible()
Increment infeasible cut counter.
Definition: OsiSolverInterface.hpp:151
OsiHintStrength
OsiHintStrength
Definition: OsiSolverParameters.hpp:130
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::getMutableMatrixByCol
virtual CoinPackedMatrix * getMutableMatrixByCol() const
Get a pointer to a mutable column-wise copy of the matrix.
Definition: OsiSolverInterface.hpp:669
OsiSolverInterface::setIntParam
virtual bool setIntParam(OsiIntParam key, int value)
Set an integer parameter.
Definition: OsiSolverInterface.hpp:278
OsiSolverInterface::statistics
void statistics(double &minimumNegative, double &maximumNegative, double &minimumPositive, double &maximumPositive, int type=3) const
Get some statistics about model - min/max always computed type 0->4 , larger gives more information 0...
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:103
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:342
OsiSolverInterface::setRowBounds
virtual void setRowBounds(int elementIndex, double lower, double upper)
Set a single row lower and upper bound.
Definition: OsiSolverInterface.hpp:846
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:2147
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:1708
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:2131
OsiSolverResult
Solver Result Class.
Definition: OsiSolverBranch.hpp:88
OsiSolverInterface::setDblParam
virtual bool setDblParam(OsiDblParam key, double value)
Set a double parameter.
Definition: OsiSolverInterface.hpp:286
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:294
OsiSolverInterface::deleteRows
virtual void deleteRows(const int num, const int *rowIndices)=0
Delete a set of rows (constraints) from the problem.
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:2190
OsiSolverInterface::messagesPointer
CoinMessages * messagesPointer()
Return a pointer to the current set of messages.
Definition: OsiSolverInterface.hpp:1703
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:2143
OsiSolverInterface::messageHandler
CoinMessageHandler * messageHandler() const
Return a pointer to the current message handler.
Definition: OsiSolverInterface.hpp:1693
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:2098
OsiSolverInterface
Abstract Base Class for describing an interface to a solver.
Definition: OsiSolverInterface.hpp:61
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:334
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:87
OsiSolverInterface::hintStrength_
OsiHintStrength hintStrength_[OsiLastHintParam]
Array of hint strengths.
Definition: OsiSolverInterface.hpp:2135
OsiSolverInterface::setWarmStart
virtual bool setWarmStart(const CoinWarmStart *warmstart)=0
Set warm start information.