13 #ifndef OsiCpxSolverInterface_H
14 #define OsiCpxSolverInterface_H
211 virtual bool isBinary(
int columnNumber)
const;
218 virtual bool isInteger(
int columnNumber)
const;
276 virtual std::vector<double*>
getDualRays(
int maxNumRays,
277 bool fullRay =
false)
const;
289 virtual std::vector<double*>
getPrimalRays(
int maxNumRays)
const;
308 virtual void setObjCoeff(
int elementIndex,
double elementValue );
312 const int* indexLast,
313 const double* coeffList);
318 virtual void setColLower(
int elementIndex,
double elementValue );
323 virtual void setColUpper(
int elementIndex,
double elementValue );
329 double lower,
double upper );
339 const int* indexLast,
340 const double* boundList);
344 virtual void setRowLower(
int elementIndex,
double elementValue );
348 virtual void setRowUpper(
int elementIndex,
double elementValue );
354 double lower,
double upper );
357 virtual void setRowType(
int index,
char sense,
double rightHandSide,
368 const int* indexLast,
369 const double* boundList);
381 const int* indexLast,
382 const char* senseList,
383 const double* rhsList,
384 const double* rangeList);
399 virtual void setInteger(
const int* indices,
int len);
438 const double collb,
const double colub,
443 virtual void addCols(
const int numcols,
445 const double* collb,
const double* colub,
448 virtual void deleteCols(
const int num,
const int * colIndices);
453 const double rowlb,
const double rowub);
456 const char rowsen,
const double rowrhs,
457 const double rowrng);
461 virtual void addRows(
const int numrows,
463 const double* rowlb,
const double* rowub);
465 virtual void addRows(
const int numrows,
467 const char* rowsen,
const double* rowrhs,
468 const double* rowrng);
470 virtual void deleteRows(
const int num,
const int * rowIndices);
497 double effectivenessLb = 0.0);
518 const double* collb,
const double* colub,
520 const double* rowlb,
const double* rowub);
530 double*& collb,
double*& colub,
double*& obj,
531 double*& rowlb,
double*& rowub);
546 const double* collb,
const double* colub,
548 const char* rowsen,
const double* rowrhs,
549 const double* rowrng);
559 double*& collb,
double*& colub,
double*& obj,
560 char*& rowsen,
double*& rowrhs,
565 virtual void loadProblem(
const int numcols,
const int numrows,
566 const int* start,
const int* index,
568 const double* collb,
const double* colub,
570 const double* rowlb,
const double* rowub);
574 virtual void loadProblem(
const int numcols,
const int numrows,
575 const int* start,
const int* index,
577 const double* collb,
const double* colub,
579 const char* rowsen,
const double* rowrhs,
580 const double* rowrng);
584 virtual int readMps(
const char *filename,
585 const char *extension =
"mps");
591 virtual void writeMps(
const char *filename,
592 const char *extension =
"mps",
593 double objSense=0.0)
const;
667 virtual void reset();
726 virtual void getBInvARow(
int row,
double* z,
double * slack=NULL)
const;
729 virtual void getBInvRow(
int row,
double* z)
const;
732 virtual void getBInvACol(
int col,
double* vec)
const;
735 virtual void getBInvCol(
int col,
double* vec)
const;
742 virtual void getBasics(
int* index)
const;
831 mutable double *
obj_;
virtual bool isPrimalObjectiveLimitReached() const
Is the given primal objective limit reached?
virtual const double * getReducedCost() const
Get a pointer to array[getNumCols()] of reduced costs.
virtual void setColLower(int elementIndex, double elementValue)=0
Set a single column lower bound.
virtual const double * getRightHandSide() const
Get pointer to array[getNumRows()] of rows right-hand sides.
virtual const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of matrix.
void OsiCpxSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir)
A function that tests the methods in the OsiCpxSolverInterface class.
CPXENVptr getMutableEnvironmentPtr() const
Get Environment Pointer for const methods.
void switchToLP()
switches CPLEX to prob type LP
double * rowact_
Pointer to row activity (slack) vector.
bool setDblParam(OsiDblParam key, double value)
Set a double parameter.
virtual bool basisIsAvailable() const
Returns true if a basis is available.
virtual bool isContinuous(int colNumber) const
Return true if column is continuous.
virtual double getObjValue() const
Get objective function value.
virtual void getBInvRow(int row, double *z) const
Get a row of the basis inverse.
virtual const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of matrix.
virtual void applyColCut(const OsiColCut &cc)
Apply a column cut (bound adjustment).
virtual void setObjSense(double s)
Set objective function sense (1 for min (default), -1 for max,)
virtual const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
Base class for message handling.
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.
bool domipstart
Whether to pass a column solution to CPLEX before starting MIP solve (copymipstart) ...
void freeCachedData(int keepCached=KEEPCACHED_NONE)
free all cached data (except specified entries, see getLpPtr())
only discard cached LP solution
virtual std::vector< double * > getPrimalRays(int maxNumRays) const
Get as many primal rays as the solver can provide.
char * rowsense_
Pointer to dense vector of row sense indicators.
virtual void addCol(const CoinPackedVectorBase &vec, const double collb, const double colub, const double obj)=0
Add a column (primal variable) to the problem.
virtual void reset()
Resets as if default constructor.
virtual void setObjCoeff(int elementIndex, double elementValue)
Set an objective function coefficient.
virtual void setColLower(int elementIndex, double elementValue)
Set a single column lower bound Use -COIN_DBL_MAX for -infinity.
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 void setColSolution(const double *colsol)
Set the primal solution column values.
virtual const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
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 void markHotStart()
Create a hotstart point of the optimization process.
virtual void setColUpper(int elementIndex, double elementValue)
Set a single column upper bound Use COIN_DBL_MAX for infinity.
void freeCachedMatrix()
free cached matrices
int * hotStartRStat_
CPLEX environment used in this class instance.
free only cached LP solution information
virtual void getBasics(int *index) const
Get indices of the pivot variable in each row (order of indices corresponds to the order of elements ...
LP solution: primal and dual solution, reduced costs, row activities.
virtual void getBasisStatus(int *cstat, int *rstat) const
Returns a basis status of the structural/artificial variables At present as warm start i...
virtual void enableSimplexInterface(int doingPrimal)
Useless function, defined only for compatibility with OsiSimplexInterface.
void freeCachedColRim()
free cached column rim vectors
int hotStartCStatSize_
CPLEX environment used in this class instance.
virtual void getBInvACol(int col, double *vec) const
Get a column of the tableau.
bool getDblParam(OsiDblParam key, double &value) const
Get a double parameter.
void gutsOfCopy(const OsiCpxSolverInterface &source)
The real work of a copy constructor (used by copy and assignment)
Sparse Matrix Base Class.
virtual void enableSimplexInterface(bool doingPrimal)
Enables normal operation of subsequent functions.
virtual int canDoSimplexInterface() const
Returns 1 if can just do getBInv etc 2 if has all OsiSimplex methods and 0 if it has none...
virtual int getNumCols() const
Get number of columns.
virtual const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
double * colupper_
Pointer to dense vector of variable lower bounds.
problem matrix: matrix ordered by column and by row
Collections of row cuts and column cuts.
virtual void addRows(const int numrows, const CoinPackedVectorBase *const *rows, const double *rowlb, const double *rowub)
void setMipStart(bool value)
void freeColType()
frees colsize_ vector
virtual int readMps(const char *filename, const char *extension="mps")
Read a problem in MPS format from the given filename.
virtual void setColUpper(int elementIndex, double elementValue)=0
Set a single column upper bound.
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...
keepCachedFlag
Get pointer to CPLEX model and free all specified cached data entries (combined with logical or-opera...
virtual bool isDualObjectiveLimitReached() const
Is the given dual objective limit reached?
Abstract base class for various sparse vectors.
bool getIntParam(OsiIntParam key, int &value) const
Get an integer parameter.
double * rowsol_
Pointer to dual solution vector.
virtual void setRowLower(int elementIndex, double elementValue)
Set a single row lower bound Use -COIN_DBL_MAX for -infinity.
virtual bool isAbandoned() const
Are there a numerical difficulties?
double * redcost_
Pointer to reduced cost vector.
virtual double getInfinity() const
Get solver's value for infinity.
std::vector< int > OsiVectorInt
Vector of int.
int * hotStartCStat_
Hotstart information.
virtual void unmarkHotStart()
Delete the snapshot.
virtual const double * getColSolution() const
Get pointer to array[getNumCols()] of primal solution vector.
void passInMessageHandler(CoinMessageHandler *handler)
Pass in a message handler It is the client's responsibility to destroy a message handler installed by...
int hotStartRStatSize_
CPLEX environment used in this class instance.
free only cached column and LP solution information
double * rowlower_
Pointer to dense vector of row lower bounds.
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 CoinWarmStart * getWarmStart() const
Get warmstarting information.
virtual const char * getRowSense() const
Get pointer to array[getNumRows()] of row constraint senses.
virtual std::vector< double * > getDualRays(int maxNumRays, bool fullRay=false) const
Get as many dual rays as the solver can provide.
virtual void setInteger(int index)
Set the index-th variable to be an integer variable.
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 void resolve()
Resolve an LP relaxation after problem modification.
row information: right hand sides, ranges and senses, lower and upper bounds for row ...
double * collower_
Pointer to dense vector of variable lower bounds.
virtual const double * getRowActivity() const
Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vecto...
void gutsOfDestructor()
The real work of the destructor.
virtual int getIterationCount() const
Get how many iterations it took to solve the problem (whatever "iteration" mean to the solver...
virtual void disableSimplexInterface()
Useless function, defined only for compatibility with OsiSimplexInterface.
virtual void setRowType(int index, char sense, double rightHandSide, double range)
Set the type of a single row
int coltypesize_
Size of allocated memory for coltype_.
virtual bool isBinary(int colIndex) const
Return true if the variable is binary.
virtual void addRows(const int numrows, const CoinPackedVectorBase *const *rows, const double *rowlb, const double *rowub)
virtual bool isProvenOptimal() const
Is optimality proven?
virtual void initialSolve()
Solve initial LP relaxation.
void switchToMIP()
switches CPLEX to prob type MIP
double * obj_
Pointer to objective vector.
Abstract Base Class for describing an interface to a solver.
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()...
virtual int getNumElements() const
Get number of nonzero elements.
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 enableFactorization() const
Useless function, defined only for compatibility with OsiSimplexInterface.
CPXENVptr getEnvironmentPtr()
Method to access CPLEX environment pointer.
virtual void deleteCols(const int num, const int *colIndices)
Remove a set of columns (primal variables) from the problem.
bool getStrParam(OsiStrParam key, std::string &value) const
Get a string parameter.
double * colsol_
Pointer to primal solution vector.
column information: objective values, lower and upper bounds, variable types
bool probtypemip_
Stores whether CPLEX' prob type is currently set to MIP.
virtual const double * getRowPrice() const
Get pointer to array[getNumRows()] of dual prices.
virtual const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
discard all cached data (default)
keep all cached data (similar to getMutableLpPtr())
virtual void addRow(const CoinPackedVectorBase &vec, const double rowlb, const double rowub)=0
Add a row (constraint) to the problem.
Abstract base class for warm start information.
double * rowrange_
Pointer to dense vector of slack upper bounds for range constraints (undefined for non-range rows) ...
virtual void disableFactorization() const
Useless function, defined only for compatibility with OsiSimplexInterface.
struct cpxenv * CPXENVptr
CPXENVptr env_
CPLEX environment used in this class instance.
CoinWarmStart * getEmptyWarmStart() const
Get an empty warm start object.
CoinPackedMatrix * matrixByCol_
Pointer to row-wise copy of problem matrix coefficients.
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 addRow(const CoinPackedVectorBase &vec, const double rowlb, const double rowub)
Add a row (constraint) to the problem.
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 int readMps(const char *filename, const char *extension="mps")
Read an mps file from the given filename.
virtual void deleteRows(const int num, const int *rowIndices)
Delete a set of rows (constraints) from the problem.
CPXLPptr getMutableLpPtr() const
Get LP Pointer for const methods.
friend void OsiCpxSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir)
A function that tests the methods in the OsiCpxSolverInterface class.
virtual bool isProvenPrimalInfeasible() const
Is primal infeasiblity proven?
virtual bool isInteger(int colIndex) const
Return true if the variable is integer.
char * coltype_
Pointer to dense vector of variable types (continous, binary, integer)
virtual bool isFreeBinary(int colIndex) const
Return true if the variable is binary and not fixed.
CPXLPptr getLpPtr(int keepCached=KEEPCACHED_NONE)
Get pointer to CPLEX model and free all specified cached data entries (combined with logical or-opera...
OsiCpxSolverInterface & operator=(const OsiCpxSolverInterface &rhs)
Assignment operator.
void freeCachedRowRim()
free cached row rim vectors
virtual bool isIterationLimitReached() const
Iteration limit reached?
bool setStrParam(OsiStrParam key, const std::string &value)
Set a string parameter.
virtual const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
CoinPackedMatrix * matrixByRow_
Pointer to row-wise copy of problem matrix coefficients.
void freeCachedResults()
free cached result vectors
virtual ~OsiCpxSolverInterface()
Destructor.
bool setIntParam(OsiIntParam key, int value)
Set an integer parameter.
bool disableadvbasis
Whether to disable use of advanced basis (if given)
void resizeColType(int minsize)
resizes coltype_ vector to be able to store at least minsize elements
virtual void getBInvCol(int col, double *vec) const
Get a column of the basis inverse.
virtual bool isProvenDualInfeasible() const
Is dual infeasiblity proven?
void gutsOfConstructor()
The real work of the constructor.
const char * getCtype() const
return a vector of variable types (continous, binary, integer)
virtual ApplyCutsReturnCode applyCuts(const OsiCuts &cs, double effectivenessLb=0.0)
Apply a collection of cuts.
virtual int getNumRows() const
Get number of rows.
virtual void getBInvARow(int row, double *z, double *slack=NULL) const
Get a row of the tableau (slack part in slack if not NULL)
virtual void setContinuous(int index)
Set the index-th variable to be a continuous variable.
virtual void applyRowCut(const OsiRowCut &rc)
Apply a row cut. Return true if cut was applied.
virtual const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
virtual void setRowPrice(const double *rowprice)
Set dual solution vector.
virtual void solveFromHotStart()
Optimize starting from the hotstart.
virtual void setRowUpper(int elementIndex, double elementValue)
Set a single row upper bound Use COIN_DBL_MAX for infinity.
virtual bool isIntegerNonBinary(int colIndex) const
Return true if the variable is general integer.
int hotStartMaxIteration_
CPLEX environment used in this class instance.
virtual bool setWarmStart(const CoinWarmStart *warmstart)
Set warmstarting information.
CPXLPptr lp_
CPLEX model represented by this class instance.
virtual void addCol(const CoinPackedVectorBase &vec, const double collb, const double colub, const double obj)
Add a column (primal variable) to the problem.
virtual void branchAndBound()
Invoke solver's built-in enumeration algorithm.
virtual OsiSolverInterface * clone(bool copyData=true) const
Clone.
virtual void setObjCoeffSet(const int *indexFirst, const int *indexLast, const double *coeffList)
Set a a set of objective function coefficients.
double * rhs_
Pointer to dense vector of row right-hand side values.
double * rowupper_
Pointer to dense vector of row upper bounds.
free only cached row and LP solution information
virtual double getObjSense() const
Get objective function sense (1 for min (default), -1 for max)
OsiCpxSolverInterface()
Default Constructor.
void freeAllMemory()
free all allocated memory
free only cached matrix and LP solution information
virtual void setColBounds(int elementIndex, double lower, double upper)
Set a single column lower and upper bound The default implementation just invokes setColLower() and ...