3 #ifndef OsiSolverInterface_H
4 #define OsiSolverInterface_H
9 #include "CoinMessageHandler.hpp"
10 #include "CoinPackedVectorBase.hpp"
15 class CoinPackedMatrix;
31 #include "CoinFinite.hpp"
62 const std::string & mpsDir,
63 const std::string & netlibDir);
65 const std::vector<OsiSolverInterface*> & vecSiP,
66 const std::string & mpsDir);
170 #ifdef CBC_NEXT_VERSION
194 int & numberSolves,
int & numberIterations,
195 bool forceBranch=
false);
288 void *otherInformation = NULL) {
294 throw CoinError(
"OsiForceDo illegal",
295 "setHintParam",
"OsiSolverInterface");
327 void *& otherInformation)
const {
332 otherInformation=NULL;
446 virtual bool setWarmStart(
const CoinWarmStart* warmstart) = 0;
558 virtual bool isBinary(
int colIndex)
const;
564 virtual bool isInteger(
int colIndex)
const;
584 virtual const char *
getColType(
bool refresh=
false)
const;
642 virtual std::vector<double*>
getDualRays(
int maxNumRays)
const = 0;
654 virtual std::vector<double*>
getPrimalRays(
int maxNumRays)
const = 0;
675 virtual void setObjCoeff(
int elementIndex,
double elementValue ) = 0;
679 const int* indexLast,
680 const double* coeffList);
704 virtual void setColLower(
int elementIndex,
double elementValue ) = 0;
715 virtual void setColUpper(
int elementIndex,
double elementValue ) = 0;
729 double lower,
double upper ) {
741 const int* indexLast,
742 const double* boundList);
746 virtual void setRowLower(
int elementIndex,
double elementValue ) = 0;
750 virtual void setRowUpper(
int elementIndex,
double elementValue ) = 0;
756 double lower,
double upper ) {
768 const int* indexLast,
769 const double* boundList);
773 virtual void setRowType(
int index,
char sense,
double rightHandSide,
781 const int* indexLast,
782 const char* senseList,
783 const double* rhsList,
784 const double* rangeList);
806 virtual void setRowPrice(
const double * rowprice) = 0;
831 virtual void setInteger(
const int* indices,
int len);
871 int ndx,
unsigned digits = 7)
const ;
875 virtual std::string
getObjName (
unsigned maxLen = static_cast<unsigned>(std::string::npos))
const ;
889 unsigned maxLen = static_cast<unsigned>(std::string::npos))
const ;
909 virtual void setRowName(
int ndx, std::string name) ;
918 int srcStart,
int len,
int tgtStart) ;
934 unsigned maxLen = static_cast<unsigned>(std::string::npos))
const ;
952 virtual void setColName(
int ndx, std::string name) ;
961 int srcStart,
int len,
int tgtStart) ;
1005 virtual void addCol(
const CoinPackedVectorBase& vec,
1006 const double collb,
const double colub,
1007 const double obj) = 0;
1014 virtual void addCol(
const CoinPackedVectorBase& vec,
1015 const double collb,
const double colub,
1016 const double obj, std::string name) ;
1019 virtual void addCol(
int numberElements,
1020 const int* rows,
const double* elements,
1021 const double collb,
const double colub,
1029 virtual void addCol(
int numberElements,
1030 const int* rows,
const double* elements,
1031 const double collb,
const double colub,
1032 const double obj, std::string name) ;
1039 virtual void addCols(
const int numcols,
1040 const CoinPackedVectorBase *
const * cols,
1041 const double* collb,
const double* colub,
1049 virtual void addCols(
const int numcols,
const int* columnStarts,
1050 const int* rows,
const double* elements,
1051 const double* collb,
const double* colub,
1055 void addCols(
const CoinBuild & buildObject);
1062 int addCols(CoinModel & modelObject);
1066 virtual void addCols(
const CoinPackedMatrix& matrix,
1067 const double* collb,
const double* colub,
1077 virtual void deleteCols(
const int num,
const int * colIndices) = 0;
1080 virtual void addRow(
const CoinPackedVectorBase& vec,
1081 const double rowlb,
const double rowub) = 0;
1088 virtual void addRow(
const CoinPackedVectorBase& vec,
1089 const double rowlb,
const double rowub,
1093 virtual void addRow(
const CoinPackedVectorBase& vec,
1094 const char rowsen,
const double rowrhs,
1095 const double rowrng) = 0;
1102 virtual void addRow(
const CoinPackedVectorBase& vec,
1103 const char rowsen,
const double rowrhs,
1104 const double rowrng, std::string name) ;
1110 virtual void addRow(
int numberElements,
1111 const int *columns,
const double *element,
1112 const double rowlb,
const double rowub) ;
1119 virtual void addRows(
const int numrows,
1120 const CoinPackedVectorBase *
const * rows,
1121 const double* rowlb,
const double* rowub);
1128 virtual void addRows(
const int numrows,
1129 const CoinPackedVectorBase *
const * rows,
1130 const char* rowsen,
const double* rowrhs,
1131 const double* rowrng);
1138 virtual void addRows(
const int numrows,
const int *rowStarts,
1139 const int *columns,
const double *element,
1140 const double *rowlb,
const double *rowub);
1143 void addRows(
const CoinBuild &buildObject);
1153 int addRows(CoinModel &modelObject);
1157 virtual void addRows(
const CoinPackedMatrix& matrix,
1158 const double* rowlb,
const double* rowub);
1160 virtual void addRows(
const CoinPackedMatrix& matrix,
1161 const char* rowsen,
const double* rowrhs,
1162 const double* rowrng);
1170 virtual void deleteRows(
const int num,
const int * rowIndices) = 0;
1203 double effectivenessLb = 0.0);
1240 virtual void loadProblem (
const CoinPackedMatrix& matrix,
1241 const double* collb,
const double* colub,
1243 const double* rowlb,
const double* rowub) = 0;
1255 double*& collb,
double*& colub,
double*& obj,
1256 double*& rowlb,
double*& rowub) = 0;
1274 virtual void loadProblem (
const CoinPackedMatrix& matrix,
1275 const double* collb,
const double* colub,
1277 const char* rowsen,
const double* rowrhs,
1278 const double* rowrng) = 0;
1290 double*& collb,
double*& colub,
double*& obj,
1291 char*& rowsen,
double*& rowrhs,
1292 double*& rowrng) = 0;
1306 virtual void loadProblem (
const int numcols,
const int numrows,
1307 const CoinBigIndex * start,
const int* index,
1308 const double* value,
1309 const double* collb,
const double* colub,
1311 const double* rowlb,
const double* rowub) = 0;
1325 virtual void loadProblem (
const int numcols,
const int numrows,
1326 const CoinBigIndex * start,
const int* index,
1327 const double* value,
1328 const double* collb,
const double* colub,
1330 const char* rowsen,
const double* rowrhs,
1331 const double* rowrng) = 0;
1340 bool keepSolution=
false);
1347 virtual int readMps (
const char *filename,
1348 const char *extension =
"mps") ;
1356 virtual int readMps (
const char *filename,
const char*extension,
1357 int & numberSets, CoinSet ** & sets);
1364 virtual int readGMPL (
const char *filename,
const char *dataname=NULL);
1372 virtual void writeMps (
const char *filename,
1373 const char *extension =
"mps",
1374 double objSense=0.0)
const = 0;
1390 const char ** rowNames,
const char ** columnNames,
1391 int formatType=0,
int numberAcross=2,
1393 const CoinSet *
setInfo=NULL)
const ;
1417 virtual void writeLp(
const char *filename,
1418 const char *extension =
"lp",
1419 double epsilon = 1e-5,
1420 int numberAcross = 10,
1422 double objSense = 0.0,
1423 bool useRowNames =
true)
const;
1429 virtual void writeLp(FILE *fp,
1430 double epsilon = 1e-5,
1431 int numberAcross = 10,
1433 double objSense = 0.0,
1434 bool useRowNames =
true)
const;
1455 char const *
const *
const rowNames,
1456 char const *
const *
const columnNames,
1457 const double epsilon = 1.0e-5,
1458 const int numberAcross = 10,
1459 const int decimals = 5,
1460 const double objSense = 0.0,
1461 const bool useRowNames =
true)
const;
1468 char const *
const *
const rowNames,
1469 char const *
const *
const columnNames,
1470 const double epsilon = 1.0e-5,
1471 const int numberAcross = 10,
1472 const int decimals = 5,
1473 const double objSense = 0.0,
1474 const bool useRowNames =
true)
const;
1478 virtual int readLp(
const char *filename,
const double epsilon = 1e-5);
1482 int readLp(FILE *fp,
const double epsilon = 1e-5);
1498 #ifdef COIN_SNAPSHOT
1499 virtual CoinSnapshot * snapshot(
bool createArrays=
true)
const;
1502 #ifdef COIN_FACTORIZATION_INFO
1503 virtual CoinBigIndex
getSizeL()
const;
1506 virtual CoinBigIndex
getSizeU()
const;
1552 void newLanguage(CoinMessages::Language language);
1730 virtual int pivot(
int colIn,
int colOut,
int outStatus) ;
1744 int& colOut,
int& outStatus,
1745 double& t, CoinPackedVector* dx);
1754 int colOut,
int outStatus,
1755 double& t, CoinPackedVector* dx) ;
1767 virtual void getBInvARow(
int row,
double* z,
double * slack=NULL)
const ;
1770 virtual void getBInvRow(
int row,
double* z)
const ;
1773 virtual void getBInvACol(
int col,
double* vec)
const ;
1776 virtual void getBInvCol(
int col,
double* vec)
const ;
1782 virtual void getBasics(
int* index)
const ;
1814 virtual void reset();
1832 char& sense,
double& right,
double& range)
const;
1838 double& lower,
double& upper)
const;
1841 template <
class T>
inline T
1843 return value < lower ? lower : (value > upper ? upper : value);
1929 const std::string & mpsDir,
1930 const std::string & netlibDir);
1937 const std::vector<OsiSolverInterface*> & vecSiP,
1938 const std::string & mpsDir);
1945 char& sense,
double& right,
1946 double& range)
const
1957 range = upper - lower;
1980 double& lower,
double& upper)
const
1985 lower = upper = right;
1996 lower = right - range;