Go to the documentation of this file.
5 #ifndef OsiXprSolverInterface_H
6 #define OsiXprSolverInterface_H
98 virtual bool setWarmStart(
const CoinWarmStart *warmstart);
193 virtual bool isBinary(
int colIndex)
const;
200 virtual bool isInteger(
int colIndex)
const;
257 virtual std::vector< double * >
getDualRays(
int maxNumRays,
258 bool fullRay =
false)
const;
270 virtual std::vector< double * >
getPrimalRays(
int maxNumRays)
const;
289 virtual void setObjCoeff(
int elementIndex,
double elementValue);
293 virtual void setColLower(
int elementIndex,
double elementValue);
297 virtual void setColUpper(
int elementIndex,
double elementValue);
303 double lower,
double upper);
314 const int *indexLast,
315 const double *boundList);
319 virtual void setRowLower(
int elementIndex,
double elementValue);
323 virtual void setRowUpper(
int elementIndex,
double elementValue);
329 double lower,
double upper);
332 virtual void setRowType(
int index,
char sense,
double rightHandSide,
344 const int *indexLast,
345 const double *boundList);
358 const int *indexLast,
359 const char *senseList,
360 const double *rhsList,
361 const double *rangeList);
376 virtual void setInteger(
const int *indices,
int len);
413 virtual void addCol(
const CoinPackedVectorBase &vec,
414 const double collb,
const double colub,
417 virtual void addCols(
const int numcols,
418 const CoinPackedVectorBase *
const *cols,
419 const double *collb,
const double *colub,
422 virtual void deleteCols(
const int num,
const int *colIndices);
425 virtual void addRow(
const CoinPackedVectorBase &vec,
426 const double rowlb,
const double rowub);
428 virtual void addRow(
const CoinPackedVectorBase &vec,
429 const char rowsen,
const double rowrhs,
430 const double rowrng);
432 virtual void addRows(
const int numrows,
433 const CoinPackedVectorBase *
const *rows,
434 const double *rowlb,
const double *rowub);
436 virtual void addRows(
const int numrows,
437 const CoinPackedVectorBase *
const *rows,
438 const char *rowsen,
const double *rowrhs,
439 const double *rowrng);
441 virtual void deleteRows(
const int num,
const int *rowIndices);
466 double effectivenessLb = 0.0);
485 virtual void loadProblem(
const CoinPackedMatrix &matrix,
486 const double *collb,
const double *colub,
488 const double *rowlb,
const double *rowub);
498 double *&collb,
double *&colub,
double *&obj,
499 double *&rowlb,
double *&rowub);
513 virtual void loadProblem(
const CoinPackedMatrix &matrix,
514 const double *collb,
const double *colub,
516 const char *rowsen,
const double *rowrhs,
517 const double *rowrng);
527 double *&collb,
double *&colub,
double *&obj,
528 char *&rowsen,
double *&rowrhs,
533 virtual void loadProblem(
const int numcols,
const int numrows,
534 const int *start,
const int *index,
536 const double *collb,
const double *colub,
538 const double *rowlb,
const double *rowub);
542 virtual void loadProblem(
const int numcols,
const int numrows,
543 const int *start,
const int *index,
545 const double *collb,
const double *colub,
547 const char *rowsen,
const double *rowrhs,
548 const double *rowrng);
551 virtual int readMps(
const char *filename,
552 const char *extension =
"mps");
558 virtual void writeMps(
const char *filename,
559 const char *extension =
"mps",
560 double objSense = 0.0)
const;
virtual void addCol(const CoinPackedVectorBase &vec, const double collb, const double colub, const double obj)
Add a column (primal variable) to the problem.
double * objcoeffs_
Pointer to dense vector of objective coefficients.
void freeSolution()
Destroy cached copy of solution data (whenever it changes)
virtual bool isProvenDualInfeasible() const
Is dual infeasiblity proven?
double * rowlower_
Pointer to dense vector of slack variable lower bounds.
virtual int getNumCols() const
Get number of columns.
static FILE * logFilePtr_
The FILE* to the logfile.
std::string xprProbname_
XPRESS problem name (should be unique for each saved problem)
virtual int getNumRows() const
Get number of rows.
virtual bool isContinuous(int colIndex) const
Return true if variable is continuous.
virtual bool isBinary(int colIndex) const
Return true if the variable is binary.
virtual void setRowLower(int elementIndex, double elementValue)
Set a single row lower bound Use -COIN_DBL_MAX for -infinity.
virtual CoinWarmStart * getWarmStart() const
Get warmstarting information.
virtual const double * getRightHandSide() const
Get pointer to array[getNumRows()] of rows right-hand sides.
virtual void setColUpper(int elementIndex, double elementValue)
Set a single column upper bound Use COIN_DBL_MAX for infinity.
virtual double getInfinity() const
Get solver's value for infinity.
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 setObjCoeff(int elementIndex, double elementValue)
Set an objective function coefficient.
void OsiXprSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir)
A function that tests the methods in the OsiXprSolverInterface class.
virtual void setColBounds(int elementIndex, double lower, double upper)
Set a single column lower and upper bound The default implementation just invokes setColLower() and ...
double * rowact_
Pointer to dense vector of primal slack variable values.
virtual void resolve()
Resolve an LP relaxation after problem modification.
int getNumIntVars() const
Number of integer variables in the problem.
virtual const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
virtual bool isInteger(int colIndex) const
Return true if the variable is integer.
virtual void solveFromHotStart()
Optimize starting from the hotstart.
void passInMessageHandler(CoinMessageHandler *handler)
Pass in a message handler It is the client's responsibility to destroy a message handler installed by...
double * colprice_
Pointer to dense vector of dual column variable values.
double objsense_
Sense of objective (1 for min; -1 for max)
virtual bool setWarmStart(const CoinWarmStart *warmstart)
Set warmstarting information.
friend void OsiXprSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir)
A function that tests the methods in the OsiXprSolverInterface class.
static void decrementInstanceCounter()
XPRESS has a context that should be deleted after XPRESS calls.
double * collower_
Pointer to dense vector of structural variable lower bounds.
void activateMe() const
Save the current problem in XPRESS (if necessary) and make this problem current (restore if necessary...
bool setDblParam(OsiDblParam key, double value)
Set a double parameter.
virtual bool isDualObjectiveLimitReached() const
Is the given dual objective limit reached?
virtual const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of matrix.
virtual bool isPrimalObjectiveLimitReached() const
Is the given primal objective limit reached?
double * colupper_
Pointer to dense vector of structural variable upper bounds.
virtual bool isFreeBinary(int colIndex) const
Return true if the variable is binary and not fixed.
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 setColLower(int elementIndex, double elementValue)
Set a single column lower bound Use -COIN_DBL_MAX for -infinity.
XPRESS-MP Solver Interface.
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.
virtual void setObjSense(double s)
Set objective function sense (1 for min (default), -1 for max,)
bool domipstart
Whether to pass a column solution to XPRESS before starting MIP solve (loadmipsol)
Collections of row cuts and column cuts.
virtual void setColSolution(const double *colsol)
Set the primal solution column values.
virtual OsiSolverInterface * clone(bool copyData=true) const
Clone.
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 const double * getReducedCost() const
Get a pointer to array[getNumCols()] of reduced costs.
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()...
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.
virtual bool isIntegerNonBinary(int colIndex) const
Return true if the variable is general integer.
OsiXprSolverInterface & operator=(const OsiXprSolverInterface &rhs)
Assignment operator.
virtual const double * getRowActivity() const
Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vecto...
virtual void setContinuous(int index)
Set the index-th variable to be a continuous variable.
static unsigned int osiSerial_
Counts calls to incrementInstanceCounter()
virtual void applyRowCut(const OsiRowCut &rc)
Apply a row cut. Return true if cut was applied.
virtual const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of matrix.
virtual void setRowPrice(const double *rowprice)
Set dual solution vector.
CoinWarmStart * getEmptyWarmStart() const
Get empty warm start object.
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 const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
virtual const double * getColSolution() const
Get pointer to array[getNumCols()] of primal solution vector.
virtual void setRowType(int index, char sense, double rightHandSide, double range)
Set the type of a single row
virtual const char * getRowSense() const
Get pointer to array[getNumRows()] of row constraint senses.
static const char * logFileName_
Name of the logfile.
virtual const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
virtual void markHotStart()
Create a hotstart point of the optimization process.
static void incrementInstanceCounter()
XPRESS has a context that must be created prior to all other XPRESS calls.
double * rhs_
Pointer to dense vector of row right-hand side values.
virtual int readMps(const char *filename, const char *extension="mps")
Read an mps file from the given filename.
virtual const double * getRowPrice() const
Get pointer to array[getNumRows()] of dual prices.
void getVarTypes() const
Build cached copy of variable types.
virtual void deleteCols(const int num, const int *colIndices)
Remove a set of columns (primal variables) from the problem.
virtual void getBasisStatus(int *cstat, int *rstat) const
Returns a basis status of the structural/artificial variables At present as warm start i....
CoinPackedMatrix * matrixByCol_
CoinPackedMatrix * matrixByRow_
Pointer to row-wise copy of problem matrix coefficients.
std::vector< int > OsiVectorInt
Vector of int.
virtual const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
static int version()
Return XPRESS-MP Version number.
static unsigned int numInstances_
Number of live problem instances.
virtual bool isProvenPrimalInfeasible() const
Is primal infeasiblity proven?
virtual double getObjValue() const
Get objective function value.
virtual void addRow(const CoinPackedVectorBase &vec, const double rowlb, const double rowub)
Add a row (constraint) to the problem.
char * rowsense_
Pointer to dense vector of row sense indicators.
struct xo_prob_struct * XPRSprob
virtual bool isAbandoned() const
Are there a numerical difficulties?
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...
static void setLogFileName(const char *filename)
Set logfile name.
virtual int getNumElements() const
Get number of nonzero elements.
OsiXprSolverInterface(int newrows=50, int newnz=100)
Default Constructor.
virtual void setRowUpper(int elementIndex, double elementValue)
Set a single row upper bound Use COIN_DBL_MAX for infinity.
void setMipStart(bool value)
virtual void deleteRows(const int num, const int *rowIndices)
Delete a set of rows (constraints) from the problem.
virtual void unmarkHotStart()
Delete the snapshot.
virtual bool isIterationLimitReached() const
Iteration limit reached?
virtual void setInteger(int index)
Set the index-th variable to be an integer variable.
void gutsOfCopy(const OsiXprSolverInterface &source)
The real work of a copy constructor (used by copy and assignment)
virtual bool isProvenOptimal() const
Is optimality proven?
bool setIntParam(OsiIntParam key, int value)
Set an integer parameter.
int * ivarind_
Pointer to list of indices of XPRESS "global" variables.
static unsigned int getNumInstances()
Return the number of instances of instantiated objects using XPRESS services.
virtual std::vector< double * > getPrimalRays(int maxNumRays) const
Get as many primal rays as the solver can provide.
double * rowprice_
Pointer to dense vector of dual row variable values.
bool setStrParam(OsiStrParam key, const std::string &value)
Set a string parameter.
XPRSprob getLpPtr()
Return a pointer to the XPRESS problem.
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 double getObjSense() const
Get objective function sense (1 for min (default), -1 for max)
virtual void branchAndBound()
Invoke solver's built-in enumeration algorithm.
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...
virtual void applyColCut(const OsiColCut &cc)
Apply a column cut (bound adjustment).
virtual void initialSolve()
Solve initial LP relaxation.
bool getIntParam(OsiIntParam key, int &value) const
Get an integer parameter.
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...
char * vartype_
Pointer to dense vector of variable types (as above, or 'C' for continuous)
double * colsol_
Pointer to dense vector of primal structural variable values.
virtual const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
virtual ApplyCutsReturnCode applyCuts(const OsiCuts &cs, double effectivenessLb=0.0)
Apply a collection of cuts.
static int iXprCallCount_
char * ivartype_
Pointer to list of global variable types:
double * rowrange_
Pointer to dense vector of slack upper bounds for range constraints (undefined for non-range rows)
virtual int getIterationCount() const
Get how many iterations it took to solve the problem (whatever "iteration" mean to the solver.
void freeCachedResults()
Destroy cached copies of problem and solution data (whenever they change)
virtual const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
bool lastsolvewasmip
Indicates whether the last solve was for a MIP or an LP.
bool isDataLoaded() const
Save and restore are necessary if there is data associated with this problem.
void gutsOfDestructor()
The real work of a destructor (used by copy and assignment)
Abstract Base Class for describing an interface to a solver.
bool getStrParam(OsiStrParam key, std::string &value) const
Get a string parameter.
virtual ~OsiXprSolverInterface()
Destructor.
void gutsOfConstructor()
The real work of a constructor (used by construct and assignment)
double * rowsol_
Pointer to dense vector of primal slack variable values.
double * rowupper_
Pointer to dense vector of slack variable upper bounds.
static FILE * getLogFilePtr()
Get logfile FILE *.