11 #ifndef OsiMskSolverInterface_H 
   12 #define OsiMskSolverInterface_H 
  205       virtual bool isBinary(
int columnNumber) 
const;
 
  212       virtual bool isInteger(
int columnNumber) 
const;
 
  270       virtual std::vector<double*> 
getDualRays(
int maxNumRays,
 
  271                                                bool fullRay=
false) 
const;
 
  283       virtual std::vector<double*> 
getPrimalRays(
int maxNumRays) 
const;
 
  302       virtual void setObjCoeff( 
int elementIndex, 
double elementValue );
 
  306                                   const int* indexLast,
 
  307                                   const double* coeffList);
 
  311       virtual void setColLower( 
int elementIndex, 
double elementValue );
 
  315       virtual void setColUpper( 
int elementIndex, 
double elementValue );
 
  321                                  double lower, 
double upper );
 
  331                                    const int* indexLast,
 
  332                                    const double* boundList);
 
  336       virtual void setRowLower( 
int elementIndex, 
double elementValue );
 
  340       virtual void setRowUpper( 
int elementIndex, 
double elementValue );
 
  346                                  double lower, 
double upper );
 
  349       virtual void setRowType(
int index, 
char sense, 
double rightHandSide,
 
  360                                    const int* indexLast,
 
  361                                    const double* boundList);
 
  373                                   const int* indexLast,
 
  374                                   const char* senseList,
 
  375                                   const double* rhsList,
 
  376                                   const double* rangeList);
 
  391       virtual void setInteger(
const int* indices, 
int len);
 
  429                           const double collb, 
const double colub,   
 
  432       virtual void addCols(
const int numcols,
 
  434                            const double* collb, 
const double* colub,   
 
  437       virtual void deleteCols(
const int num, 
const int * colIndices);
 
  441                           const double rowlb, 
const double rowub);
 
  444                           const char rowsen, 
const double rowrhs,   
 
  445                           const double rowrng);
 
  447       virtual void addRows(
const int numrows,
 
  449                            const double* rowlb, 
const double* rowub);
 
  451       virtual void addRows(
const int numrows,
 
  453                            const char* rowsen, 
const double* rowrhs,   
 
  454                            const double* rowrng);
 
  456       virtual void deleteRows(
const int num, 
const int * rowIndices);
 
  483                                             double effectivenessLb = 0.0);
 
  504                              const double* collb, 
const double* colub,   
 
  506                              const double* rowlb, 
const double* rowub);
 
  516                                double*& collb, 
double*& colub, 
double*& obj,
 
  517                                double*& rowlb, 
double*& rowub);
 
  532                              const double* collb, 
const double* colub,
 
  534                              const char* rowsen, 
const double* rowrhs,   
 
  535                              const double* rowrng);
 
  545                                double*& collb, 
double*& colub, 
double*& obj,
 
  546                                char*& rowsen, 
double*& rowrhs,
 
  551     virtual void loadProblem(
const int numcols, 
const int numrows,
 
  552                              const int* start, 
const int* index,
 
  554                              const double* collb, 
const double* colub,   
 
  556                              const double* rowlb, 
const double* rowub);
 
  560     virtual void loadProblem(
const int numcols, 
const int numrows,
 
  561                              const int* start, 
const int* index,
 
  563                              const double* collb, 
const double* colub,   
 
  565                              const char* rowsen, 
const double* rowrhs,   
 
  566                              const double* rowrng);
 
  569     virtual int readMps(
const char *filename,
 
  570                          const char *extension = 
"mps");
 
  576     virtual void writeMps(
const char *filename,
 
  577                           const char *extension = 
"mps",
 
  578                           double objSense=0.0) 
const;
 
  777   mutable double  *
obj_;
 
static void incrementInstanceCounter()
MOSEK has a context which must be created prior to all other MOSEK calls. 
char * coltype_
Pointer to dense vector of variable types (continous, binary, integer) 
virtual void setColUpper(int elementIndex, double elementValue)
Set a single column upper bound  Use COIN_DBL_MAX for infinity. 
only discard cached LP solution 
virtual void setRowBounds(int elementIndex, double lower, double upper)
Set a single row lower and upper bound  The default implementation just invokes setRowLower() and set...
MSKtask_t getMutableLpPtr() const 
Get task Pointer for const methods. 
void freeCachedRowRim()
free cached row rim vectors 
static unsigned int getNumInstances()
Return the number of instances of instantiated objects using MOSEK services. 
bool setIntParam(OsiIntParam key, int value)
Set an integer parameter. 
virtual const double * getRowRange() const 
Get pointer to array[getNumRows()] of row ranges. 
virtual int getNumElements() const 
Get number of nonzero elements. 
virtual void resolve()
Resolve an LP relaxation after problem modification. 
free only cached row and LP solution information 
virtual void deleteRows(const int num, const int *rowIndices)
Delete a set of rows (constraints) from the problem. 
virtual bool isIterationLimitReached() const 
Iteration limit reached? 
virtual bool isIntegerNonBinary(int colIndex) const 
Return true if the variable is general integer. 
void switchToLP()
switches MOSEK to prob type LP 
keepCachedFlag
Get pointer to MOSEK model and free all specified cached data entries (combined with logical or-opera...
void freeCachedData(int keepCached=KEEPCACHED_NONE)
free all cached data (except specified entries, see getLpPtr()) 
virtual const char * getRowSense() const 
Get pointer to array[getNumRows()] of row constraint senses. 
virtual bool isDualObjectiveLimitReached() const 
Is the given dual objective limit reached? 
void passInMessageHandler(CoinMessageHandler *handler)
Pass in a message handler It is the client's responsibility to destroy a message handler installed by...
virtual void setObjCoeff(int elementIndex, double elementValue)
Set an objective function coefficient. 
virtual void setRowType(int index, char sense, double rightHandSide, double range)
Set the type of a single row  
double * colsol_
Pointer to primal solution vector. 
virtual void loadProblem(const CoinPackedMatrix &matrix, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub)
Load in an problem by copying the arguments (the constraints on the rows are given by lower and upper...
virtual const double * getRowLower() const 
Get pointer to array[getNumRows()] of row lower bounds. 
int getRescode() const 
Get rescode return of last Mosek optimizer call. 
virtual void setRowLower(int elementIndex, double elementValue)
Set a single row lower bound  Use -COIN_DBL_MAX for -infinity. 
int * hotStartCStat_
Hotstart information. 
bool setStrParam(OsiStrParam key, const std::string &value)
Set a string parameter. 
const char * getCtype() const 
return a vector of variable types (continous, binary, integer) 
virtual const double * getRightHandSide() const 
Get pointer to array[getNumRows()] of rows right-hand sides. 
Collections of row cuts and column cuts. 
virtual void unmarkHotStart()
Delete the snapshot. 
MSKtask_t getLpPtr(int keepCached=KEEPCACHED_NONE)
void gutsOfDestructor()
The real work of the destructor. 
virtual void setObjSense(double s)
Set objective function sense (1 for min (default), -1 for max,) 
virtual void applyColCut(const OsiColCut &cc)
Apply a column cut (bound adjustment). 
double * rhs_
Pointer to dense vector of row right-hand side values. 
virtual void deleteCols(const int num, const int *colIndices)
Remove a set of columns (primal variables) from the problem. 
Base class for message handling. 
virtual void setObjCoeffSet(const int *indexFirst, const int *indexLast, const double *coeffList)
Set a a set of objective function coefficients. 
virtual bool isInteger(int colIndex) const 
Return true if the variable is integer. 
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. 
virtual bool isPrimalObjectiveLimitReached() const 
Is the given primal objective limit reached? 
virtual void setRowSetTypes(const int *indexFirst, const int *indexLast, const char *senseList, const double *rhsList, const double *rangeList)
Set the type of a number of rows simultaneously  The default implementation just invokes setRowType()...
void freeCachedColRim()
free cached column rim vectors 
virtual void assignProblem(CoinPackedMatrix *&matrix, double *&collb, double *&colub, double *&obj, double *&rowlb, double *&rowub)
Load in an problem by assuming ownership of the arguments (the constraints on the rows are given by l...
virtual void setInteger(int index)
Set the index-th variable to be an integer variable. 
friend void OsiMskSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir)
A function that tests the methods in the OsiMskSolverInterface class. 
Abstract Base Class for describing an interface to a solver. 
virtual void solveFromHotStart()
Optimize starting from the hotstart. 
virtual void setRowSetBounds(const int *indexFirst, const int *indexLast, const double *boundList)
Set the bounds on a number of rows simultaneously  The default implementation just invokes setRowLowe...
virtual void setContinuous(int index)
Set the index-th variable to be a continuous variable. 
void freeColType()
frees colsize_ vector 
discard all cached data (default) 
void OsiMskSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir)
A function that tests the methods in the OsiMskSolverInterface class. 
virtual void addCol(const CoinPackedVectorBase &vec, const double collb, const double colub, const double obj)
Add a column (primal variable) to the problem. 
Abstract base class for various sparse vectors. 
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...
virtual bool setWarmStart(const CoinWarmStart *warmstart)
Set warmstarting information. 
virtual bool isContinuous(int colNumber) const 
Return true if column is continuous. 
double * rowupper_
Pointer to dense vector of row upper bounds. 
void resizeColType(int minsize)
resizes coltype_ vector to be able to store at least minsize elements 
virtual void setColSetBounds(const int *indexFirst, const int *indexLast, const double *boundList)
Set the bounds on a number of columns simultaneously  The default implementation just invokes setColl...
virtual const double * getRowActivity() const 
Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vecto...
bool getStrParam(OsiStrParam key, std::string &value) const 
Get a string parameter. 
CoinPackedMatrix * matrixByCol_
Pointer to row-wise copy of problem matrix coefficients. 
double * rowrange_
Pointer to dense vector of slack upper bounds for range constraints (undefined for non-range rows) ...
problem matrix: matrix ordered by column and by row 
void freeCachedResults()
free cached result vectors 
void gutsOfCopy(const OsiMskSolverInterface &source)
The real work of a copy constructor (used by copy and assignment) 
virtual void setRowPrice(const double *rowprice)
Set dual solution vector. 
virtual int getNumCols() const 
Get number of columns. 
int hotStartMaxIteration_
void freeCachedMatrix()
free cached matrices 
double * redcost_
Pointer to reduced cost vector. 
virtual const double * getObjCoefficients() const 
Get pointer to array[getNumCols()] of objective function coefficients. 
virtual bool isBinary(int colIndex) const 
Return true if the variable is binary. 
virtual CoinWarmStart * getWarmStart() const 
Get warmstarting information. 
double * collower_
Pointer to dense vector of variable lower bounds. 
virtual int getNumRows() const 
Get number of rows. 
virtual bool isProvenOptimal() const 
Is optimality proven? 
free only cached column and LP solution information 
virtual const double * getRowPrice() const 
Get pointer to array[getNumRows()] of dual prices. 
int coltypesize_
Size of allocated memory for coltype_. 
bool getDblParam(OsiDblParam key, double &value) const 
Get a double parameter. 
virtual std::vector< double * > getDualRays(int maxNumRays, bool fullRay=false) const 
Get as many dual rays as the solver can provide. 
bool setDblParam(OsiDblParam key, double value)
Set a double parameter. 
virtual const double * getRowUpper() const 
Get pointer to array[getNumRows()] of row upper bounds. 
virtual void branchAndBound()
Invoke solver's built-in enumeration algorithm. 
char * rowsense_
Pointer to dense vector of row sense indicators. 
void switchToMIP()
switches MOSEK to prob type MIP 
virtual void setRowUpper(int elementIndex, double elementValue)
Set a single row upper bound  Use COIN_DBL_MAX for infinity. 
virtual void markHotStart()
Create a hotstart point of the optimization process. 
virtual ApplyCutsReturnCode applyCuts(const OsiCuts &cs, double effectivenessLb=0.0)
Apply a collection of cuts. 
virtual void setColBounds(int elementIndex, double lower, double upper)
Set a single column lower and upper bound  The default implementation just invokes setColLower() and ...
Sparse Matrix Base Class. 
free only cached matrix and LP solution information 
row information: right hand sides, ranges and senses, lower and upper bounds for row ...
virtual OsiSolverInterface * clone(bool copyData=true) const 
Clone. 
bool getIntParam(OsiIntParam key, int &value) const 
Get an integer parameter. 
virtual ~OsiMskSolverInterface()
Destructor. 
virtual const double * getColLower() const 
Get pointer to array[getNumCols()] of column lower bounds. 
OsiMskSolverInterface & operator=(const OsiMskSolverInterface &rhs)
Assignment operator. 
virtual double getInfinity() const 
Get solver's value for infinity. 
OsiMskSolverInterface(MSKenv_t mskenv=NULL)
Default Constructor optional argument mskenv can be used to reach in an initialized user environment ...
static MSKenv_t env_
MOSEK environment pointer. 
virtual bool isFreeBinary(int colIndex) const 
Return true if the variable is binary and not fixed. 
double * obj_
Pointer to objective vector. 
virtual const double * getReducedCost() const 
Get a pointer to array[getNumCols()] of reduced costs. 
virtual const double * getColUpper() const 
Get pointer to array[getNumCols()] of column upper bounds. 
virtual std::vector< double * > getPrimalRays(int maxNumRays) const 
Get as many primal rays as the solver can provide. 
virtual bool isAbandoned() const 
Are there a numerical difficulties? 
virtual void initialSolve()
Solve initial LP relaxation. 
virtual int getIterationCount() const 
Get how many iterations it took to solve the problem (whatever "iteration" mean to the solver...
virtual void writeMps(const char *filename, const char *extension="mps", double objSense=0.0) const 
Write the problem into an mps file of the given filename. 
virtual int readMps(const char *filename, const char *extension="mps")
Read an mps file from the given filename. 
virtual void setColLower(int elementIndex, double elementValue)
Set a single column lower bound  Use -COIN_DBL_MAX for -infinity. 
static void decrementInstanceCounter()
MOSEK has a context which should be deleted after MOSEK calls. 
keep all cached data (similar to getMutableLpPtr()) 
LP solution: primal and dual solution, reduced costs, row activities. 
CoinWarmStart * getEmptyWarmStart() const 
Get an empty warm start object. 
void gutsOfConstructor()
The real work of the constructor. 
MSKenv_t getEnvironmentPtr()
Method to access MOSEK environment pointer. 
bool definedSolution(int solution) const 
virtual void applyRowCut(const OsiRowCut &rc)
Apply a row cut. Return true if cut was applied. 
std::vector< int > OsiVectorInt
Vector of int. 
virtual void addRow(const CoinPackedVectorBase &vec, const double rowlb, const double rowub)
Add a row (constraint) to the problem. 
double * colupper_
Pointer to dense vector of variable lower bounds. 
column information: objective values, lower and upper bounds, variable types 
bool probtypemip_
Stores whether MOSEK' prob type is currently set to MIP. 
virtual bool isProvenDualInfeasible() const 
Is dual infeasiblity proven? 
virtual const double * getColSolution() const 
Get pointer to array[getNumCols()] of primal solution vector. 
void freeAllMemory()
free all allocated memory 
virtual double getObjValue() const 
Get objective function value. 
static unsigned int numInstances_
Number of live problem instances. 
free only cached LP solution information 
CoinPackedMatrix * matrixByRow_
Pointer to row-wise copy of problem matrix coefficients. 
virtual void setColSolution(const double *colsol)
Set the primal solution column values. 
virtual const CoinPackedMatrix * getMatrixByCol() const 
Get pointer to column-wise copy of matrix. 
Abstract base class for warm start information. 
virtual bool isLicenseError() const 
Has there been a license problem? 
double * rowsol_
Pointer to dual solution vector. 
double * rowlower_
Pointer to dense vector of row lower bounds. 
virtual bool isProvenPrimalInfeasible() const 
Is primal infeasiblity proven? 
virtual double getObjSense() const 
Get objective function sense (1 for min (default), -1 for max) 
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. 
double * rowact_
Pointer to row activity (slack) vector. 
virtual const CoinPackedMatrix * getMatrixByRow() const 
Get pointer to row-wise copy of matrix. 
MSKtask_t task_
MOSEK model represented by this class instance.