OsiSolverInterface Class Reference

Solver Interface Abstract Base Class. More...

#include <OsiSolverInterface.hpp>

Inheritance diagram for OsiSolverInterface:

Inheritance graph
[legend]
Collaboration diagram for OsiSolverInterface:

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::vector< std::string > OsiNameVec
 Data type for name vectors.

Public Member Functions

Solve methods
virtual void initialSolve ()=0
 Solve initial LP relaxation.
virtual void resolve ()=0
 Resolve an LP relaxation after problem modification.
virtual void branchAndBound ()=0
 Invoke solver's built-in enumeration algorithm.
Parameter set/get methods
The set methods return true if the parameter was set to the given value, false otherwise. When a set method returns false, the original value (if any) should be unchanged. There can be various reasons for failure: the given parameter is not applicable for the solver (e.g., refactorization frequency for the volume algorithm), the parameter is not yet implemented for the solver or simply the value of the parameter is out of the range the solver accepts. If a parameter setting call returns false check the details of your solver.

The get methods return true if the given parameter is applicable for the solver and is implemented. In this case the value of the parameter is returned in the second argument. Otherwise they return false.

Note:
There is a default implementation of the set/get methods, namely to store/retrieve the given value using an array in the base class. A specific solver implementation can use this feature, for example, to store parameters that should be used later on. Implementors of a solver interface should overload these functions to provide the proper interface to and accurately reflect the capabilities of a specific solver.
The format for hints is slightly different in that the value is boolean and there is an enum to show strength of hint. There is also an optional void pointer to allow for any eventuality. Hints should be initialised when a solver is instantiated. (See OsiSolverParameters.hpp for defined hint parameters and strength.) A value of true means to work with the hint, false to work against it. For example,
  •  setHintParam(OsiDoScale,true,OsiHintTry) 
    
    is a mild suggestion to the solver to scale the constraint system.
  •  setHintParam(OsiDoScale,false,OsiForceDo) 
    
    tells the solver to disable scaling, or throw an exception if it cannot comply.
As another example, a solver interface could use the value and strength of the OsiDoReducePrint hint to adjust the amount of information printed by the interface and/or solver. The extent to which a solver obeys hints is left to the solver. The value and strength returned by getHintParam will match the most recent call to setHintParam, and will not necessarily reflect the solver's ability to comply with the hint. If the hint strength is OsiForceDo, the solver is required to throw an exception if it cannot perform the specified action.

Note:
As with the other set/get methods, there is a default implementation which maintains arrays in the base class for hint value and strength. The default implementation does not store the void pointer, and always throws an exception for strength OsiForceDo. Implementors of a solver interface should overload these functions to provide the proper interface to and accurately reflect the capabilities of a specific solver.


virtual bool setIntParam (OsiIntParam key, int value)
virtual bool setDblParam (OsiDblParam key, double value)
virtual bool setStrParam (OsiStrParam key, const std::string &value)
virtual bool setHintParam (OsiHintParam key, bool yesNo=true, OsiHintStrength strength=OsiHintTry, void *otherInformation=NULL)
virtual bool getIntParam (OsiIntParam key, int &value) const
virtual bool getDblParam (OsiDblParam key, double &value) const
double getIntegerTolerance () const
 We should be able to get an integer tolerance.
virtual bool getStrParam (OsiStrParam key, std::string &value) const
virtual bool getHintParam (OsiHintParam key, bool &yesNo, OsiHintStrength &strength, void *&otherInformation) const
virtual bool getHintParam (OsiHintParam key, bool &yesNo, OsiHintStrength &strength) const
virtual bool getHintParam (OsiHintParam key, bool &yesNo) const
void copyParameters (OsiSolverInterface &rhs)
Methods returning info on how the solution process terminated
virtual bool isAbandoned () const =0
 Are there numerical difficulties?
virtual bool isProvenOptimal () const =0
 Is optimality proven?
virtual bool isProvenPrimalInfeasible () const =0
 Is primal infeasiblity proven?
virtual bool isProvenDualInfeasible () const =0
 Is dual infeasiblity proven?
virtual bool isPrimalObjectiveLimitReached () const =0
 Is the given primal objective limit reached?
virtual bool isDualObjectiveLimitReached () const =0
 Is the given dual objective limit reached?
virtual bool isIterationLimitReached () const =0
 Iteration limit reached?
Warm start methods
Note that the warm start methods return a generic CoinWarmStart object. The precise characteristics of this object are solver-dependent. Clients who wish to maintain a maximum degree of solver independence should take care to avoid unnecessary assumptions about the properties of a warm start object.

virtual CoinWarmStartgetEmptyWarmStart () const =0
 Get an empty warm start object.
virtual CoinWarmStartgetWarmStart () const =0
 Get warm start information.
virtual CoinWarmStartgetPointerToWarmStart (bool &mustDelete)
 Get warm start information.
virtual bool setWarmStart (const CoinWarmStart *warmstart)=0
 Set warm start information.
Hot start methods
Primarily used in strong branching. The user can create a hot start object --- a snapshot of the optimization process --- then reoptimize over and over again, starting from the same point.

Note:
  • Between hot started optimizations only bound changes are allowed.
  • The copy constructor and assignment operator should NOT copy any hot start information.
  • The default implementation simply extracts a warm start object in markHotStart, resets to the warm start object in solveFromHotStart, and deletes the warm start object in unmarkHotStart. Actual solver implementations are encouraged to do better.


virtual void markHotStart ()
 Create a hot start snapshot of the optimization process.
virtual void solveFromHotStart ()
 Optimize starting from the hot start snapshot.
virtual void unmarkHotStart ()
 Delete the hot start snapshot.
Problem query methods
Querying a problem that has no data associated with it will result in zeros for the number of rows and columns, and NULL pointers from the methods that return vectors.

Const pointers returned from any data-query method are valid as long as the data is unchanged and the solver is not called.

virtual int getNumCols () const =0
 Get number of columns.
virtual int getNumRows () const =0
 Get number of rows.
virtual int getNumElements () const =0
 Get number of nonzero elements.
virtual int getNumIntegers () const
 Get number of integer variables.
virtual const double * getColLower () const =0
 Get pointer to array[getNumCols()] of column lower bounds.
virtual const double * getColUpper () const =0
 Get pointer to array[getNumCols()] of column upper bounds.
virtual const char * getRowSense () const =0
 Get pointer to array[getNumRows()] of row constraint senses.
virtual const double * getRightHandSide () const =0
 Get pointer to array[getNumRows()] of row right-hand sides.
virtual const double * getRowRange () const =0
 Get pointer to array[getNumRows()] of row ranges.
virtual const double * getRowLower () const =0
 Get pointer to array[getNumRows()] of row lower bounds.
virtual const double * getRowUpper () const =0
 Get pointer to array[getNumRows()] of row upper bounds.
virtual const double * getObjCoefficients () const =0
 Get pointer to array[getNumCols()] of objective function coefficients.
virtual double getObjSense () const =0
 Get objective function sense (1 for min (default), -1 for max).
virtual bool isContinuous (int colIndex) const =0
 Return true if variable is continuous.
virtual bool isBinary (int colIndex) const
 Return true if variable is binary.
virtual bool isInteger (int colIndex) const
 Return true if column is integer.
virtual bool isIntegerNonBinary (int colIndex) const
 Return true if variable is general integer.
virtual bool isFreeBinary (int colIndex) const
 Return true if variable is binary and not fixed at either bound.
const char * columnType (bool refresh=false) const
 Return array of column length 0 - continuous 1 - binary (may get fixed to 0 or 1 later) 2 - general integer (may get fixed later) Deprecated usage.
virtual const char * getColType (bool refresh=false) const
 Return array of column length 0 - continuous 1 - binary (may get fixed to 0 or 1 later) 2 - general integer (may get fixed later).
virtual const CoinPackedMatrixgetMatrixByRow () const =0
 Get pointer to row-wise copy of matrix.
virtual const CoinPackedMatrixgetMatrixByCol () const =0
 Get pointer to column-wise copy of matrix.
virtual CoinPackedMatrixgetMutableMatrixByRow () const
 Get pointer to mutable row-wise copy of matrix (returns NULL if not meaningful).
virtual CoinPackedMatrixgetMutableMatrixByCol () const
 Get pointer to mutable column-wise copy of matrix (returns NULL if not meaningful).
virtual double getInfinity () const =0
 Get solver's value for infinity.
Solution query methods
virtual const double * getColSolution () const =0
 Get pointer to array[getNumCols()] of primal variable values.
const double * getStrictColSolution ()
 Get pointer to an array[getNumCols()] of primal variable values that are guaranteed to be between the column lower and upper bounds.
virtual const double * getRowPrice () const =0
 Get pointer to array[getNumRows()] of dual variable values.
virtual const double * getReducedCost () const =0
 Get a pointer to array[getNumCols()] of reduced costs.
virtual const double * getRowActivity () const =0
 Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vector).
virtual double getObjValue () const =0
 Get objective function value.
virtual int getIterationCount () const =0
 Get the number of iterations it took to solve the problem (whatever ``iteration'' means to the solver).
virtual std::vector< double * > getDualRays (int maxNumRays) const =0
 Get as many dual rays as the solver can provide.
virtual std::vector< double * > getPrimalRays (int maxNumRays) const =0
 Get as many primal rays as the solver can provide.
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 the current solution.
Methods to modify the objective, bounds, and solution
For functions which take a set of indices as parameters (setObjCoeffSet(), setColSetBounds(), setRowSetBounds(), setRowSetTypes()), the parameters follow the C++ STL iterator convention: indexFirst points to the first index in the set, and indexLast points to a position one past the last index in the set.

virtual void setObjCoeff (int elementIndex, double elementValue)=0
 Set an objective function coefficient.
virtual void setObjCoeffSet (const int *indexFirst, const int *indexLast, const double *coeffList)
 Set a set of objective function coefficients.
virtual void setObjective (const double *array)
 Set the objective coefficients for all columns.
virtual void setObjSense (double s)=0
 Set the objective function sense.
virtual void setColLower (int elementIndex, double elementValue)=0
 Set a single column lower bound.
virtual void setColLower (const double *array)
 Set the lower bounds for all columns.
virtual void setColUpper (int elementIndex, double elementValue)=0
 Set a single column upper bound.
virtual void setColUpper (const double *array)
 Set the upper bounds for all columns.
virtual void setColBounds (int elementIndex, double lower, double upper)
 Set a single column lower and upper bound.
virtual void setColSetBounds (const int *indexFirst, const int *indexLast, const double *boundList)
 Set the upper and lower bounds of a set of columns.
virtual void setRowLower (int elementIndex, double elementValue)=0
 Set a single row lower bound.
virtual void setRowUpper (int elementIndex, double elementValue)=0
 Set a single row upper bound.
virtual void setRowBounds (int elementIndex, double lower, double upper)
 Set a single row lower and upper bound.
virtual void setRowSetBounds (const int *indexFirst, const int *indexLast, const double *boundList)
 Set the bounds on a set of rows.
virtual void setRowType (int index, char sense, double rightHandSide, double range)=0
 Set the type of a single row.
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.
virtual void setColSolution (const double *colsol)=0
 Set the primal solution variable values.
virtual void setRowPrice (const double *rowprice)=0
 Set dual solution variable values.
virtual int reducedCostFix (double gap, bool justInteger=true)
 Fix variables at bound based on reduced cost.
Methods to set variable type
virtual void setContinuous (int index)=0
 Set the index-th variable to be a continuous variable.
virtual void setInteger (int index)=0
 Set the index-th variable to be an integer variable.
virtual void setContinuous (const int *indices, int len)
 Set the variables listed in indices (which is of length len) to be continuous variables.
virtual void setInteger (const int *indices, int len)
 Set the variables listed in indices (which is of length len) to be integer variables.
Methods for row and column names
Osi defines three name management disciplines: `auto names' (0), `lazy names' (1), and `full names' (2). See the description of OsiNameDiscipline for details. Changing the name discipline (via setIntParam()) will not automatically add or remove name information, but setting the discipline to auto will make existing information inaccessible until the discipline is reset to lazy or full.

By definition, a row index of getNumRows() (i.e., one larger than the largest valid row index) refers to the objective function.

OSI users and implementors: While the OSI base class can define an interface and provide rudimentary support, use of names really depends on support by the OsiXXX class to ensure that names are managed correctly. If an OsiXXX class does not support names, it should return false for calls to getIntParam() or setIntParam() that reference OsiNameDiscipline.

virtual std::string dfltRowColName (char rc, int ndx, unsigned digits=7) const
 Generate a standard name of the form Rnnnnnnn or Cnnnnnnn.
virtual std::string getObjName (unsigned maxLen=(unsigned) std::string::npos) const
 Return the name of the objective function.
virtual void setObjName (std::string name)
 Set the name of the objective function.
virtual std::string getRowName (int rowIndex, unsigned maxLen=(unsigned) std::string::npos) const
 Return the name of the row.
virtual const OsiNameVecgetRowNames ()
 Return a pointer to a vector of row names.
virtual void setRowName (int ndx, std::string name)
 Set a row name.
virtual void setRowNames (OsiNameVec &srcNames, int srcStart, int len, int tgtStart)
 Set multiple row names.
virtual void deleteRowNames (int tgtStart, int len)
 Delete len row names starting at index tgtStart.
virtual std::string getColName (int colIndex, unsigned maxLen=(unsigned) std::string::npos) const
 Return the name of the column.
virtual const OsiNameVecgetColNames ()
 Return a pointer to a vector of column names.
virtual void setColName (int ndx, std::string name)
 Set a column name.
virtual void setColNames (OsiNameVec &srcNames, int srcStart, int len, int tgtStart)
 Set multiple column names.
virtual void deleteColNames (int tgtStart, int len)
 Delete len column names starting at index tgtStart.
void setRowColNames (const CoinMpsIO &mps)
 Set row and column names from a CoinMpsIO object.
void setRowColNames (CoinModel &mod)
 Set row and column names from a CoinModel object.
void setRowColNames (CoinLpIO &mod)
 Set row and column names from a CoinLpIO object.
Methods to modify the constraint system.
Note that new columns are added as continuous variables.

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 addCol (const CoinPackedVectorBase &vec, const double collb, const double colub, const double obj, std::string name)
 Add a named column (primal variable) to the problem.
virtual void addCol (int numberElements, const int *rows, const double *elements, const double collb, const double colub, const double obj)
 Add a column (primal variable) to the problem.
virtual void addCol (int numberElements, const int *rows, const double *elements, const double collb, const double colub, const double obj, std::string name)
 Add a named column (primal variable) to the problem.
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 addCols (const int numcols, const int *columnStarts, const int *rows, const double *elements, const double *collb, const double *colub, const double *obj)
 Add a set of columns (primal variables) to the problem.
void addCols (const CoinBuild &buildObject)
 Add columns using a CoinBuild object.
int addCols (CoinModel &modelObject)
 Add columns from a model object.
virtual void deleteCols (const int num, const int *colIndices)=0
 Remove a set of columns (primal variables) from the problem.
virtual void addRow (const CoinPackedVectorBase &vec, const double rowlb, const double rowub)=0
 Add a row (constraint) to the problem.
virtual void addRow (const CoinPackedVectorBase &vec, const double rowlb, const double rowub, std::string name)
 Add a named row (constraint) to the problem.
virtual void addRow (const CoinPackedVectorBase &vec, const char rowsen, const double rowrhs, const double rowrng)=0
 Add a row (constraint) to the problem.
virtual void addRow (const CoinPackedVectorBase &vec, const char rowsen, const double rowrhs, const double rowrng, std::string name)
 Add a named row (constraint) to the problem.
virtual void addRow (int numberElements, const int *columns, const double *element, const double rowlb, const double rowub)
virtual void addRows (const int numrows, const CoinPackedVectorBase *const *rows, const double *rowlb, const double *rowub)
virtual void addRows (const int numrows, const CoinPackedVectorBase *const *rows, const char *rowsen, const double *rowrhs, const double *rowrng)
 Add a set of rows (constraints) to the problem.
virtual void addRows (const int numrows, const int *rowStarts, const int *columns, const double *element, const double *rowlb, const double *rowub)
 Add a set of rows (constraints) to the problem.
void addRows (const CoinBuild &buildObject)
 Add rows using a CoinBuild object.
int addRows (CoinModel &modelObject)
virtual void deleteRows (const int num, const int *rowIndices)=0
 Delete a set of rows (constraints) from the problem.
virtual void saveBaseModel ()
 If solver wants it can save a copy of "base" (continuous) model here.
virtual void restoreBaseModel (int numberRows)
 Strip off rows to get to this number of rows.
virtual ApplyCutsReturnCode applyCuts (const OsiCuts &cs, double effectivenessLb=0.0)
 Apply a collection of cuts.
virtual void applyRowCuts (int numberCuts, const OsiRowCut *cuts)
 Apply a collection of row cuts which are all effective.
virtual void applyRowCuts (int numberCuts, const OsiRowCut **cuts)
 Apply a collection of row cuts which are all effective.
void deleteBranchingInfo (int numberDeleted, const int *which)
 Deletes branching information before columns deleted.
Methods for problem input and output
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. The constraints on the rows are given by lower and upper bounds.
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. The constraints on the rows are given by lower and upper bounds.
virtual void loadProblem (const CoinPackedMatrix &matrix, const double *collb, const double *colub, const double *obj, const char *rowsen, const double *rowrhs, const double *rowrng)=0
 Load in a problem by copying the arguments. The constraints on the rows are given by sense/rhs/range triplets.
virtual void assignProblem (CoinPackedMatrix *&matrix, double *&collb, double *&colub, double *&obj, char *&rowsen, double *&rowrhs, double *&rowrng)=0
 Load in a problem by assuming ownership of the arguments. The constraints on the rows are given by sense/rhs/range triplets.
virtual void loadProblem (const int numcols, const int numrows, const CoinBigIndex *start, const int *index, const double *value, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub)=0
 Load in a problem by copying the arguments. The constraint matrix is is specified with standard column-major column starts / row indices / coefficients vectors. The constraints on the rows are given by lower and upper bounds.
virtual void loadProblem (const int numcols, const int numrows, const CoinBigIndex *start, const int *index, const double *value, const double *collb, const double *colub, const double *obj, const char *rowsen, const double *rowrhs, const double *rowrng)=0
 Load in a problem by copying the arguments. The constraint matrix is is specified with standard column-major column starts / row indices / coefficients vectors. The constraints on the rows are given by sense/rhs/range triplets.
virtual int loadFromCoinModel (CoinModel &modelObject, bool keepSolution=false)
 Load a model from a CoinModel object. Return the number of errors encountered.
virtual int readMps (const char *filename, const char *extension="mps")
 Read a problem in MPS format from the given filename.
virtual int readMps (const char *filename, const char *extension, int &numberSets, CoinSet **&sets)
 Read a problem in MPS format from the given full filename.
virtual int readGMPL (const char *filename, const char *dataname=NULL)
 Read a problem in GMPL format from the given filenames.
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.
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.
virtual void writeLp (const char *filename, const char *extension="lp", double epsilon=1e-5, int numberAcross=10, int decimals=5, double objSense=0.0, bool useRowNames=true) const
 Write the problem into an Lp file of the given filename with the specified extension.
virtual void writeLp (FILE *fp, double epsilon=1e-5, int numberAcross=10, int decimals=5, double objSense=0.0, bool useRowNames=true) const
 Write the problem into the file pointed to by the parameter fp.
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.
int writeLpNative (FILE *fp, 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 the file pointed to by the parameter fp.
virtual int readLp (const char *filename, const double epsilon=1e-5)
 Read file in LP format from file with name filename.
int readLp (FILE *fp, const double epsilon=1e-5)
 Read file in LP format from the file pointed to by fp.
virtual void replaceMatrixOptional (const CoinPackedMatrix &matrix)
 I (JJF) am getting annoyed because I can't just replace a matrix.
virtual void replaceMatrix (const CoinPackedMatrix &matrix)
 And if it does matter (not used at present).
Setting/Accessing application data
void setApplicationData (void *appData)
 Set application data.
void setAuxiliaryInfo (OsiAuxInfo *auxiliaryInfo)
 Create a clone of an Auxiliary Information object.
void * getApplicationData () const
 Get application data.
OsiAuxInfogetAuxiliaryInfo () const
 Get pointer to auxiliary info object.
Message handling
See the COIN library documentation for additional information about COIN message facilities.

virtual void passInMessageHandler (CoinMessageHandler *handler)
 Pass in a message handler.
void newLanguage (CoinMessages::Language language)
 Set language.
void setLanguage (CoinMessages::Language language)
 Pass in a message handler.
CoinMessageHandlermessageHandler () const
 Return a pointer to the current message handler.
CoinMessages messages ()
 Return the current set of messages.
CoinMessagesmessagesPointer ()
 Return a pointer to the current set of messages.
bool defaultHandler () const
 Return true if default handler.
Methods for dealing with discontinuities other than integers.
Osi should be able to know about SOS and other types. This is an optional section where such information can be stored.

void findIntegers (bool justCount)
 Identify integer variables and create corresponding objects.
virtual int findIntegersAndSOS (bool justCount)
 Identify integer variables and SOS and create corresponding objects.
int numberObjects () const
 Get the number of objects.
void setNumberObjects (int number)
 Set the number of objects.
OsiObject ** objects () const
 Get the array of objects.
const OsiObjectobject (int which) const
 Get the specified object.
OsiObjectmodifiableObject (int which) const
 Get the specified object.
void deleteObjects ()
 Delete all object information.
void addObjects (int numberObjects, OsiObject **objects)
 Add in object information.
double forceFeasible ()
 Use current solution to set bounds so current integer feasible solution will stay feasible.
Methods related to testing generated cuts
virtual void activateRowCutDebugger (const char *modelName)
 Activate the row cut debugger.
virtual void activateRowCutDebugger (const double *solution)
 Activate debugger using full solution array.
const OsiRowCutDebuggergetRowCutDebugger () const
 Get the row cut debugger.
const OsiRowCutDebuggergetRowCutDebuggerAlways () const
 If you want to get debugger object even if not on optimal path then use this.
OsiSimplexInterface methods
Abstract Base Class for describing an advanced interface to a simplex solver. When switched on allows great control of simplex iterations. Also allows access to tableau.

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 void enableSimplexInterface (bool doingPrimal)
 Enables normal operation of subsequent functions.
virtual void disableSimplexInterface ()
 Undo whatever setting changes the above method had to make.
virtual void enableFactorization () const
 Tells solver that calls to getBInv etc are about to take place.
virtual void disableFactorization () const
 and stop
virtual bool basisIsAvailable () const
 Returns true if a basis is available AND problem is optimal.
bool optimalBasisIsAvailable () const
 Synonym for basisIsAvailable!
virtual void getBasisStatus (int *cstat, int *rstat) const
 The following two methods may be replaced by the methods of OsiSolverInterface using OsiWarmStartBasis if: 1.
virtual int setBasisStatus (const int *cstat, const int *rstat)
 Set the status of structural/artificial variables and factorize, update solution etc.
virtual int pivot (int colIn, int colOut, int outStatus)
 Perform a pivot by substituting a colIn for colOut in the basis.
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, t -- step size, and, if dx!=NULL, *dx -- primal ray direction.
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 a sign of its change are now the outputs, the leaving variable and its statuts -- the inputs If dx!=NULL, then *dx contains dual ray Return code: same.
virtual void getReducedGradient (double *columnReducedCosts, double *duals, const double *c)
 Get the reduced gradient for the cost vector c.
virtual void setObjectiveAndRefresh (double *c)
 Set a new objective and apply the old basis so that the reduced costs are properly updated.
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 getBInvRow (int row, double *z) const
 Get a row of the basis inverse.
virtual void getBInvACol (int col, double *vec) const
 Get a column of the tableau.
virtual void getBInvCol (int col, double *vec) const
 Get a column of the basis inverse.
virtual void getBasics (int *index) const
 Get basic indices (order of indices corresponds to the order of elements in a vector retured by getBInvACol() and getBInvCol()).
Constructors and destructors
 OsiSolverInterface ()
 Default Constructor.
virtual OsiSolverInterfaceclone (bool copyData=true) const =0
 Clone.
 OsiSolverInterface (const OsiSolverInterface &)
 Copy constructor.
OsiSolverInterfaceoperator= (const OsiSolverInterface &rhs)
 Assignment operator.
virtual ~OsiSolverInterface ()
 Destructor.
virtual void reset ()
 Reset the solver interface.

Protected Member Functions

Protected methods
virtual void applyRowCut (const OsiRowCut &rc)=0
 Apply a row cut (append to the constraint matrix).
virtual void applyColCut (const OsiColCut &cc)=0
 Apply a column cut (adjust the bounds of one or more variables).
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/range style.
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/ub style.
template<class 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.
void setInitialData ()
 Set OsiSolverInterface object state for default constructor.

Protected Attributes

Protected member data
OsiRowCutDebuggerrowCutDebugger_
 Pointer to row cut debugger object.
CoinMessageHandlerhandler_
 Message handler.
bool defaultHandler_
 Flag to say if the currrent handler is the default handler.
CoinMessages messages_
 Messages.
int numberIntegers_
 Number of integers.
int numberObjects_
 Total number of objects.
OsiObject ** object_
 Integer and ... information (integer info normally at beginning).
char * columnType_
 Column type 0 - continuous 1 - binary (may get fixed later) 2 - general integer (may get fixed later).

Private Attributes

Private member data
OsiAuxInfoappDataEtc_
 Pointer to user-defined data structure - and more if user wants.
int intParam_ [OsiLastIntParam]
 Array of integer parameters.
double dblParam_ [OsiLastDblParam]
 Array of double parameters.
std::string strParam_ [OsiLastStrParam]
 Array of string parameters.
bool hintParam_ [OsiLastHintParam]
 Array of hint parameters.
OsiHintStrength hintStrength_ [OsiLastHintParam]
 Array of hint strengths.
CoinWarmStartws_
 Warm start information used for hot starts when the default hot start implementation is used.
std::vector< double > strictColSolution_
 Column solution satisfying lower and upper column bounds.
OsiNameVec rowNames_
 Row names.
OsiNameVec colNames_
 Column names.
std::string objName_
 Objective name.

Friends

int OsiSolverInterfaceCommonUnitTest (const OsiSolverInterface *emptySi, const std::string &mpsDir, const std::string &netlibDir)
 A function that tests the methods in the OsiSolverInterface class.
int 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 properly with all the specified solvers.

Classes

class  ApplyCutsReturnCode
 Internal class for obtaining status from the applyCuts method. More...

Detailed Description

Solver Interface Abstract Base Class.

Abstract Base Class for describing an interface to a solver.

Many OsiSolverInterface query methods return a const pointer to the requested read-only data. If the model data is changed or the solver is called, these pointers may no longer be valid and should be refreshed by invoking the member function to obtain an updated copy of the pointer. For example:

      OsiSolverInterface solverInterfacePtr ;
      const double * ruBnds = solverInterfacePtr->getRowUpper();
      solverInterfacePtr->applyCuts(someSetOfCuts);
      // ruBnds is no longer a valid pointer and must be refreshed
      ruBnds = solverInterfacePtr->getRowUpper();

Querying a problem that has no data associated with it will result in zeros for the number of rows and columns, and NULL pointers from the methods that return vectors.

Definition at line 59 of file OsiSolverInterface.hpp.


Member Typedef Documentation

typedef std::vector<std::string> OsiSolverInterface::OsiNameVec

Data type for name vectors.

Definition at line 789 of file OsiSolverInterface.hpp.


Constructor & Destructor Documentation

OsiSolverInterface::OsiSolverInterface (  ) 

Default Constructor.

OsiSolverInterface::OsiSolverInterface ( const OsiSolverInterface  ) 

Copy constructor.