Cgl 0.60.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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
61 class OsiSolverInterface {
62 friend void OsiSolverInterfaceCommonUnitTest(
63 const OsiSolverInterface *emptySi,
64 const std::string &mpsDir,
65 const std::string &netlibDir);
66 friend void OsiSolverInterfaceMpsUnitTest(
67 const std::vector< OsiSolverInterface * > &vecSiP,
68 const std::string &mpsDir);
69
70 public:
72 class ApplyCutsReturnCode {
73 friend class OsiSolverInterface;
74 friend class OsiClpSolverInterface;
75 friend class OsiGrbSolverInterface;
76
77 public:
79
80 ApplyCutsReturnCode()
82 : intInconsistent_(0)
83 , extInconsistent_(0)
84 , infeasible_(0)
85 , ineffective_(0)
86 , applied_(0)
87 {
88 }
90 ApplyCutsReturnCode(const ApplyCutsReturnCode &rhs)
91 : intInconsistent_(rhs.intInconsistent_)
92 , extInconsistent_(rhs.extInconsistent_)
93 , infeasible_(rhs.infeasible_)
94 , ineffective_(rhs.ineffective_)
95 , applied_(rhs.applied_)
96 {
97 }
99 ApplyCutsReturnCode &operator=(const ApplyCutsReturnCode &rhs)
100 {
101 if (this != &rhs) {
102 intInconsistent_ = rhs.intInconsistent_;
103 extInconsistent_ = rhs.extInconsistent_;
104 infeasible_ = rhs.infeasible_;
105 ineffective_ = rhs.ineffective_;
106 applied_ = rhs.applied_;
107 }
108 return *this;
109 }
111 ~ApplyCutsReturnCode() {}
113
116 inline int getNumInconsistent() const
118 {
119 return intInconsistent_;
120 }
122 inline int getNumInconsistentWrtIntegerModel() const
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:
146 inline void incrementInternallyInconsistent() { intInconsistent_++; }
149 inline void incrementExternallyInconsistent() { extInconsistent_++; }
151 inline void incrementInfeasible() { infeasible_++; }
153 inline void incrementIneffective() { ineffective_++; }
155 inline void incrementApplied() { applied_++; }
157
159
160 int intInconsistent_;
163 int extInconsistent_;
165 int infeasible_;
167 int ineffective_;
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 }
399 void copyParameters(OsiSolverInterface &rhs);
400
414 inline double getIntegerTolerance() const
415 {
416 return dblParam_[OsiPrimalTolerance];
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
1624 int differentModel(OsiSolverInterface &other,
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
1763 void addObjects(int numberObjects, OsiObject **objects);
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
1821 OsiRowCutDebugger *getRowCutDebuggerAlways() const;
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
2015 OsiSolverInterface();
2017
2023 virtual OsiSolverInterface *clone(bool copyData = true) const = 0;
2024
2026 OsiSolverInterface(const OsiSolverInterface &);
2027
2029 OsiSolverInterface &operator=(const OsiSolverInterface &rhs);
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
2089 mutable OsiRowCutDebugger *rowCutDebugger_;
2090 // Why not just make useful stuff protected?
2092 CoinMessageHandler *handler_;
2098 bool defaultHandler_;
2100 CoinMessages messages_;
2102 int numberIntegers_;
2104 int numberObjects_;
2105
2107 OsiObject **object_;
2115 mutable char *columnType_;
2116
2118
2119 //---------------------------------------------------------------------------
2120
2121 private:
2123
2124 OsiAuxInfo *appDataEtc_;
2127 int intParam_[OsiLastIntParam];
2129 double dblParam_[OsiLastDblParam];
2131 std::string strParam_[OsiLastStrParam];
2133 bool hintParam_[OsiLastHintParam];
2135 OsiHintStrength hintStrength_[OsiLastHintParam];
2138 CoinWarmStart *ws_;
2140 std::vector< double > strictColSolution_;
2141
2143 OsiNameVec rowNames_;
2145 OsiNameVec colNames_;
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::getObjName
virtual std::string getObjName(unsigned maxLen=static_cast< unsigned >(std::string::npos)) const
Return the name of the objective function.
OsiSolverInterface::applyColCut
virtual void applyColCut(const OsiColCut &cc)=0
Apply a column cut (adjust the bounds of one or more variables).
OsiSolverInterface::setColSolution
virtual void setColSolution(const double *colsol)=0
Set the primal solution variable values.
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::isProvenDualInfeasible
virtual bool isProvenDualInfeasible() const =0
Is dual infeasibility proven?
OsiSolverInterface::setColumnType
void setColumnType(int iColumn, char type)
Set column type.
Definition: OsiSolverInterface.hpp:629
CoinError
Error Class thrown by an exception.
Definition: CoinError.hpp:42
OsiSolverInterface::isIterationLimitReached
virtual bool isIterationLimitReached() const =0
Iteration limit reached?
OsiSolverInterface::getRowActivity
virtual const double * getRowActivity() const =0
Get a pointer to array[getNumRows()] of row activity levels.
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::readMps
virtual int readMps(const char *filename, const char *extension="mps")
Read a problem in MPS format from the given filename.
OsiLastHintParam
Just a marker, so that OsiSolverInterface can allocate a static sized array to store parameters...
Definition: OsiSolverParameters.hpp:127
OsiSolverInterface::getNumElements
virtual CoinBigIndex getNumElements() const =0
Get the number of nonzero elements.
OsiSolverInterface::replaceMatrixOptional
virtual void replaceMatrixOptional(const CoinPackedMatrix &)
Replace the constraint matrix.
Definition: OsiSolverInterface.hpp:1274
OsiSolverInterface::clone
virtual OsiSolverInterface * clone(bool copyData=true) const =0
Clone.
OsiSolverInterface::setRowLower
virtual void setRowLower(int elementIndex, double elementValue)=0
Set a single row lower bound.
OsiSolverInterface::operator=
OsiSolverInterface & operator=(const OsiSolverInterface &rhs)
Assignment operator.
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::activateRowCutDebugger
virtual void activateRowCutDebugger(const char *modelName)
Activate the row cut debugger.
OsiSolverInterface::ApplyCutsReturnCode::ApplyCutsReturnCode
ApplyCutsReturnCode(const ApplyCutsReturnCode &rhs)
Copy constructor.
Definition: OsiSolverInterface.hpp:90
OsiSolverInterface::getIterationCount
virtual int getIterationCount() const =0
Get the number of iterations it took to solve the problem (whatever `iteration&#39; means to the solver)...
OsiSolverInterface::ApplyCutsReturnCode::getNumInconsistent
int getNumInconsistent() const
Number of logically inconsistent cuts.
Definition: OsiSolverInterface.hpp:117
OsiSolverInterface::deleteRowNames
virtual void deleteRowNames(int tgtStart, int len)
Delete len row names starting at index tgtStart.
OsiSolverInterface::replaceMatrix
virtual void replaceMatrix(const CoinPackedMatrix &)
Replace the constraint matrix.
Definition: OsiSolverInterface.hpp:1280
OsiSolverInterface::defaultHandler
bool defaultHandler() const
Return true if default handler.
Definition: OsiSolverInterface.hpp:1708
OsiSolverInterface::deleteObjects
void deleteObjects()
Delete all object information.
OsiSolverInterface::ApplyCutsReturnCode::getNumIneffective
int getNumIneffective() const
Number of redundant or ineffective cuts.
Definition: OsiSolverInterface.hpp:132
OsiSolverInterface::getReducedGradient
virtual void getReducedGradient(double *columnReducedCosts, double *duals, const double *c) const
Calculate duals and reduced costs for the given objective coefficients.
OsiSolverInterface::ApplyCutsReturnCode::getNumInfeasible
int getNumInfeasible() const
Number of cuts that cause obvious infeasibility.
Definition: OsiSolverInterface.hpp:127
OsiSolverInterface::isIntegerNonBinary
virtual bool isIntegerNonBinary(int colIndex) const
Return true if the variable is general integer.
OsiSolverInterface::getRowSense
virtual const char * getRowSense() const =0
Get a pointer to an array[getNumRows()] of row constraint senses.
OsiSolverInterface::setColLower
virtual void setColLower(int elementIndex, double elementValue)=0
Set a single column lower bound.
OsiSolverInterface::ApplyCutsReturnCode::infeasible_
int infeasible_
Counter for infeasible cuts.
Definition: OsiSolverInterface.hpp:165
OsiSolverInterface::getBInvRow
virtual void getBInvRow(int row, double *z) const
Get a row of the basis inverse.
OsiSolverInterface::setNumberObjects
void setNumberObjects(int number)
Set the number of objects.
Definition: OsiSolverInterface.hpp:1743
CoinTypes.hpp
OsiAuxInfo
This class allows for a more structured use of algorithmic tweaking to an OsiSolverInterface.
Definition: OsiAuxInfo.hpp:21
OsiSolverInterface::rowNames_
OsiNameVec rowNames_
Row names.
Definition: OsiSolverInterface.hpp:2143
OsiSolverInterface::setObjCoeff
virtual void setObjCoeff(int elementIndex, double elementValue)=0
Set an objective function coefficient.
OsiDblParam
OsiDblParam
Definition: OsiSolverParameters.hpp:52
OsiSolverResult
Solver Result Class.
Definition: OsiSolverBranch.hpp:88
CoinSnapshot
NON Abstract Base Class for interfacing with cut generators or branching code or .
Definition: CoinSnapshot.hpp:25
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.
OsiSolverInterface::getRowPrice
virtual const double * getRowPrice() const =0
Get pointer to array[getNumRows()] of dual variable values.
OsiSolverInterface::getAuxiliaryInfo
OsiAuxInfo * getAuxiliaryInfo() const
Get pointer to auxiliary info object.
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::getColNames
virtual const OsiNameVec & getColNames()
Return a pointer to a vector of column names.
OsiSolverInterface::getColType
virtual const char * getColType(bool refresh=false) const
Return an array[getNumCols()] of column types.
OsiSolverInterface::getMatrixByCol
virtual const CoinPackedMatrix * getMatrixByCol() const =0
Get a pointer to a column-wise copy of the matrix.
OsiSolverInterface::getNumIntegers
virtual int getNumIntegers() const
Get the number of integer variables.
OsiSolverInterface::addObjects
void addObjects(int numberObjects, OsiObject **objects)
Add in object information.
OsiSolverInterface::setRowPrice
virtual void setRowPrice(const double *rowprice)=0
Set dual solution variable values.
OsiSolverInterface::resolve
virtual void resolve()=0
Resolve an LP relaxation after problem modification.
OsiCuts
Collections of row cuts and column cuts.
Definition: OsiCuts.hpp:19
OsiColCut
Column Cut Class.
Definition: OsiColCut.hpp:23
OsiSolverInterface::messageHandler
CoinMessageHandler * messageHandler() const
Return a pointer to the current message handler.
Definition: OsiSolverInterface.hpp:1693
CoinModel
This is a simple minded model which is stored in a format which makes it easier to construct and modi...
Definition: CoinModel.hpp:181
OsiSolverInterface::hintParam_
bool hintParam_[OsiLastHintParam]
Array of hint parameters.
Definition: OsiSolverInterface.hpp:2133
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.
OsiClpSolverInterface
Clp Solver Interface.
Definition: OsiClpSolverInterface.hpp:37
OsiSolverInterface::isProvenPrimalInfeasible
virtual bool isProvenPrimalInfeasible() const =0
Is primal infeasibility proven?
OsiSolverInterface::findIntegers
void findIntegers(bool justCount)
Identify integer variables and create corresponding objects.
OsiSolverInterface::setLanguage
void setLanguage(CoinMessages::Language language)
Definition: OsiSolverInterface.hpp:1688
OsiSolverInterface::messages
CoinMessages messages()
Return the current set of messages.
Definition: OsiSolverInterface.hpp:1698
OsiSolverInterface::getRowNames
virtual const OsiNameVec & getRowNames()
Return a pointer to a vector of row names.
OsiSolverInterface::getIntParam
virtual bool getIntParam(OsiIntParam key, int &value) const
Get an integer parameter.
Definition: OsiSolverInterface.hpp:326
OsiSolverInterface::unmarkHotStart
virtual void unmarkHotStart()
Delete the hot start snapshot.
OsiSolverInterface::findIntegersAndSOS
virtual int findIntegersAndSOS(bool justCount)
Identify integer variables and SOS and create corresponding objects.
OsiSolverInterface::solveFromHotStart
virtual void solveFromHotStart()
Optimize starting from the hot start snapshot.
OsiSolverInterface::setRowUpper
virtual void setRowUpper(int elementIndex, double elementValue)=0
Set a single row upper bound.
OsiSolverInterface::ApplyCutsReturnCode::applied_
int applied_
Counter for applied cuts.
Definition: OsiSolverInterface.hpp:169
OsiSolverInterface::numberObjects_
int numberObjects_
Total number of objects.
Definition: OsiSolverInterface.hpp:2104
OsiHintStrength
OsiHintStrength
Definition: OsiSolverParameters.hpp:130
OsiSolverInterface::setRowNames
virtual void setRowNames(OsiNameVec &srcNames, int srcStart, int len, int tgtStart)
Set multiple row names.
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::branchAndBound
virtual void branchAndBound()=0
Invoke solver&#39;s built-in enumeration algorithm.
OsiSolverInterface::getRowName
virtual std::string getRowName(int rowIndex, unsigned maxLen=static_cast< unsigned >(std::string::npos)) const
Return the name of the row.
OsiSolverInterface::getBInvCol
virtual void getBInvCol(int col, double *vec) const
Get a column of the basis inverse.
OsiSolverInterface::setRowName
virtual void setRowName(int ndx, std::string name)
Set a row name.
OsiSolverInterface::setApplicationData
void setApplicationData(void *appData)
Set application data.
OsiSolverInterface::setIntParam
virtual bool setIntParam(OsiIntParam key, int value)
Set an integer parameter.
Definition: OsiSolverInterface.hpp:278
OsiSolverInterface::applyRowCuts
virtual void applyRowCuts(int numberCuts, const OsiRowCut *cuts)
Apply a collection of row cuts which are all effective.
CoinMessageHandler
Base class for message handling.
Definition: CoinMessageHandler.hpp:345
OsiSolverInterface::objects
OsiObject ** objects() const
Get the array of objects.
Definition: OsiSolverInterface.hpp:1749
OsiSolverInterface::isInteger
virtual bool isInteger(int colIndex) const
Return true if the variable is integer.
OsiSolverInterface::object
const OsiObject * object(int which) const
Get the specified object.
Definition: OsiSolverInterface.hpp:1752
OsiSolverInterface::restoreBaseModel
virtual void restoreBaseModel(int numberRows)
Reduce the constraint system to the specified number of constraints.
OsiSolverInterface::getNumCols
virtual int getNumCols() const =0
Get the number of columns.
CoinFinite.hpp
OsiSolverInterface::setAuxiliaryInfo
void setAuxiliaryInfo(OsiAuxInfo *auxiliaryInfo)
Create a clone of an Auxiliary Information object.
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.
OsiSolverInterface::setStrParam
virtual bool setStrParam(OsiStrParam key, const std::string &value)
Set a string parameter.
Definition: OsiSolverInterface.hpp:294
OsiSolverInterface
Abstract Base Class for describing an interface to a solver.
Definition: OsiSolverInterface.hpp:61
OsiSolverInterface::getHintParam
virtual bool getHintParam(OsiHintParam key, bool &yesNo, OsiHintStrength &strength, void *&otherInformation) const
Get a hint parameter (all information)
Definition: OsiSolverInterface.hpp:358
OsiLastStrParam
End marker.
Definition: OsiSolverParameters.hpp:103
OsiSolverInterface::setRowBounds
virtual void setRowBounds(int elementIndex, double lower, double upper)
Set a single row lower and upper bound.
Definition: OsiSolverInterface.hpp:846
OsiSolverInterface::setRowType
virtual void setRowType(int index, char sense, double rightHandSide, double range)=0
Set the type of a single row.
CoinPackedVectorBase
Abstract base class for various sparse vectors.
Definition: CoinPackedVectorBase.hpp:23
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::getMutableMatrixByCol
virtual CoinPackedMatrix * getMutableMatrixByCol() const
Get a pointer to a mutable column-wise copy of the matrix.
Definition: OsiSolverInterface.hpp:669
OsiSolverInterface::setDblParam
virtual bool setDblParam(OsiDblParam key, double value)
Set a double parameter.
Definition: OsiSolverInterface.hpp:286
OsiSolverInterface::getPrimalRays
virtual std::vector< double * > getPrimalRays(int maxNumRays) const =0
Get as many primal rays as the solver can provide.
OsiSolverInterface::ApplyCutsReturnCode::ApplyCutsReturnCode
ApplyCutsReturnCode()
Default constructor.
Definition: OsiSolverInterface.hpp:81
OsiSolverInterface::ApplyCutsReturnCode::extInconsistent_
int extInconsistent_
Counter for model-inconsistent cuts.
Definition: OsiSolverInterface.hpp:163
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.
OsiSolverInterface::deleteCols
virtual void deleteCols(const int num, const int *colIndices)=0
Remove a set of columns (primal variables) from the problem.
CoinError.hpp
OsiSolverInterface::ApplyCutsReturnCode::ineffective_
int ineffective_
Counter for ineffective cuts.
Definition: OsiSolverInterface.hpp:167
OsiSolverInterface::isContinuous
virtual bool isContinuous(int colIndex) const =0
Return true if the variable is continuous.
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::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::getIntegerTolerance
double getIntegerTolerance() const
Return the integrality tolerance of the underlying solver.
Definition: OsiSolverInterface.hpp:414
OsiSolverInterface::pivot
virtual int pivot(int colIn, int colOut, int outStatus)
Perform a pivot by substituting a colIn for colOut in the basis.
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-&gt;4 , larger gives more information 0...
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::columnType
const char * columnType(bool refresh=false) const
Return an array[getNumCols()] of column types.
Definition: OsiSolverInterface.hpp:623
OsiSolverInterface::dblParam_
double dblParam_[OsiLastDblParam]
Array of double parameters.
Definition: OsiSolverInterface.hpp:2129
CoinPackedVectorBase.hpp
OsiSolverInterface::setObjName
virtual void setObjName(std::string name)
Set the name of the objective function.
Definition: OsiSolverInterface.hpp:971
OsiSolverInterface::getWarmStart
virtual CoinWarmStart * getWarmStart() const =0
Get warm start information.
OsiSolverInterface::getRightHandSide
virtual const double * getRightHandSide() const =0
Get a pointer to an array[getNumRows()] of row right-hand sides.
CoinMessageHandler.hpp
This is a first attempt at a message handler.
OsiSolverInterface::handler_
CoinMessageHandler * handler_
Message handler.
Definition: OsiSolverInterface.hpp:2092
OsiSolverInterface::getColLower
virtual const double * getColLower() const =0
Get a pointer to an array[getNumCols()] of column lower bounds.
OsiSolverInterface::setColBounds
virtual void setColBounds(int elementIndex, double lower, double upper)
Set a single column lower and upper bound.
Definition: OsiSolverInterface.hpp:818
OsiSolverInterface::isPrimalObjectiveLimitReached
virtual bool isPrimalObjectiveLimitReached() const
Is the given primal objective limit reached?
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::strictColSolution_
std::vector< double > strictColSolution_
Column solution satisfying lower and upper column bounds.
Definition: OsiSolverInterface.hpp:2140
OsiSolverInterface::getBasisStatus
virtual void getBasisStatus(int *cstat, int *rstat) const
Retrieve status information for column and row variables.
OsiSolverInterface::ApplyCutsReturnCode::getNumInconsistentWrtIntegerModel
int getNumInconsistentWrtIntegerModel() const
Number of cuts inconsistent with the current model.
Definition: OsiSolverInterface.hpp:122
OsiStrParam
OsiStrParam
Definition: OsiSolverParameters.hpp:87
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::getNumRows
virtual int getNumRows() const =0
Get the number of rows.
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::OsiSolverInterface
OsiSolverInterface()
Default Constructor.
CoinMpsIO
MPS IO Interface.
Definition: CoinMpsIO.hpp:401
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::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::isBinary
virtual bool isBinary(int colIndex) const
Return true if the variable is binary.
OsiSolverInterface::getInfinity
virtual double getInfinity() const =0
Get the solver&#39;s value for infinity.
OsiSolverInterface::numberObjects
int numberObjects() const
Get the number of objects.
Definition: OsiSolverInterface.hpp:1741
OsiSolverInterface::canDoSimplexInterface
virtual int canDoSimplexInterface() const
Return the simplex implementation level.
OsiSolverInterface::setColName
virtual void setColName(int ndx, std::string name)
Set a column name.
OsiSolverInterface::appDataEtc_
OsiAuxInfo * appDataEtc_
Pointer to user-defined data structure - and more if user wants.
Definition: OsiSolverInterface.hpp:2125
OsiSolverInterface::getHintParam
virtual bool getHintParam(OsiHintParam key, bool &yesNo, OsiHintStrength &strength) const
Get a hint parameter (sense and strength only)
Definition: OsiSolverInterface.hpp:373
OsiForceDo
And this means throw an exception if not possible.
Definition: OsiSolverParameters.hpp:138
OsiSolverInterface::messages_
CoinMessages messages_
Messages.
Definition: OsiSolverInterface.hpp:2100
OsiSolverInterface::getBInvARow
virtual void getBInvARow(int row, double *z, double *slack=NULL) const
Get a row of the tableau.
OsiSolverInterface::enableFactorization
virtual void enableFactorization() const
Prepare the solver for the use of tableau access methods.
OsiSolverInterface::getBasics
virtual void getBasics(int *index) const
Get indices of basic variables.
OsiSolverInterface::getColName
virtual std::string getColName(int colIndex, unsigned maxLen=static_cast< unsigned >(std::string::npos)) const
Return the name of the column.
OsiSolverInterface::modifiableObject
OsiObject * modifiableObject(int which) const
Get the specified object.
Definition: OsiSolverInterface.hpp:1754
OsiSolverInterface::setHintParam
virtual bool setHintParam(OsiHintParam key, bool yesNo=true, OsiHintStrength strength=OsiHintTry, void *=NULL)
Set a hint parameter.
Definition: OsiSolverInterface.hpp:312
OsiSolverInterface::ApplyCutsReturnCode::incrementInfeasible
void incrementInfeasible()
Increment infeasible cut counter.
Definition: OsiSolverInterface.hpp:151
OsiSolverInterface::getObjValue
virtual double getObjValue() const =0
Get the objective function value.
OsiRowCut
Row Cut Class.
Definition: OsiRowCut.hpp:29
OsiSolverInterface::OsiNameVec
std::vector< std::string > OsiNameVec
Data type for name vectors.
Definition: OsiSolverInterface.hpp:930
OsiSolverInterface::basisIsAvailable
virtual bool basisIsAvailable() const
Check if an optimal basis is available.
OsiSolverInterface::saveBaseModel
virtual void saveBaseModel()
Save a copy of the base model.
Definition: OsiSolverInterface.hpp:1286
OsiSolverInterface::isProvenOptimal
virtual bool isProvenOptimal() const =0
Is optimality proven?
OsiPrimalTolerance
Primal feasibility tolerance.
Definition: OsiSolverParameters.hpp:76
OsiSolverInterface::isAbandoned
virtual bool isAbandoned() const =0
Are there numerical difficulties?
OsiSolverInterface::deleteBranchingInfo
void deleteBranchingInfo(int numberDeleted, const int *which)
Deletes branching information before columns deleted.
OsiSolverInterface::messagesPointer
CoinMessages * messagesPointer()
Return a pointer to the current set of messages.
Definition: OsiSolverInterface.hpp:1703
OsiSolverInterface::intParam_
int intParam_[OsiLastIntParam]
Array of integer parameters.
Definition: OsiSolverInterface.hpp:2127
OsiSolverInterface::initialSolve
virtual void initialSolve()=0
Solve initial LP relaxation.
CoinWarmStart.hpp
Copyright (C) 2000 – 2003, International Business Machines Corporation and others.
OsiSolverInterface::applyCuts
virtual ApplyCutsReturnCode applyCuts(const OsiCuts &cs, double effectivenessLb=0.0)
Apply a collection of cuts.
OsiSolverInterface::strParam_
std::string strParam_[OsiLastStrParam]
Array of string parameters.
Definition: OsiSolverInterface.hpp:2131
CoinPackedMatrix
Sparse Matrix Base Class.
Definition: CoinPackedMatrix.hpp:79
OsiSolverInterface::copyParameters
void copyParameters(OsiSolverInterface &rhs)
Copy all parameters in this section from one solver to another.
OsiSolverInterface::forceFeasible
double forceFeasible()
Use current solution to set bounds so current integer feasible solution will stay feasible...
OsiSolverInterface::setObjCoeffSet
virtual void setObjCoeffSet(const int *indexFirst, const int *indexLast, const double *coeffList)
Set a set of objective function coefficients.
OsiSolverInterface::ApplyCutsReturnCode::operator=
ApplyCutsReturnCode & operator=(const ApplyCutsReturnCode &rhs)
Assignment operator.
Definition: OsiSolverInterface.hpp:99
OsiSolverInterface::setRowSetBounds
virtual void setRowSetBounds(const int *indexFirst, const int *indexLast, const double *boundList)
Set the bounds on 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::disableSimplexInterface
virtual void disableSimplexInterface()
Undo whatever setting changes the above method had to make.
OsiSolverInterface::getColSolution
virtual const double * getColSolution() const =0
Get a pointer to an array[getNumCols()] of primal variable values.
OsiHintTry
This means it is only a hint.
Definition: OsiSolverParameters.hpp:134
OsiSolverInterface::ws_
CoinWarmStart * ws_
Warm start information used for hot starts when the default hot start implementation is used...
Definition: OsiSolverInterface.hpp:2138
OsiSolverInterface::~OsiSolverInterface
virtual ~OsiSolverInterface()
Destructor.
CoinMessages::Language
Language
Supported languages.
Definition: CoinMessageHandler.hpp:148
OsiSolverInterface::getObjSense
virtual double getObjSense() const =0
Get the objective function sense.
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::isFreeBinary
virtual bool isFreeBinary(int colIndex) const
Return true if the variable is binary and not fixed.
CoinBigIndex
int CoinBigIndex
Definition: Coin_C_defines.h:136
OsiHintParam
OsiHintParam
Definition: OsiSolverParameters.hpp:106
OsiSolverInterface::getPointerToWarmStart
virtual CoinWarmStart * getPointerToWarmStart(bool &mustDelete)
Get warm start information.
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::defaultHandler_
bool defaultHandler_
Flag to say if the currrent handler is the default handler.
Definition: OsiSolverInterface.hpp:2098
OsiSolverInterface::loadFromCoinModel
virtual int loadFromCoinModel(CoinModel &modelObject, bool keepSolution=false)
Load a model from a CoinModel object.
OsiSolverInterface::getStrParam
virtual bool getStrParam(OsiStrParam key, std::string &value) const
Get a string parameter.
Definition: OsiSolverInterface.hpp:342
OsiSolverParameters.hpp
OsiSolverInterface::setInteger
virtual void setInteger(int index)=0
Set the index-th variable to be an integer variable.
OsiCollections.hpp
OsiSolverInterface::setColNames
virtual void setColNames(OsiNameVec &srcNames, int srcStart, int len, int tgtStart)
Set multiple column names.
OsiSolverInterface::getApplicationData
void * getApplicationData() const
Get application data.
OsiSolverInterface::getBInvACol
virtual void getBInvACol(int col, double *vec) const
Get a column of the tableau.
OsiSolverInterface::objName_
std::string objName_
Objective name.
Definition: OsiSolverInterface.hpp:2147
OsiSolverInterface::ApplyCutsReturnCode::incrementInternallyInconsistent
void incrementInternallyInconsistent()
Increment logically inconsistent cut counter.
Definition: OsiSolverInterface.hpp:147
OsiSolverInterface::deleteColNames
virtual void deleteColNames(int tgtStart, int len)
Delete len column names starting at index tgtStart.
OsiSolverInterface::setContinuous
virtual void setContinuous(int index)=0
Set the index-th variable to be a continuous variable.
OsiSolverInterface::ApplyCutsReturnCode::incrementExternallyInconsistent
void incrementExternallyInconsistent()
Increment model-inconsistent counter.
Definition: OsiSolverInterface.hpp:149
OsiSolverInterface::setObjective
virtual void setObjective(const double *array)
Set the objective coefficients for all columns.
OsiSolverInterface::passInMessageHandler
virtual void passInMessageHandler(CoinMessageHandler *handler)
Pass in a message handler.
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::getNumApplied
int getNumApplied() const
Number of cuts applied.
Definition: OsiSolverInterface.hpp:137
OsiSolverInterface::deleteRows
virtual void deleteRows(const int num, const int *rowIndices)=0
Delete a set of rows (constraints) from the problem.
OsiSolverInterface::markHotStart
virtual void markHotStart()
Create a hot start snapshot of the optimization process.
OsiIntParam
OsiIntParam
Definition: OsiSolverParameters.hpp:8
OsiRowCutDebugger
Validate cuts against a known solution.
Definition: OsiRowCutDebugger.hpp:42
OsiSolverInterface::ApplyCutsReturnCode::incrementApplied
void incrementApplied()
Increment applied cut counter.
Definition: OsiSolverInterface.hpp:155
OsiSolverInterface::addRow
virtual void addRow(const CoinPackedVectorBase &vec, const double rowlb, const double rowub)=0
Add a row (constraint) to the problem.
OsiSolverInterface::ApplyCutsReturnCode::~ApplyCutsReturnCode
~ApplyCutsReturnCode()
Destructor.
Definition: OsiSolverInterface.hpp:111
OsiVectorInt
std::vector< int > OsiVectorInt
Vector of int.
Definition: OsiCollections.hpp:20
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::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::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...
OsiSolverInterface::differentModel
int differentModel(OsiSolverInterface &other, bool ignoreNames=true)
Check two models against each other.
OsiSolverInterface::ApplyCutsReturnCode
Internal class for obtaining status from the applyCuts method.
Definition: OsiSolverInterface.hpp:72
OsiSolverInterface::reset
virtual void reset()
Reset the solver interface.
OsiSolverInterface::newLanguage
void newLanguage(CoinMessages::Language language)
Set language.
OsiLastDblParam
End marker.
Definition: OsiSolverParameters.hpp:84
OsiSolverInterface::getObjCoefficients
virtual const double * getObjCoefficients() const =0
Get a pointer to an array[getNumCols()] of objective function coefficients.
OsiSolverInterface::getDblParam
virtual bool getDblParam(OsiDblParam key, double &value) const
Get a double parameter.
Definition: OsiSolverInterface.hpp:334
OsiSolverInterface::getMatrixByRow
virtual const CoinPackedMatrix * getMatrixByRow() const =0
Get a pointer to a row-wise copy of the matrix.
OsiSolverInterface::setWarmStart
virtual bool setWarmStart(const CoinWarmStart *warmstart)=0
Set warm start information.
OsiSolverInterface::disableFactorization
virtual void disableFactorization() const
Undo the effects of enableFactorization.
OsiSolverInterface::ApplyCutsReturnCode::intInconsistent_
int intInconsistent_
Counter for logically inconsistent cuts.
Definition: OsiSolverInterface.hpp:161
OsiSolverInterface::getMutableMatrixByRow
virtual CoinPackedMatrix * getMutableMatrixByRow() const
Get a pointer to a mutable row-wise copy of the matrix.
Definition: OsiSolverInterface.hpp:662
OsiSolverInterface::isDualObjectiveLimitReached
virtual bool isDualObjectiveLimitReached() const
Is the given dual objective limit reached?
OsiSolverBranch
Solver Branch Class.
Definition: OsiSolverBranch.hpp:18
CoinLpIO
Class to read and write Lp files.
Definition: CoinLpIO.hpp:105
CoinPackedVector
Sparse Vector.
Definition: CoinPackedVector.hpp:123
OsiSolverInterface::getRowUpper
virtual const double * getRowUpper() const =0
Get a pointer to an array[getNumRows()] of row upper bounds.
OsiSolverInterface::getReducedCost
virtual const double * getReducedCost() const =0
Get a pointer to an array[getNumCols()] of reduced costs.
OsiSolverInterface::getRowLower
virtual const double * getRowLower() const =0
Get a pointer to an array[getNumRows()] of row lower bounds.
OsiSolverInterface::reducedCostFix
virtual int reducedCostFix(double gap, bool justInteger=true)
Fix variables at bound based on reduced cost.
OsiObject
Abstract base class for `objects&#39;.
Definition: OsiBranchingObject.hpp:56
OsiSolverInterface::getRowRange
virtual const double * getRowRange() const =0
Get a pointer to an array[getNumRows()] of row ranges.
OsiSolverInterface::object_
OsiObject ** object_
Integer and ... information (integer info normally at beginning)
Definition: OsiSolverInterface.hpp:2107
OsiSolverInterface::applyRowCut
virtual void applyRowCut(const OsiRowCut &rc)=0
Apply a row cut (append to the constraint matrix).
OsiSolverInterface::hintStrength_
OsiHintStrength hintStrength_[OsiLastHintParam]
Array of hint strengths.
Definition: OsiSolverInterface.hpp:2135
OsiSolverInterface::getEmptyWarmStart
virtual CoinWarmStart * getEmptyWarmStart() const =0
Get an empty warm start object.
OsiSolverInterface::colNames_
OsiNameVec colNames_
Column names.
Definition: OsiSolverInterface.hpp:2145
OsiSolverInterface::getHintParam
virtual bool getHintParam(OsiHintParam key, bool &yesNo) const
Get a hint parameter (sense only)
Definition: OsiSolverInterface.hpp:386
CoinBuild
In many cases it is natural to build a model by adding one row at a time.
Definition: CoinBuild.hpp:25
OsiSolverInterface::numberIntegers_
int numberIntegers_
Number of integers.
Definition: OsiSolverInterface.hpp:2102
CoinWarmStart
Abstract base class for warm start information.
Definition: CoinWarmStart.hpp:21
OsiSolverInterface::setInitialData
void setInitialData()
Set OsiSolverInterface object state for default constructor.
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::ApplyCutsReturnCode::incrementIneffective
void incrementIneffective()
Increment ineffective cut counter.
Definition: OsiSolverInterface.hpp:153
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.
OsiLastIntParam
End marker.
Definition: OsiSolverParameters.hpp:49
OsiSolverInterface::setRowColNames
void setRowColNames(const CoinMpsIO &mps)
Set row and column names from a CoinMpsIO object.
CoinMessages
Class to hold and manipulate an array of massaged messages.
Definition: CoinMessageHandler.hpp:140
OsiSolverInterface::getRowCutDebuggerAlways
OsiRowCutDebugger * getRowCutDebuggerAlways() const
Get the row cut debugger object.
OsiGrbSolverInterface
Gurobi Solver Interface.
Definition: OsiGrbSolverInterface.hpp:29
CoinPackedMatrix.hpp
OsiSolverInterface::rowCutDebugger_
OsiRowCutDebugger * rowCutDebugger_
Pointer to row cut debugger object.
Definition: OsiSolverInterface.hpp:2089
OsiSolverInterface::setObjSense
virtual void setObjSense(double s)=0
Set the objective function sense.
CoinSet
Very simple class for containing data on set.
Definition: CoinMpsIO.hpp:269
OsiSolverInterface::optimalBasisIsAvailable
bool optimalBasisIsAvailable() const
Synonym for basisIsAvailable.
Definition: OsiSolverInterface.hpp:1880
OsiSolverInterface::getColUpper
virtual const double * getColUpper() const =0
Get a pointer to an array[getNumCols()] of column upper bounds.