Cbc  2.9.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Friends | List of all members
OsiSolverInterface Class Referenceabstract

Abstract Base Class for describing an interface to a solver. More...

#include <OsiSolverInterface.hpp>

+ Inheritance diagram for OsiSolverInterface:
+ Collaboration diagram for OsiSolverInterface:

Classes

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

Public Types

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

Public Member Functions

Solve methods
virtual void initialSolve ()=0
 Solve initial LP relaxation. More...
 
virtual void resolve ()=0
 Resolve an LP relaxation after problem modification. More...
 
virtual void branchAndBound ()=0
 Invoke solver's built-in enumeration algorithm. More...
 
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 a boolean specifies the sense of the hint and an enum specifies the strength of the hint. Hints should be initialised when a solver is instantiated. (See OsiSolverParameters.hpp for defined hint parameters and strength.) When specifying the sense of the hint, a value of true means to work with the hint, false to work against it. For example,

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 sense and strength. The default implementation does not store the otherInformation pointer, and always throws an exception for strength OsiForceDo. Implementors of a solver interface should override these functions to provide the proper interface to and accurately reflect the capabilities of a specific solver.
virtual bool setIntParam (OsiIntParam key, int value)
 Set an integer parameter. More...
 
virtual bool setDblParam (OsiDblParam key, double value)
 Set a double parameter. More...
 
virtual bool setStrParam (OsiStrParam key, const std::string &value)
 Set a string parameter. More...
 
virtual bool setHintParam (OsiHintParam key, bool yesNo=true, OsiHintStrength strength=OsiHintTry, void *=NULL)
 Set a hint parameter. More...
 
virtual bool getIntParam (OsiIntParam key, int &value) const
 Get an integer parameter. More...
 
virtual bool getDblParam (OsiDblParam key, double &value) const
 Get a double parameter. More...
 
virtual bool getStrParam (OsiStrParam key, std::string &value) const
 Get a string parameter. More...
 
virtual bool getHintParam (OsiHintParam key, bool &yesNo, OsiHintStrength &strength, void *&otherInformation) const
 Get a hint parameter (all information) More...
 
virtual bool getHintParam (OsiHintParam key, bool &yesNo, OsiHintStrength &strength) const
 Get a hint parameter (sense and strength only) More...
 
virtual bool getHintParam (OsiHintParam key, bool &yesNo) const
 Get a hint parameter (sense only) More...
 
void copyParameters (OsiSolverInterface &rhs)
 Copy all parameters in this section from one solver to another. More...
 
double getIntegerTolerance () const
 Return the integrality tolerance of the underlying solver. More...
 
Methods returning info on how the solution process terminated
virtual bool isAbandoned () const =0
 Are there numerical difficulties? More...
 
virtual bool isProvenOptimal () const =0
 Is optimality proven? More...
 
virtual bool isProvenPrimalInfeasible () const =0
 Is primal infeasibility proven? More...
 
virtual bool isProvenDualInfeasible () const =0
 Is dual infeasibility proven? More...
 
virtual bool isPrimalObjectiveLimitReached () const
 Is the given primal objective limit reached? More...
 
virtual bool isDualObjectiveLimitReached () const
 Is the given dual objective limit reached? More...
 
virtual bool isIterationLimitReached () const =0
 Iteration limit reached? More...
 
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. More...
 
virtual CoinWarmStartgetWarmStart () const =0
 Get warm start information. More...
 
virtual CoinWarmStartgetPointerToWarmStart (bool &mustDelete)
 Get warm start information. More...
 
virtual bool setWarmStart (const CoinWarmStart *warmstart)=0
 Set warm start information. More...
 
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. More...
 
virtual void solveFromHotStart ()
 Optimize starting from the hot start snapshot. More...
 
virtual void unmarkHotStart ()
 Delete the hot start snapshot. More...
 
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 the number of columns. More...
 
virtual int getNumRows () const =0
 Get the number of rows. More...
 
virtual int getNumElements () const =0
 Get the number of nonzero elements. More...
 
virtual int getNumIntegers () const
 Get the number of integer variables. More...
 
virtual const double * getColLower () const =0
 Get a pointer to an array[getNumCols()] of column lower bounds. More...
 
virtual const double * getColUpper () const =0
 Get a pointer to an array[getNumCols()] of column upper bounds. More...
 
virtual const char * getRowSense () const =0
 Get a pointer to an array[getNumRows()] of row constraint senses. More...
 
virtual const double * getRightHandSide () const =0
 Get a pointer to an array[getNumRows()] of row right-hand sides. More...
 
virtual const double * getRowRange () const =0
 Get a pointer to an array[getNumRows()] of row ranges. More...
 
virtual const double * getRowLower () const =0
 Get a pointer to an array[getNumRows()] of row lower bounds. More...
 
virtual const double * getRowUpper () const =0
 Get a pointer to an array[getNumRows()] of row upper bounds. More...
 
virtual const double * getObjCoefficients () const =0
 Get a pointer to an array[getNumCols()] of objective function coefficients. More...
 
virtual double getObjSense () const =0
 Get the objective function sense. More...
 
virtual bool isContinuous (int colIndex) const =0
 Return true if the variable is continuous. More...
 
virtual bool isBinary (int colIndex) const
 Return true if the variable is binary. More...
 
virtual bool isInteger (int colIndex) const
 Return true if the variable is integer. More...
 
virtual bool isIntegerNonBinary (int colIndex) const
 Return true if the variable is general integer. More...
 
virtual bool isFreeBinary (int colIndex) const
 Return true if the variable is binary and not fixed. More...
 
const char * columnType (bool refresh=false) const
 Return an array[getNumCols()] of column types. More...
 
virtual const char * getColType (bool refresh=false) const
 Return an array[getNumCols()] of column types. More...
 
virtual const CoinPackedMatrixgetMatrixByRow () const =0
 Get a pointer to a row-wise copy of the matrix. More...
 
virtual const CoinPackedMatrixgetMatrixByCol () const =0
 Get a pointer to a column-wise copy of the matrix. More...
 
virtual CoinPackedMatrixgetMutableMatrixByRow () const
 Get a pointer to a mutable row-wise copy of the matrix. More...
 
virtual CoinPackedMatrixgetMutableMatrixByCol () const
 Get a pointer to a mutable column-wise copy of the matrix. More...
 
virtual double getInfinity () const =0
 Get the solver's value for infinity. More...
 
Solution query methods
virtual const double * getColSolution () const =0
 Get a pointer to an array[getNumCols()] of primal variable values. More...
 
virtual const double * getStrictColSolution ()
 Get a pointer to an array[getNumCols()] of primal variable values guaranteed to be between the column lower and upper bounds. More...
 
virtual const double * getRowPrice () const =0
 Get pointer to array[getNumRows()] of dual variable values. More...
 
virtual const double * getReducedCost () const =0
 Get a pointer to an array[getNumCols()] of reduced costs. More...
 
virtual const double * getRowActivity () const =0
 Get a pointer to array[getNumRows()] of row activity levels. More...
 
virtual double getObjValue () const =0
 Get the objective function value. More...
 
virtual int getIterationCount () const =0
 Get the number of iterations it took to solve the problem (whatever `iteration' means to the solver). More...
 
virtual std::vector< double * > getDualRays (int maxNumRays, bool fullRay=false) const =0
 Get as many dual rays as the solver can provide. More...
 
virtual std::vector< double * > getPrimalRays (int maxNumRays) const =0
 Get as many primal rays as the solver can provide. More...
 
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. More...
 
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. More...
 
virtual void setObjCoeffSet (const int *indexFirst, const int *indexLast, const double *coeffList)
 Set a set of objective function coefficients. More...
 
virtual void setObjective (const double *array)
 Set the objective coefficients for all columns. More...
 
virtual void setObjSense (double s)=0
 Set the objective function sense. More...
 
virtual void setColLower (int elementIndex, double elementValue)=0
 Set a single column lower bound. More...
 
virtual void setColLower (const double *array)
 Set the lower bounds for all columns. More...
 
virtual void setColUpper (int elementIndex, double elementValue)=0
 Set a single column upper bound. More...
 
virtual void setColUpper (const double *array)
 Set the upper bounds for all columns. More...
 
virtual void setColBounds (int elementIndex, double lower, double upper)
 Set a single column lower and upper bound. More...
 
virtual void setColSetBounds (const int *indexFirst, const int *indexLast, const double *boundList)
 Set the upper and lower bounds of a set of columns. More...
 
virtual void setRowLower (int elementIndex, double elementValue)=0
 Set a single row lower bound. More...
 
virtual void setRowUpper (int elementIndex, double elementValue)=0
 Set a single row upper bound. More...
 
virtual void setRowBounds (int elementIndex, double lower, double upper)
 Set a single row lower and upper bound. More...
 
virtual void setRowSetBounds (const int *indexFirst, const int *indexLast, const double *boundList)
 Set the bounds on a set of rows. More...
 
virtual void setRowType (int index, char sense, double rightHandSide, double range)=0
 Set the type of a single row. More...
 
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. More...
 
virtual void setColSolution (const double *colsol)=0
 Set the primal solution variable values. More...
 
virtual void setRowPrice (const double *rowprice)=0
 Set dual solution variable values. More...
 
virtual int reducedCostFix (double gap, bool justInteger=true)
 Fix variables at bound based on reduced cost. More...
 
Methods to set variable type
virtual void setContinuous (int index)=0
 Set the index-th variable to be a continuous variable. More...
 
virtual void setInteger (int index)=0
 Set the index-th variable to be an integer variable. More...
 
virtual void setContinuous (const int *indices, int len)
 Set the variables listed in indices (which is of length len) to be continuous variables. More...
 
virtual void setInteger (const int *indices, int len)
 Set the variables listed in indices (which is of length len) to be integer variables. More...
 
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. More...
 
virtual std::string getObjName (unsigned maxLen=static_cast< unsigned >(std::string::npos)) const
 Return the name of the objective function. More...
 
virtual void setObjName (std::string name)
 Set the name of the objective function. More...
 
virtual std::string getRowName (int rowIndex, unsigned maxLen=static_cast< unsigned >(std::string::npos)) const
 Return the name of the row. More...
 
virtual const OsiNameVecgetRowNames ()
 Return a pointer to a vector of row names. More...
 
virtual void setRowName (int ndx, std::string name)
 Set a row name. More...
 
virtual void setRowNames (OsiNameVec &srcNames, int srcStart, int len, int tgtStart)
 Set multiple row names. More...
 
virtual void deleteRowNames (int tgtStart, int len)
 Delete len row names starting at index tgtStart. More...
 
virtual std::string getColName (int colIndex, unsigned maxLen=static_cast< unsigned >(std::string::npos)) const
 Return the name of the column. More...
 
virtual const OsiNameVecgetColNames ()
 Return a pointer to a vector of column names. More...
 
virtual void setColName (int ndx, std::string name)
 Set a column name. More...
 
virtual void setColNames (OsiNameVec &srcNames, int srcStart, int len, int tgtStart)
 Set multiple column names. More...
 
virtual void deleteColNames (int tgtStart, int len)
 Delete len column names starting at index tgtStart. More...
 
void setRowColNames (const CoinMpsIO &mps)
 Set row and column names from a CoinMpsIO object. More...
 
void setRowColNames (CoinModel &mod)
 Set row and column names from a CoinModel object. More...
 
void setRowColNames (CoinLpIO &mod)
 Set row and column names from a CoinLpIO object. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
void addCols (const CoinBuild &buildObject)
 Add columns using a CoinBuild object. More...
 
int addCols (CoinModel &modelObject)
 Add columns from a model object. More...
 
virtual void deleteCols (const int num, const int *colIndices)=0
 Remove a set of columns (primal variables) from the problem. More...
 
virtual void addRow (const CoinPackedVectorBase &vec, const double rowlb, const double rowub)=0
 Add a row (constraint) to the problem. More...
 
virtual void addRow (const CoinPackedVectorBase &vec, const double rowlb, const double rowub, std::string name)
 Add a named row (constraint) to the problem. More...
 
virtual void addRow (const CoinPackedVectorBase &vec, const char rowsen, const double rowrhs, const double rowrng)=0
 Add a row (constraint) to the problem. More...
 
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. More...
 
virtual void addRow (int numberElements, const int *columns, const double *element, const double rowlb, const double rowub)
 Add a row (constraint) to the problem. More...
 
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. More...
 
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. More...
 
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. More...
 
void addRows (const CoinBuild &buildObject)
 Add rows using a CoinBuild object. More...
 
int addRows (CoinModel &modelObject)
 Add rows from a CoinModel object. More...
 
virtual void deleteRows (const int num, const int *rowIndices)=0
 Delete a set of rows (constraints) from the problem. More...
 
virtual void replaceMatrixOptional (const CoinPackedMatrix &)
 Replace the constraint matrix. More...
 
virtual void replaceMatrix (const CoinPackedMatrix &)
 Replace the constraint matrix. More...
 
virtual void saveBaseModel ()
 Save a copy of the base model. More...
 
virtual void restoreBaseModel (int numberRows)
 Reduce the constraint system to the specified number of constraints. More...
 
virtual ApplyCutsReturnCode applyCuts (const OsiCuts &cs, double effectivenessLb=0.0)
 Apply a collection of cuts. More...
 
virtual void applyRowCuts (int numberCuts, const OsiRowCut *cuts)
 Apply a collection of row cuts which are all effective. More...
 
virtual void applyRowCuts (int numberCuts, const OsiRowCut **cuts)
 Apply a collection of row cuts which are all effective. More...
 
void deleteBranchingInfo (int numberDeleted, const int *which)
 Deletes branching information before columns deleted. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
virtual int loadFromCoinModel (CoinModel &modelObject, bool keepSolution=false)
 Load a model from a CoinModel object. More...
 
virtual int readMps (const char *filename, const char *extension="mps")
 Read a problem in MPS format from the given filename. More...
 
virtual int readMps (const char *filename, const char *extension, int &numberSets, CoinSet **&sets)
 Read a problem in MPS format from the given full filename. More...
 
virtual int readGMPL (const char *filename, const char *dataname=NULL)
 Read a problem in GMPL format from the given filenames. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
virtual int readLp (const char *filename, const double epsilon=1e-5)
 Read file in LP format from file with name filename. More...
 
int readLp (FILE *fp, const double epsilon=1e-5)
 Read file in LP format from the file pointed to by fp. More...
 
Miscellaneous
int differentModel (OsiSolverInterface &other, bool ignoreNames=true)
 Check two models against each other. More...
 
Setting/Accessing application data
void setApplicationData (void *appData)
 Set application data. More...
 
void setAuxiliaryInfo (OsiAuxInfo *auxiliaryInfo)
 Create a clone of an Auxiliary Information object. More...
 
voidgetApplicationData () const
 Get application data. More...
 
OsiAuxInfogetAuxiliaryInfo () const
 Get pointer to auxiliary info object. More...
 
Message handling

See the COIN library documentation for additional information about COIN message facilities.

virtual void passInMessageHandler (CoinMessageHandler *handler)
 Pass in a message handler. More...
 
void newLanguage (CoinMessages::Language language)
 Set language. More...
 
void setLanguage (CoinMessages::Language language)
 
CoinMessageHandlermessageHandler () const
 Return a pointer to the current message handler. More...
 
CoinMessages messages ()
 Return the current set of messages. More...
 
CoinMessagesmessagesPointer ()
 Return a pointer to the current set of messages. More...
 
bool defaultHandler () const
 Return true if default handler. More...
 
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. More...
 
virtual int findIntegersAndSOS (bool justCount)
 Identify integer variables and SOS and create corresponding objects. More...
 
int numberObjects () const
 Get the number of objects. More...
 
void setNumberObjects (int number)
 Set the number of objects. More...
 
OsiObject ** objects () const
 Get the array of objects. More...
 
const OsiObjectobject (int which) const
 Get the specified object. More...
 
OsiObjectmodifiableObject (int which) const
 Get the specified object. More...
 
void deleteObjects ()
 Delete all object information. More...
 
void addObjects (int numberObjects, OsiObject **objects)
 Add in object information. More...
 
double forceFeasible ()
 Use current solution to set bounds so current integer feasible solution will stay feasible. More...
 
Methods related to testing generated cuts

See the documentation for OsiRowCutDebugger for additional details.

virtual void activateRowCutDebugger (const char *modelName)
 Activate the row cut debugger. More...
 
virtual void activateRowCutDebugger (const double *solution, bool enforceOptimality=true)
 Activate the row cut debugger using a full solution array. More...
 
const OsiRowCutDebuggergetRowCutDebugger () const
 Get the row cut debugger provided the solution known to the debugger is within the feasible region held in the solver. More...
 
OsiRowCutDebuggergetRowCutDebuggerAlways () const
 Get the row cut debugger object. More...
 
OsiSimplexInterface

Simplex Interface

Methods for an advanced interface to a simplex solver. The interface comprises two groups of methods. Group 1 contains methods for tableau access. Group 2 contains methods for dictating individual simplex pivots.

virtual int canDoSimplexInterface () const
 Return the simplex implementation level. More...
 
OsiSimplex Group 1

Tableau access methods.

This group of methods provides access to rows and columns of the basis inverse and to rows and columns of the tableau.

virtual void enableFactorization () const
 Prepare the solver for the use of tableau access methods. More...
 
virtual void disableFactorization () const
 Undo the effects of enableFactorization. More...
 
virtual bool basisIsAvailable () const
 Check if an optimal basis is available. More...
 
bool optimalBasisIsAvailable () const
 Synonym for basisIsAvailable. More...
 
virtual void getBasisStatus (int *cstat, int *rstat) const
 Retrieve status information for column and row variables. More...
 
virtual int setBasisStatus (const int *cstat, const int *rstat)
 Set the status of column and row variables and update the basis factorization and solution. More...
 
virtual void getReducedGradient (double *columnReducedCosts, double *duals, const double *c) const
 Calculate duals and reduced costs for the given objective coefficients. More...
 
virtual void getBInvARow (int row, double *z, double *slack=NULL) const
 Get a row of the tableau. More...
 
virtual void getBInvRow (int row, double *z) const
 Get a row of the basis inverse. More...
 
virtual void getBInvACol (int col, double *vec) const
 Get a column of the tableau. More...
 
virtual void getBInvCol (int col, double *vec) const
 Get a column of the basis inverse. More...
 
virtual void getBasics (int *index) const
 Get indices of basic variables. More...
 
OsiSimplex Group 2

Pivoting methods

This group of methods provides for control of individual pivots by a simplex solver.

virtual void enableSimplexInterface (bool doingPrimal)
 Enables normal operation of subsequent functions. More...
 
virtual void disableSimplexInterface ()
 Undo whatever setting changes the above method had to make. More...
 
virtual int pivot (int colIn, int colOut, int outStatus)
 Perform a pivot by substituting a colIn for colOut in the basis. More...
 
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. More...
 
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. More...
 
Constructors and destructors
 OsiSolverInterface ()
 Default Constructor. More...
 
virtual OsiSolverInterfaceclone (bool copyData=true) const =0
 Clone. More...
 
 OsiSolverInterface (const OsiSolverInterface &)
 Copy constructor. More...
 
OsiSolverInterfaceoperator= (const OsiSolverInterface &rhs)
 Assignment operator. More...
 
virtual ~OsiSolverInterface ()
 Destructor. More...
 
virtual void reset ()
 Reset the solver interface. More...
 

Protected Member Functions

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

Protected Attributes

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

Private Attributes

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

Friends

void OsiSolverInterfaceCommonUnitTest (const OsiSolverInterface *emptySi, const std::string &mpsDir, const std::string &netlibDir)
 A function that tests the methods in the OsiSolverInterface class. More...
 
void 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. More...
 

Detailed Description

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 62 of file OsiSolverInterface.hpp.

Member Typedef Documentation

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

Data type for name vectors.

Definition at line 888 of file OsiSolverInterface.hpp.

Constructor & Destructor Documentation

OsiSolverInterface::OsiSolverInterface ( )

Default Constructor.

OsiSolverInterface::OsiSolverInterface ( const OsiSolverInterface )

Copy constructor.

virtual OsiSolverInterface::~OsiSolverInterface ( )
virtual

Destructor.

Member Function Documentation

virtual void OsiSolverInterface::initialSolve ( )
pure virtual
virtual void OsiSolverInterface::resolve ( )
pure virtual

Resolve an LP relaxation after problem modification.

Note the `re-' in `resolve'. initialSolve() should be used to solve the problem for the first time.

Implemented in OsiTestSolverInterface, OsiClpSolverInterface, OsiSpxSolverInterface, OsiGlpkSolverInterface, OsiCbcSolverInterface, OsiCpxSolverInterface, OsiGrbSolverInterface, OsiSolverLink, OsiMskSolverInterface, CbcSolver2, OsiXprSolverInterface, CbcSolver3, CbcSolverLongThin, and ClpQuadInterface.

virtual void OsiSolverInterface::branchAndBound ( )
pure virtual
virtual bool OsiSolverInterface::setIntParam ( OsiIntParam  key,
int  value 
)
inlinevirtual
virtual bool OsiSolverInterface::setDblParam ( OsiDblParam  key,
double  value 
)
inlinevirtual
virtual bool OsiSolverInterface::setStrParam ( OsiStrParam  key,
const std::string &  value 
)
inlinevirtual
virtual bool OsiSolverInterface::setHintParam ( OsiHintParam  key,
bool  yesNo = true,
OsiHintStrength  strength = OsiHintTry,
void = NULL 
)
inlinevirtual

Set a hint parameter.

The otherInformation parameter can be used to pass in an arbitrary block of information which is interpreted by the OSI and the underlying solver. Users are cautioned that this hook is solver-specific.

Implementors: The default implementation completely ignores otherInformation and always throws an exception for OsiForceDo. This is almost certainly not the behaviour you want; you really should override this method.

Reimplemented in OsiClpSolverInterface, OsiCbcSolverInterface, OsiGlpkSolverInterface, and OsiGrbSolverInterface.

Definition at line 294 of file OsiSolverInterface.hpp.

virtual bool OsiSolverInterface::getIntParam ( OsiIntParam  key,
int &  value 
) const
inlinevirtual
virtual bool OsiSolverInterface::getDblParam ( OsiDblParam  key,
double &  value 
) const
inlinevirtual
virtual bool OsiSolverInterface::getStrParam ( OsiStrParam  key,
std::string &  value 
) const
inlinevirtual
virtual bool OsiSolverInterface::getHintParam ( OsiHintParam  key,
bool &  yesNo,
OsiHintStrength strength,
void *&  otherInformation 
) const
inlinevirtual

Get a hint parameter (all information)

Return all available information for the hint: sense, strength, and any extra information associated with the hint.

Implementors: The default implementation will always set otherInformation to NULL. This is almost certainly not the behaviour you want; you really should override this method.

Reimplemented in OsiCbcSolverInterface, and OsiGrbSolverInterface.

Definition at line 333 of file OsiSolverInterface.hpp.

virtual bool OsiSolverInterface::getHintParam ( OsiHintParam  key,
bool &  yesNo,
OsiHintStrength strength 
) const
inlinevirtual

Get a hint parameter (sense and strength only)

Return only the sense and strength of the hint.

Reimplemented in OsiCbcSolverInterface, and OsiGrbSolverInterface.

Definition at line 347 of file OsiSolverInterface.hpp.

virtual bool OsiSolverInterface::getHintParam ( OsiHintParam  key,
bool &  yesNo 
) const
inlinevirtual

Get a hint parameter (sense only)

Return only the sense (true/false) of the hint.

Reimplemented in OsiGrbSolverInterface.

Definition at line 359 of file OsiSolverInterface.hpp.

void OsiSolverInterface::copyParameters ( OsiSolverInterface rhs)

Copy all parameters in this section from one solver to another.

Note that the current implementation also copies the appData block, message handler, and rowCutDebugger. Arguably these should have independent copy methods.

double OsiSolverInterface::getIntegerTolerance ( ) const
inline

Return the integrality tolerance of the underlying solver.

We should be able to get an integrality tolerance, but until that time just use the primal tolerance

Todo:
This method should be replaced; it's architecturally wrong. This should be an honest dblParam with a keyword. Underlying solvers that do not support integer variables should return false for set and get on this parameter. Underlying solvers that support integrality should add this to the parameters they support, using whatever tolerance is appropriate. -lh, 091021-

Definition at line 386 of file OsiSolverInterface.hpp.

virtual bool OsiSolverInterface::isAbandoned ( ) const
pure virtual
virtual bool OsiSolverInterface::isProvenOptimal ( ) const
pure virtual
virtual bool OsiSolverInterface::isProvenPrimalInfeasible ( ) const
pure virtual
virtual bool OsiSolverInterface::isProvenDualInfeasible ( ) const
pure virtual
virtual bool OsiSolverInterface::isPrimalObjectiveLimitReached ( ) const
virtual
virtual bool OsiSolverInterface::isDualObjectiveLimitReached ( ) const
virtual
virtual bool OsiSolverInterface::isIterationLimitReached ( ) const
pure virtual
virtual CoinWarmStart* OsiSolverInterface::getEmptyWarmStart ( ) const
pure virtual

Get an empty warm start object.

This routine returns an empty warm start object. Its purpose is to provide a way for a client to acquire a warm start object of the appropriate type for the solver, which can then be resized and modified as desired.

Implemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiCbcSolverInterface, OsiGrbSolverInterface, OsiGlpkSolverInterface, OsiSpxSolverInterface, OsiCpxSolverInterface, OsiMskSolverInterface, and OsiXprSolverInterface.

virtual CoinWarmStart* OsiSolverInterface::getWarmStart ( ) const
pure virtual

Get warm start information.

Return warm start information for the current state of the solver interface. If there is no valid warm start information, an empty warm start object wil be returned.

Implemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiCbcSolverInterface, OsiGrbSolverInterface, OsiGlpkSolverInterface, OsiSpxSolverInterface, OsiCpxSolverInterface, OsiMskSolverInterface, and OsiXprSolverInterface.

virtual CoinWarmStart* OsiSolverInterface::getPointerToWarmStart ( bool &  mustDelete)
virtual

Get warm start information.

Return warm start information for the current state of the solver interface. If there is no valid warm start information, an empty warm start object wil be returned. This does not necessarily create an object - may just point to one. must Delete set true if user should delete returned object.

Reimplemented in OsiClpSolverInterface.

virtual bool OsiSolverInterface::setWarmStart ( const CoinWarmStart warmstart)
pure virtual

Set warm start information.

Return true or false depending on whether the warm start information was accepted or not. By definition, a call to setWarmStart with a null parameter should cause the solver interface to refresh its warm start information from the underlying solver.

Implemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiCbcSolverInterface, OsiGrbSolverInterface, OsiGlpkSolverInterface, OsiSpxSolverInterface, OsiCpxSolverInterface, OsiMskSolverInterface, and OsiXprSolverInterface.

virtual void OsiSolverInterface::markHotStart ( )
virtual
virtual void OsiSolverInterface::solveFromHotStart ( )
virtual
virtual void OsiSolverInterface::unmarkHotStart ( )
virtual
virtual int OsiSolverInterface::getNumCols ( ) const
pure virtual
virtual int OsiSolverInterface::getNumRows ( ) const
pure virtual
virtual int OsiSolverInterface::getNumElements ( ) const
pure virtual
virtual int OsiSolverInterface::getNumIntegers ( ) const
virtual

Get the number of integer variables.

virtual const double* OsiSolverInterface::getColLower ( ) const
pure virtual
virtual const double* OsiSolverInterface::getColUpper ( ) const
pure virtual
virtual const char* OsiSolverInterface::getRowSense ( ) const
pure virtual

Get a pointer to an array[getNumRows()] of row constraint senses.

  • 'L': <= constraint
  • 'E': = constraint
  • 'G': >= constraint
  • 'R': ranged constraint
  • 'N': free constraint

Implemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiCbcSolverInterface, OsiGrbSolverInterface, OsiGlpkSolverInterface, OsiSpxSolverInterface, OsiCpxSolverInterface, OsiMskSolverInterface, and OsiXprSolverInterface.

virtual const double* OsiSolverInterface::getRightHandSide ( ) const
pure virtual
virtual const double* OsiSolverInterface::getRowRange ( ) const
pure virtual
virtual const double* OsiSolverInterface::getRowLower ( ) const
pure virtual
virtual const double* OsiSolverInterface::getRowUpper ( ) const
pure virtual
virtual const double* OsiSolverInterface::getObjCoefficients ( ) const
pure virtual
virtual double OsiSolverInterface::getObjSense ( ) const
pure virtual
virtual bool OsiSolverInterface::isContinuous ( int  colIndex) const
pure virtual
virtual bool OsiSolverInterface::isBinary ( int  colIndex) const
virtual

Return true if the variable is binary.

Reimplemented in OsiClpSolverInterface.

virtual bool OsiSolverInterface::isInteger ( int  colIndex) const
virtual

Return true if the variable is integer.

This method returns true if the variable is binary or general integer.

Reimplemented in OsiClpSolverInterface.

virtual bool OsiSolverInterface::isIntegerNonBinary ( int  colIndex) const
virtual

Return true if the variable is general integer.

Reimplemented in OsiClpSolverInterface.

virtual bool OsiSolverInterface::isFreeBinary ( int  colIndex) const
virtual

Return true if the variable is binary and not fixed.

Reimplemented in OsiClpSolverInterface.

const char* OsiSolverInterface::columnType ( bool  refresh = false) const
inline

Return an array[getNumCols()] of column types.

Deprecated:
See getColType

Definition at line 593 of file OsiSolverInterface.hpp.

virtual const char* OsiSolverInterface::getColType ( bool  refresh = false) const
virtual

Return an array[getNumCols()] of column types.

  • 0 - continuous
  • 1 - binary
  • 2 - general integer

If refresh is true, the classification of integer variables as binary or general integer will be reevaluated. If the current bounds are [0,1], or if the variable is fixed at 0 or 1, it will be classified as binary, otherwise it will be classified as general integer.

Reimplemented in OsiClpSolverInterface.

virtual const CoinPackedMatrix* OsiSolverInterface::getMatrixByRow ( ) const
pure virtual
virtual const CoinPackedMatrix* OsiSolverInterface::getMatrixByCol ( ) const
pure virtual
virtual CoinPackedMatrix* OsiSolverInterface::getMutableMatrixByRow ( ) const
inlinevirtual

Get a pointer to a mutable row-wise copy of the matrix.

Returns NULL if the request is not meaningful (i.e., the OSI will not recognise any modifications to the matrix).

Definition at line 620 of file OsiSolverInterface.hpp.

virtual CoinPackedMatrix* OsiSolverInterface::getMutableMatrixByCol ( ) const
inlinevirtual

Get a pointer to a mutable column-wise copy of the matrix.

Returns NULL if the request is not meaningful (i.e., the OSI will not recognise any modifications to the matrix).

Reimplemented in OsiClpSolverInterface.

Definition at line 627 of file OsiSolverInterface.hpp.

virtual double OsiSolverInterface::getInfinity ( ) const
pure virtual
virtual const double* OsiSolverInterface::getColSolution ( ) const
pure virtual
virtual const double* OsiSolverInterface::getStrictColSolution ( )
virtual

Get a pointer to an array[getNumCols()] of primal variable values guaranteed to be between the column lower and upper bounds.

virtual const double* OsiSolverInterface::getRowPrice ( ) const
pure virtual
virtual const double* OsiSolverInterface::getReducedCost ( ) const
pure virtual
virtual const double* OsiSolverInterface::getRowActivity ( ) const
pure virtual

Get a pointer to array[getNumRows()] of row activity levels.

The row activity for a row is the left-hand side evaluated at the current solution.

Implemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiGlpkSolverInterface, OsiSpxSolverInterface, OsiCpxSolverInterface, OsiCbcSolverInterface, OsiMskSolverInterface, OsiGrbSolverInterface, and OsiXprSolverInterface.

virtual double OsiSolverInterface::getObjValue ( ) const
pure virtual
virtual int OsiSolverInterface::getIterationCount ( ) const
pure virtual

Get the number of iterations it took to solve the problem (whatever `iteration' means to the solver).

Implemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiGlpkSolverInterface, OsiSpxSolverInterface, OsiCpxSolverInterface, OsiCbcSolverInterface, OsiMskSolverInterface, OsiGrbSolverInterface, and OsiXprSolverInterface.

virtual std::vector<double*> OsiSolverInterface::getDualRays ( int  maxNumRays,
bool  fullRay = false 
) const
pure virtual

Get as many dual rays as the solver can provide.

In case of proven primal infeasibility there should (with high probability) be at least one.

The first getNumRows() ray components will always be associated with the row duals (as returned by getRowPrice()). If fullRay is true, the final getNumCols() entries will correspond to the ray components associated with the nonbasic variables. If the full ray is requested and the method cannot provide it, it will throw an exception.

Note
Implementors of solver interfaces note that the double pointers in the vector should point to arrays of length getNumRows() (fullRay = false) or (getNumRows()+getNumCols()) (fullRay = true) and they should be allocated with new[].
Clients of solver interfaces note that it is the client's responsibility to free the double pointers in the vector using delete[]. Clients are reminded that a problem can be dual and primal infeasible.

Implemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiGlpkSolverInterface, OsiSpxSolverInterface, OsiCpxSolverInterface, OsiCbcSolverInterface, OsiMskSolverInterface, OsiGrbSolverInterface, and OsiXprSolverInterface.

virtual std::vector<double*> OsiSolverInterface::getPrimalRays ( int  maxNumRays) const
pure virtual

Get as many primal rays as the solver can provide.

In case of proven dual infeasibility there should (with high probability) be at least one.

Note
Implementors of solver interfaces note that the double pointers in the vector should point to arrays of length getNumCols() and they should be allocated with new[].
Clients of solver interfaces note that it is the client's responsibility to free the double pointers in the vector using delete[]. Clients are reminded that a problem can be dual and primal infeasible.

Implemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiGlpkSolverInterface, OsiSpxSolverInterface, OsiCpxSolverInterface, OsiCbcSolverInterface, OsiMskSolverInterface, OsiGrbSolverInterface, and OsiXprSolverInterface.

virtual OsiVectorInt OsiSolverInterface::getFractionalIndices ( const double  etol = 1.e-05) const
virtual

Get vector of indices of primal variables which are integer variables but have fractional values in the current solution.

virtual void OsiSolverInterface::setObjCoeff ( int  elementIndex,
double  elementValue 
)
pure virtual
virtual void OsiSolverInterface::setObjCoeffSet ( const int *  indexFirst,
const int *  indexLast,
const double *  coeffList 
)
virtual

Set a set of objective function coefficients.

Reimplemented in OsiCpxSolverInterface, OsiMskSolverInterface, and OsiGrbSolverInterface.

virtual void OsiSolverInterface::setObjective ( const double *  array)
virtual

Set the objective coefficients for all columns.

array [getNumCols()] is an array of values for the objective. This defaults to a series of set operations and is here for speed.

Reimplemented in OsiClpSolverInterface.

virtual void OsiSolverInterface::setObjSense ( double  s)
pure virtual

Set the objective function sense.

Use 1 for minimisation (default), -1 for maximisation.

Note
Implementors note that objective function sense is a parameter of the OSI, not a property of the problem. Objective sense can be set prior to problem load and should not be affected by loading a new problem.

Implemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiCbcSolverInterface, OsiGlpkSolverInterface, OsiSpxSolverInterface, OsiCpxSolverInterface, OsiMskSolverInterface, OsiGrbSolverInterface, and OsiXprSolverInterface.

virtual void OsiSolverInterface::setColLower ( int  elementIndex,
double  elementValue 
)
pure virtual
virtual void OsiSolverInterface::setColLower ( const double *  array)
virtual

Set the lower bounds for all columns.

array [getNumCols()] is an array of values for the lower bounds. This defaults to a series of set operations and is here for speed.

Reimplemented in OsiClpSolverInterface.

virtual void OsiSolverInterface::setColUpper ( int  elementIndex,
double  elementValue 
)
pure virtual
virtual void OsiSolverInterface::setColUpper ( const double *  array)
virtual

Set the upper bounds for all columns.

array [getNumCols()] is an array of values for the upper bounds. This defaults to a series of set operations and is here for speed.

Reimplemented in OsiClpSolverInterface.

virtual void OsiSolverInterface::setColBounds ( int  elementIndex,
double  lower,
double  upper 
)
inlinevirtual
virtual void OsiSolverInterface::setColSetBounds ( const int *  indexFirst,
const int *  indexLast,
const double *  boundList 
)
virtual

Set the upper and lower bounds of a set of columns.

The default implementation just invokes setColBounds() over and over again. For each column, boundList must contain both a lower and upper bound, in that order.

Reimplemented in OsiClpSolverInterface, OsiCbcSolverInterface, OsiTestSolverInterface, OsiGlpkSolverInterface, OsiCpxSolverInterface, OsiMskSolverInterface, OsiGrbSolverInterface, and OsiXprSolverInterface.

virtual void OsiSolverInterface::setRowLower ( int  elementIndex,
double  elementValue 
)
pure virtual
virtual void OsiSolverInterface::setRowUpper ( int  elementIndex,
double  elementValue 
)
pure virtual
virtual void OsiSolverInterface::setRowBounds ( int  elementIndex,
double  lower,
double  upper 
)
inlinevirtual
virtual void OsiSolverInterface::setRowSetBounds ( const int *  indexFirst,
const int *  indexLast,
const double *  boundList 
)
virtual

Set the bounds on a set of rows.

The default implementation just invokes setRowBounds() over and over again. For each row, boundList must contain both a lower and upper bound, in that order.

Reimplemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiCbcSolverInterface, OsiGlpkSolverInterface, OsiCpxSolverInterface, OsiMskSolverInterface, OsiGrbSolverInterface, and OsiXprSolverInterface.

virtual void OsiSolverInterface::setRowType ( int  index,
char  sense,
double  rightHandSide,
double  range 
)
pure virtual
virtual void OsiSolverInterface::setRowSetTypes ( const int *  indexFirst,
const int *  indexLast,
const char *  senseList,
const double *  rhsList,
const double *  rangeList 
)
virtual

Set the type of a set of rows.

The default implementation just invokes setRowType() over and over again.

Reimplemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiCbcSolverInterface, OsiGlpkSolverInterface, OsiCpxSolverInterface, OsiMskSolverInterface, OsiGrbSolverInterface, and OsiXprSolverInterface.

virtual void OsiSolverInterface::setColSolution ( const double *  colsol)
pure virtual

Set the primal solution variable values.

colsol[getNumCols()] is an array of values for the primal variables. These values are copied to memory owned by the solver interface object or the solver. They will be returned as the result of getColSolution() until changed by another call to setColSolution() or by a call to any solver routine. Whether the solver makes use of the solution in any way is solver-dependent.

Implemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiCbcSolverInterface, OsiGlpkSolverInterface, OsiSpxSolverInterface, OsiCpxSolverInterface, OsiMskSolverInterface, OsiGrbSolverInterface, and OsiXprSolverInterface.

virtual void OsiSolverInterface::setRowPrice ( const double *  rowprice)
pure virtual

Set dual solution variable values.

rowprice[getNumRows()] is an array of values for the dual variables. These values are copied to memory owned by the solver interface object or the solver. They will be returned as the result of getRowPrice() until changed by another call to setRowPrice() or by a call to any solver routine. Whether the solver makes use of the solution in any way is solver-dependent.

Implemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiCbcSolverInterface, OsiGlpkSolverInterface, OsiSpxSolverInterface, OsiCpxSolverInterface, OsiMskSolverInterface, OsiGrbSolverInterface, and OsiXprSolverInterface.

virtual int OsiSolverInterface::reducedCostFix ( double  gap,
bool  justInteger = true 
)
virtual

Fix variables at bound based on reduced cost.

For variables currently at bound, fix the variable at bound if the reduced cost exceeds the gap. Return the number of variables fixed.

If justInteger is set to false, the routine will also fix continuous variables, but the test still assumes a delta of 1.0.

virtual void OsiSolverInterface::setContinuous ( int  index)
pure virtual
virtual void OsiSolverInterface::setInteger ( int  index)
pure virtual
virtual void OsiSolverInterface::setContinuous ( const int *  indices,
int  len 
)
virtual

Set the variables listed in indices (which is of length len) to be continuous variables.

Reimplemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiCbcSolverInterface, OsiGlpkSolverInterface, OsiCpxSolverInterface, OsiMskSolverInterface, OsiGrbSolverInterface, and OsiXprSolverInterface.

virtual void OsiSolverInterface::setInteger ( const int *  indices,
int  len 
)
virtual

Set the variables listed in indices (which is of length len) to be integer variables.

Reimplemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiCbcSolverInterface, OsiGlpkSolverInterface, OsiCpxSolverInterface, OsiMskSolverInterface, OsiGrbSolverInterface, and OsiXprSolverInterface.

virtual std::string OsiSolverInterface::dfltRowColName ( char  rc,
int  ndx,
unsigned  digits = 7 
) const
virtual

Generate a standard name of the form Rnnnnnnn or Cnnnnnnn.

Set rc to 'r' for a row name, 'c' for a column name. The `nnnnnnn' part is generated from ndx and will contain 7 digits by default, padded with zeros if necessary. As a special case, ndx = getNumRows() is interpreted as a request for the name of the objective function. OBJECTIVE is returned, truncated to digits+1 characters to match the row and column names.

Reimplemented in OsiCbcSolverInterface.

virtual std::string OsiSolverInterface::getObjName ( unsigned  maxLen = static_cast< unsigned >(std::string::npos)) const
virtual

Return the name of the objective function.

Reimplemented in OsiCbcSolverInterface.

virtual void OsiSolverInterface::setObjName ( std::string  name)
inlinevirtual

Set the name of the objective function.

Reimplemented in OsiGlpkSolverInterface, and OsiCbcSolverInterface.

Definition at line 929 of file OsiSolverInterface.hpp.

virtual std::string OsiSolverInterface::getRowName ( int  rowIndex,
unsigned  maxLen = static_cast< unsigned >(std::string::npos) 
) const
virtual

Return the name of the row.

The routine will always return some name, regardless of the name discipline or the level of support by an OsiXXX derived class. Use maxLen to limit the length.

Reimplemented in OsiClpSolverInterface, and OsiCbcSolverInterface.

virtual const OsiNameVec& OsiSolverInterface::getRowNames ( )
virtual

Return a pointer to a vector of row names.

If the name discipline (OsiNameDiscipline) is auto, the return value will be a vector of length zero. If the name discipline is lazy, the vector will contain only names supplied by the client and will be no larger than needed to hold those names; entries not supplied will be null strings. In particular, the objective name is not included in the vector for lazy names. If the name discipline is full, the vector will have getNumRows() names, either supplied or generated, plus one additional entry for the objective name.

Reimplemented in OsiCbcSolverInterface.

virtual void OsiSolverInterface::setRowName ( int  ndx,
std::string  name 
)
virtual

Set a row name.

Quietly does nothing if the name discipline (OsiNameDiscipline) is auto. Quietly fails if the row index is invalid.

Reimplemented in OsiClpSolverInterface, OsiGlpkSolverInterface, OsiGrbSolverInterface, and OsiCbcSolverInterface.

virtual void OsiSolverInterface::setRowNames ( OsiNameVec srcNames,
int  srcStart,
int  len,
int  tgtStart 
)
virtual

Set multiple row names.

The run of len entries starting at srcNames[srcStart] are installed as row names starting at row index tgtStart. The base class implementation makes repeated calls to setRowName.

Reimplemented in OsiCbcSolverInterface.

virtual void OsiSolverInterface::deleteRowNames ( int  tgtStart,
int  len 
)
virtual

Delete len row names starting at index tgtStart.

The specified row names are removed and the remaining row names are copied down to close the gap.

Reimplemented in OsiCbcSolverInterface.

virtual std::string OsiSolverInterface::getColName ( int  colIndex,
unsigned  maxLen = static_cast< unsigned >(std::string::npos) 
) const
virtual

Return the name of the column.

The routine will always return some name, regardless of the name discipline or the level of support by an OsiXXX derived class. Use maxLen to limit the length.

Reimplemented in OsiClpSolverInterface, and OsiCbcSolverInterface.

virtual const OsiNameVec& OsiSolverInterface::getColNames ( )
virtual

Return a pointer to a vector of column names.

If the name discipline (OsiNameDiscipline) is auto, the return value will be a vector of length zero. If the name discipline is lazy, the vector will contain only names supplied by the client and will be no larger than needed to hold those names; entries not supplied will be null strings. If the name discipline is full, the vector will have getNumCols() names, either supplied or generated.

Reimplemented in OsiCbcSolverInterface.

virtual void OsiSolverInterface::setColName ( int  ndx,
std::string  name 
)
virtual

Set a column name.

Quietly does nothing if the name discipline (OsiNameDiscipline) is auto. Quietly fails if the column index is invalid.

Reimplemented in OsiClpSolverInterface, OsiGlpkSolverInterface, OsiGrbSolverInterface, and OsiCbcSolverInterface.

virtual void OsiSolverInterface::setColNames ( OsiNameVec srcNames,
int  srcStart,
int  len,
int  tgtStart 
)
virtual

Set multiple column names.

The run of len entries starting at srcNames[srcStart] are installed as column names starting at column index tgtStart. The base class implementation makes repeated calls to setColName.

Reimplemented in OsiCbcSolverInterface.

virtual void OsiSolverInterface::deleteColNames ( int  tgtStart,
int  len 
)
virtual

Delete len column names starting at index tgtStart.

The specified column names are removed and the remaining column names are copied down to close the gap.

Reimplemented in OsiCbcSolverInterface.

void OsiSolverInterface::setRowColNames ( const CoinMpsIO mps)

Set row and column names from a CoinMpsIO object.

Also sets the name of the objective function. If the name discipline is auto, you get what you asked for. This routine does not use setRowName or setColName.

void OsiSolverInterface::setRowColNames ( CoinModel mod)

Set row and column names from a CoinModel object.

If the name discipline is auto, you get what you asked for. This routine does not use setRowName or setColName.

void OsiSolverInterface::setRowColNames ( CoinLpIO mod)

Set row and column names from a CoinLpIO object.

Also sets the name of the objective function. If the name discipline is auto, you get what you asked for. This routine does not use setRowName or setColName.

virtual void OsiSolverInterface::addCol ( const CoinPackedVectorBase vec,
const double  collb,
const double  colub,
const double  obj 
)
pure virtual
virtual void OsiSolverInterface::addCol ( const CoinPackedVectorBase vec,
const double  collb,
const double  colub,
const double  obj,
std::string  name 
)
virtual

Add a named column (primal variable) to the problem.

The default implementation adds the column, then changes the name. This can surely be made more efficient within an OsiXXX class.

Reimplemented in OsiClpSolverInterface.

virtual void OsiSolverInterface::addCol ( int  numberElements,
const int *  rows,
const double *  elements,
const double  collb,
const double  colub,
const double  obj 
)
virtual

Add a column (primal variable) to the problem.

Reimplemented in OsiClpSolverInterface, and OsiCbcSolverInterface.

virtual void OsiSolverInterface::addCol ( int  numberElements,
const int *  rows,
const double *  elements,
const double  collb,
const double  colub,
const double  obj,
std::string  name 
)
virtual

Add a named column (primal variable) to the problem.

The default implementation adds the column, then changes the name. This can surely be made more efficient within an OsiXXX class.

Reimplemented in OsiClpSolverInterface.

virtual void OsiSolverInterface::addCols ( const int  numcols,
const CoinPackedVectorBase *const *  cols,
const double *  collb,
const double *  colub,
const double *  obj 
)
virtual

Add a set of columns (primal variables) to the problem.

The default implementation simply makes repeated calls to addCol().

Reimplemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiCbcSolverInterface, OsiGlpkSolverInterface, OsiCpxSolverInterface, OsiMskSolverInterface, OsiGrbSolverInterface, and OsiXprSolverInterface.

virtual void OsiSolverInterface::addCols ( const int  numcols,
const int *  columnStarts,
const int *  rows,
const double *  elements,
const double *  collb,
const double *  colub,
const double *  obj 
)
virtual

Add a set of columns (primal variables) to the problem.

The default implementation simply makes repeated calls to addCol().

Reimplemented in OsiClpSolverInterface.

void OsiSolverInterface::addCols ( const CoinBuild buildObject)

Add columns using a CoinBuild object.

int OsiSolverInterface::addCols ( CoinModel modelObject)

Add columns from a model object.

returns -1 if object in bad state (i.e. has row information) otherwise number of errors modelObject non const as can be regularized as part of build

virtual void OsiSolverInterface::deleteCols ( const int  num,
const int *  colIndices 
)
pure virtual

Remove a set of columns (primal variables) from the problem.

The solver interface for a basis-oriented solver will maintain valid warm start information if all deleted variables are nonbasic.

Implemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiCbcSolverInterface, OsiGlpkSolverInterface, OsiSpxSolverInterface, OsiCpxSolverInterface, OsiMskSolverInterface, OsiGrbSolverInterface, and OsiXprSolverInterface.

virtual void OsiSolverInterface::addRow ( const CoinPackedVectorBase vec,
const double  rowlb,
const double  rowub 
)
pure virtual
virtual void OsiSolverInterface::addRow ( const CoinPackedVectorBase vec,
const double  rowlb,
const double  rowub,
std::string  name 
)
virtual

Add a named row (constraint) to the problem.

The default implementation adds the row, then changes the name. This can surely be made more efficient within an OsiXXX class.

Reimplemented in OsiClpSolverInterface.

virtual void OsiSolverInterface::addRow ( const CoinPackedVectorBase vec,
const char  rowsen,
const double  rowrhs,
const double  rowrng 
)
pure virtual
virtual void OsiSolverInterface::addRow ( const CoinPackedVectorBase vec,
const char  rowsen,
const double  rowrhs,
const double  rowrng,
std::string  name 
)
virtual

Add a named row (constraint) to the problem.

The default implementation adds the row, then changes the name. This can surely be made more efficient within an OsiXXX class.

Reimplemented in OsiClpSolverInterface.

virtual void OsiSolverInterface::addRow ( int  numberElements,
const int *  columns,
const double *  element,
const double  rowlb,
const double  rowub 
)
virtual

Add a row (constraint) to the problem.

Converts to addRow(CoinPackedVectorBase&,const double,const double).

Reimplemented in OsiClpSolverInterface.

virtual void OsiSolverInterface::addRows ( const int  numrows,
const CoinPackedVectorBase *const *  rows,
const double *  rowlb,
const double *  rowub 
)
virtual

Add a set of rows (constraints) to the problem.

The default implementation simply makes repeated calls to addRow().

Reimplemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiCbcSolverInterface, OsiGlpkSolverInterface, OsiCpxSolverInterface, OsiMskSolverInterface, OsiGrbSolverInterface, and OsiXprSolverInterface.

virtual void OsiSolverInterface::addRows ( const int  numrows,
const CoinPackedVectorBase *const *  rows,
const char *  rowsen,
const double *  rowrhs,
const double *  rowrng 
)
virtual

Add a set of rows (constraints) to the problem.

The default implementation simply makes repeated calls to addRow().

Reimplemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiCbcSolverInterface, OsiGlpkSolverInterface, OsiCpxSolverInterface, OsiMskSolverInterface, OsiGrbSolverInterface, and OsiXprSolverInterface.

virtual void OsiSolverInterface::addRows ( const int  numrows,
const int *  rowStarts,
const int *  columns,
const double *  element,
const double *  rowlb,
const double *  rowub 
)
virtual

Add a set of rows (constraints) to the problem.

The default implementation simply makes repeated calls to addRow().

Reimplemented in OsiClpSolverInterface.

void OsiSolverInterface::addRows ( const CoinBuild buildObject)

Add rows using a CoinBuild object.

int OsiSolverInterface::addRows ( CoinModel modelObject)

Add rows from a CoinModel object.

Returns -1 if the object is in the wrong state (i.e., has column-major information), otherwise the number of errors.

The modelObject is not const as it can be regularized as part of the build.

virtual void OsiSolverInterface::deleteRows ( const int  num,
const int *  rowIndices 
)
pure virtual

Delete a set of rows (constraints) from the problem.

The solver interface for a basis-oriented solver will maintain valid warm start information if all deleted rows are loose.

Implemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiCbcSolverInterface, OsiGlpkSolverInterface, OsiSpxSolverInterface, OsiCpxSolverInterface, OsiMskSolverInterface, OsiGrbSolverInterface, and OsiXprSolverInterface.

virtual void OsiSolverInterface::replaceMatrixOptional ( const CoinPackedMatrix )
inlinevirtual

Replace the constraint matrix.

I (JJF) am getting annoyed because I can't just replace a matrix. The default behavior of this is do nothing so only use where that would not matter, e.g. strengthening a matrix for MIP.

Reimplemented in OsiClpSolverInterface.

Definition at line 1228 of file OsiSolverInterface.hpp.

virtual void OsiSolverInterface::replaceMatrix ( const CoinPackedMatrix )
inlinevirtual

Replace the constraint matrix.

And if it does matter (not used at present)

Reimplemented in OsiClpSolverInterface.

Definition at line 1234 of file OsiSolverInterface.hpp.

virtual void OsiSolverInterface::saveBaseModel ( )
inlinevirtual

Save a copy of the base model.

If solver wants it can save a copy of "base" (continuous) model here.

Reimplemented in OsiClpSolverInterface.

Definition at line 1240 of file OsiSolverInterface.hpp.

virtual void OsiSolverInterface::restoreBaseModel ( int  numberRows)
virtual

Reduce the constraint system to the specified number of constraints.

If solver wants it can restore a copy of "base" (continuous) model here.

Note
The name is somewhat misleading. Implementors should consider the opportunity to optimise behaviour in the common case where numberRows is exactly the number of original constraints. Do not, however, neglect the possibility that numberRows does not equal the number of original constraints.

Reimplemented in OsiClpSolverInterface.

virtual ApplyCutsReturnCode OsiSolverInterface::applyCuts ( const OsiCuts cs,
double  effectivenessLb = 0.0 
)
virtual

Apply a collection of cuts.

Only cuts which have an effectiveness >= effectivenessLb are applied.

  • ReturnCode.getNumineffective() – number of cuts which were not applied because they had an effectiveness < effectivenessLb
  • ReturnCode.getNuminconsistent() – number of invalid cuts
  • ReturnCode.getNuminconsistentWrtIntegerModel() – number of cuts that are invalid with respect to this integer model
  • ReturnCode.getNuminfeasible() – number of cuts that would make this integer model infeasible
  • ReturnCode.getNumApplied() – number of integer cuts which were applied to the integer model
  • cs.size() == getNumineffective() + getNuminconsistent() + getNuminconsistentWrtIntegerModel() + getNuminfeasible() + getNumApplied()

Reimplemented in OsiClpSolverInterface, and OsiGrbSolverInterface.

virtual void OsiSolverInterface::applyRowCuts ( int  numberCuts,
const OsiRowCut cuts 
)
virtual

Apply a collection of row cuts which are all effective.

applyCuts seems to do one at a time which seems inefficient. Would be even more efficient to pass an array of pointers.

Reimplemented in OsiClpSolverInterface, and OsiCbcSolverInterface.

virtual void OsiSolverInterface::applyRowCuts ( int  numberCuts,
const OsiRowCut **  cuts 
)
virtual

Apply a collection of row cuts which are all effective.

This is passed in as an array of pointers.

Reimplemented in OsiClpSolverInterface, and OsiCbcSolverInterface.

void OsiSolverInterface::deleteBranchingInfo ( int  numberDeleted,
const int *  which 
)

Deletes branching information before columns deleted.

virtual void OsiSolverInterface::loadProblem ( const CoinPackedMatrix matrix,
const double *  collb,
const double *  colub,
const double *  obj,
const double *  rowlb,
const double *  rowub 
)
pure virtual

Load in a problem by copying the arguments.

The constraints on the rows are given by lower and upper bounds.

If a pointer is 0 then the following values are the default:

  • colub: all columns have upper bound infinity
  • collb: all columns have lower bound 0
  • rowub: all rows have upper bound infinity
  • rowlb: all rows have lower bound -infinity
  • obj: all variables have 0 objective coefficient

Note that the default values for rowub and rowlb produce the constraint -infty <= ax <= infty. This is probably not what you want.

Implemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiCbcSolverInterface, OsiGlpkSolverInterface, OsiSpxSolverInterface, OsiCpxSolverInterface, OsiMskSolverInterface, OsiXprSolverInterface, and OsiGrbSolverInterface.

virtual void OsiSolverInterface::assignProblem ( CoinPackedMatrix *&  matrix,
double *&  collb,
double *&  colub,
double *&  obj,
double *&  rowlb,
double *&  rowub 
)
pure virtual

Load in a problem by assuming ownership of the arguments.

The constraints on the rows are given by lower and upper bounds.

For default argument values see the matching loadProblem method.

Warning
The arguments passed to this method will be freed using the C++ delete and delete[] functions.

Implemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiCbcSolverInterface, OsiGlpkSolverInterface, OsiSpxSolverInterface, OsiCpxSolverInterface, OsiMskSolverInterface, OsiXprSolverInterface, and OsiGrbSolverInterface.

virtual void OsiSolverInterface::loadProblem ( const CoinPackedMatrix matrix,
const double *  collb,
const double *  colub,
const double *  obj,
const char *  rowsen,
const double *  rowrhs,
const double *  rowrng 
)
pure virtual

Load in a problem by copying the arguments.

The constraints on the rows are given by sense/rhs/range triplets.

If a pointer is 0 then the following values are the default:

  • colub: all columns have upper bound infinity
  • collb: all columns have lower bound 0
  • obj: all variables have 0 objective coefficient
  • rowsen: all rows are >=
  • rowrhs: all right hand sides are 0
  • rowrng: 0 for the ranged rows

Note that the default values for rowsen, rowrhs, and rowrng produce the constraint ax >= 0.

Implemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiCbcSolverInterface, OsiGlpkSolverInterface, OsiSpxSolverInterface, OsiCpxSolverInterface, OsiMskSolverInterface, OsiXprSolverInterface, and OsiGrbSolverInterface.

virtual void OsiSolverInterface::assignProblem ( CoinPackedMatrix *&  matrix,
double *&  collb,
double *&  colub,
double *&  obj,
char *&  rowsen,
double *&  rowrhs,
double *&  rowrng 
)
pure virtual

Load in a problem by assuming ownership of the arguments.

The constraints on the rows are given by sense/rhs/range triplets.

For default argument values see the matching loadProblem method.

Warning
The arguments passed to this method will be freed using the C++ delete and delete[] functions.

Implemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiCbcSolverInterface, OsiGlpkSolverInterface, OsiSpxSolverInterface, OsiCpxSolverInterface, OsiMskSolverInterface, OsiXprSolverInterface, and OsiGrbSolverInterface.

virtual void OsiSolverInterface::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 
)
pure virtual

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.

The matrix vectors must be gap-free. Note that start must have numcols+1 entries so that the length of the last column can be calculated as start[numcols]-start[numcols-1].

See the previous loadProblem method using rowlb and rowub for default argument values.

Implemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiCbcSolverInterface, OsiGlpkSolverInterface, OsiSpxSolverInterface, OsiCpxSolverInterface, OsiMskSolverInterface, OsiXprSolverInterface, and OsiGrbSolverInterface.

virtual void OsiSolverInterface::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 
)
pure virtual

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.

The matrix vectors must be gap-free. Note that start must have numcols+1 entries so that the length of the last column can be calculated as start[numcols]-start[numcols-1].

See the previous loadProblem method using sense/rhs/range for default argument values.

Implemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiCbcSolverInterface, OsiGlpkSolverInterface, OsiSpxSolverInterface, OsiCpxSolverInterface, OsiMskSolverInterface, OsiXprSolverInterface, and OsiGrbSolverInterface.

virtual int OsiSolverInterface::loadFromCoinModel ( CoinModel modelObject,
bool  keepSolution = false 
)
virtual

Load a model from a CoinModel object.

Return the number of errors encountered.

The modelObject parameter cannot be const as it may be changed as part of process. If keepSolution is true will try and keep warmStart.

Reimplemented in OsiClpSolverInterface.

virtual int OsiSolverInterface::readMps ( const char *  filename,
const char *  extension = "mps" 
)
virtual

Read a problem in MPS format from the given filename.

The default implementation uses CoinMpsIO::readMps() to read the MPS file and returns the number of errors encountered.

Reimplemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiCbcSolverInterface, OsiGlpkSolverInterface, OsiSpxSolverInterface, OsiCpxSolverInterface, OsiMskSolverInterface, OsiXprSolverInterface, and OsiGrbSolverInterface.

virtual int OsiSolverInterface::readMps ( const char *  filename,
const char *  extension,
int &  numberSets,
CoinSet **&  sets 
)
virtual

Read a problem in MPS format from the given full filename.

This uses CoinMpsIO::readMps() to read the MPS file and returns the number of errors encountered. It also may return an array of set information

Reimplemented in OsiClpSolverInterface.

virtual int OsiSolverInterface::readGMPL ( const char *  filename,
const char *  dataname = NULL 
)
virtual

Read a problem in GMPL format from the given filenames.

The default implementation uses CoinMpsIO::readGMPL(). This capability is available only if the third-party package Glpk is installed.

virtual void OsiSolverInterface::writeMps ( const char *  filename,
const char *  extension = "mps",
double  objSense = 0.0 
) const
pure virtual

Write the problem in MPS format to the specified file.

If objSense is non-zero, a value of -1.0 causes the problem to be written with a maximization objective; +1.0 forces a minimization objective. If objSense is zero, the choice is left to the implementation.

Implemented in OsiClpSolverInterface, OsiTestSolverInterface, OsiCbcSolverInterface, OsiGlpkSolverInterface, OsiSpxSolverInterface, OsiCpxSolverInterface, OsiMskSolverInterface, OsiXprSolverInterface, and OsiGrbSolverInterface.

int OsiSolverInterface::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.

Row and column names may be null. formatType is

  • 0 - normal
  • 1 - extra accuracy
  • 2 - IEEE hex

Returns non-zero on I/O error

virtual void OsiSolverInterface::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
virtual

Write the problem into an Lp file of the given filename with the specified extension.

Coefficients with value less than epsilon away from an integer value are written as integers. Write at most numberAcross monomials on a line. Write non integer numbers with decimals digits after the decimal point.

The written problem is always a minimization problem. If the current problem is a maximization problem, the intended objective function for the written problem is the current objective function multiplied by -1. If the current problem is a minimization problem, the intended objective function for the written problem is the current objective function. If objSense < 0, the intended objective function is multiplied by -1 before writing the problem. It is left unchanged otherwise.

Write objective function name and constraint names if useRowNames is true. This version calls writeLpNative().

Reimplemented in OsiClpSolverInterface.

virtual void OsiSolverInterface::writeLp ( FILE *  fp,
double  epsilon = 1e-5,
int  numberAcross = 10,
int  decimals = 5,
double  objSense = 0.0,
bool  useRowNames = true 
) const
virtual

Write the problem into the file pointed to by the parameter fp.

Other parameters are similar to those of writeLp() with first parameter filename.

Reimplemented in OsiClpSolverInterface.

int OsiSolverInterface::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.

Parameters are similar to those of writeLp(), but in addition row names and column names may be given.

Parameter rowNames may be NULL, in which case default row names are used. If rowNames is not NULL, it must have exactly one entry per row in the problem and one additional entry (rowNames[getNumRows()] with the objective function name. These getNumRows()+1 entries must be distinct. If this is not the case, default row names are used. In addition, format restrictions are imposed on names (see CoinLpIO::is_invalid_name() for details).

Similar remarks can be made for the parameter columnNames which must either be NULL or have exactly getNumCols() distinct entries.

Write objective function name and constraint names if useRowNames is true.

int OsiSolverInterface::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.

Other parameters are similar to those of writeLpNative() with first parameter filename.

virtual int OsiSolverInterface::readLp ( const char *  filename,
const double  epsilon = 1e-5 
)
virtual

Read file in LP format from file with name filename.

See class CoinLpIO for description of this format.

Reimplemented in OsiClpSolverInterface.

int OsiSolverInterface::readLp ( FILE *  fp,
const double  epsilon = 1e-5 
)

Read file in LP format from the file pointed to by fp.

See class CoinLpIO for description of this format.

int OsiSolverInterface::differentModel ( OsiSolverInterface other,
bool  ignoreNames = true 
)

Check two models against each other.

Return nonzero if different. Ignore names if that set. (Note initial version does not check names) May modify both models by cleaning up

void OsiSolverInterface::setApplicationData ( void appData)

Set application data.

This is a pointer that the application can store into and retrieve from the solver interface. This field is available for the application to optionally define and use.

void OsiSolverInterface::setAuxiliaryInfo ( OsiAuxInfo auxiliaryInfo)

Create a clone of an Auxiliary Information object.

The base class just stores an application data pointer but can be more general. Application data pointer is designed for one user while this can be extended to cope with more general extensions.

void* OsiSolverInterface::getApplicationData ( ) const

Get application data.

OsiAuxInfo* OsiSolverInterface::getAuxiliaryInfo ( ) const

Get pointer to auxiliary info object.

virtual void OsiSolverInterface::passInMessageHandler ( CoinMessageHandler handler)
virtual

Pass in a message handler.

It is the client's responsibility to destroy a message handler installed by this routine; it will not be destroyed when the solver interface is destroyed.

Reimplemented in OsiClpSolverInterface, OsiCbcSolverInterface, OsiCpxSolverInterface, OsiMskSolverInterface, and OsiXprSolverInterface.

void OsiSolverInterface::newLanguage ( CoinMessages::Language  language)

Set language.

void OsiSolverInterface::setLanguage ( CoinMessages::Language  language)
inline

Definition at line 1629 of file OsiSolverInterface.hpp.

CoinMessageHandler* OsiSolverInterface::messageHandler ( ) const
inline

Return a pointer to the current message handler.

Definition at line 1632 of file OsiSolverInterface.hpp.

CoinMessages OsiSolverInterface::messages ( )
inline

Return the current set of messages.

Definition at line 1635 of file OsiSolverInterface.hpp.

CoinMessages* OsiSolverInterface::messagesPointer ( )
inline

Return a pointer to the current set of messages.

Definition at line 1638 of file OsiSolverInterface.hpp.

bool OsiSolverInterface::defaultHandler ( ) const
inline

Return true if default handler.

Definition at line 1641 of file OsiSolverInterface.hpp.

void OsiSolverInterface::findIntegers ( bool  justCount)

Identify integer variables and create corresponding objects.

Record integer variables and create an OsiSimpleInteger object for each one. All existing OsiSimpleInteger objects will be destroyed. If justCount then no objects created and we just store numberIntegers_

virtual int OsiSolverInterface::findIntegersAndSOS ( bool  justCount)
virtual

Identify integer variables and SOS and create corresponding objects.

Record integer variables and create an OsiSimpleInteger object for each one. All existing OsiSimpleInteger objects will be destroyed. If the solver supports SOS then do the same for SOS.

If justCount then no objects created and we just store numberIntegers_ Returns number of SOS

Reimplemented in OsiClpSolverInterface.

int OsiSolverInterface::numberObjects ( ) const
inline

Get the number of objects.

Definition at line 1672 of file OsiSolverInterface.hpp.

void OsiSolverInterface::setNumberObjects ( int  number)
inline

Set the number of objects.

Definition at line 1674 of file OsiSolverInterface.hpp.

OsiObject** OsiSolverInterface::objects ( ) const
inline

Get the array of objects.

Definition at line 1678 of file OsiSolverInterface.hpp.

const OsiObject* OsiSolverInterface::object ( int  which) const
inline

Get the specified object.

Definition at line 1681 of file OsiSolverInterface.hpp.

OsiObject* OsiSolverInterface::modifiableObject ( int  which) const
inline

Get the specified object.

Definition at line 1683 of file OsiSolverInterface.hpp.

void OsiSolverInterface::deleteObjects ( )

Delete all object information.

void OsiSolverInterface::addObjects ( int  numberObjects,
OsiObject **  objects 
)

Add in object information.

Objects are cloned; the owner can delete the originals.

double OsiSolverInterface::forceFeasible ( )

Use current solution to set bounds so current integer feasible solution will stay feasible.

Only feasible bounds will be used, even if current solution outside bounds. The amount of such violation will be returned (and if small can be ignored)

virtual void OsiSolverInterface::activateRowCutDebugger ( const char *  modelName)
virtual

Activate the row cut debugger.

If modelName is in the set of known models then all cuts are checked to see that they do NOT cut off the optimal solution known to the debugger.

virtual void OsiSolverInterface::activateRowCutDebugger ( const double *  solution,
bool  enforceOptimality = true 
)
virtual

Activate the row cut debugger using a full solution array.

Activate the debugger for a model not included in the debugger's internal database. Cuts will be checked to see that they do NOT cut off the given solution.

solution must be a full solution vector, but only the integer variables need to be correct. The debugger will fill in the continuous variables by solving an lp relaxation with the integer variables fixed as specified. If the given values for the continuous variables should be preserved, set keepContinuous to true.

const OsiRowCutDebugger* OsiSolverInterface::getRowCutDebugger ( ) const

Get the row cut debugger provided the solution known to the debugger is within the feasible region held in the solver.

If there is a row cut debugger object associated with model AND if the solution known to the debugger is within the solver's current feasible region (i.e., the column bounds held in the solver are compatible with the known solution) then a pointer to the debugger is returned which may be used to test validity of cuts.

Otherwise NULL is returned

OsiRowCutDebugger* OsiSolverInterface::getRowCutDebuggerAlways ( ) const

Get the row cut debugger object.

Return the row cut debugger object if it exists. One common usage of this method is to obtain a debugger object in order to execute OsiRowCutDebugger::redoSolution (so that the stored solution is again compatible with the problem held in the solver).

virtual int OsiSolverInterface::canDoSimplexInterface ( ) const
virtual

Return the simplex implementation level.

The return codes are:

  • 0: the simplex interface is not implemented.
  • 1: the Group 1 (tableau access) methods are implemented.
  • 2: the Group 2 (pivoting) methods are implemented

The codes are cumulative - a solver which implements Group 2 also implements Group 1.

Reimplemented in OsiCpxSolverInterface, OsiGrbSolverInterface, and OsiClpSolverInterface.

virtual void OsiSolverInterface::enableFactorization ( ) const
virtual

Prepare the solver for the use of tableau access methods.

Prepares the solver for the use of the tableau access methods, if any such preparation is required.

The const attribute is required due to the places this method may be called (e.g., within CglCutGenerator::generateCuts()).

Reimplemented in OsiCpxSolverInterface, OsiGrbSolverInterface, and OsiClpSolverInterface.

virtual void OsiSolverInterface::disableFactorization ( ) const
virtual
virtual bool OsiSolverInterface::basisIsAvailable ( ) const
virtual

Check if an optimal basis is available.

Returns true if the problem has been solved to optimality and a basis is available. This should be used to see if the tableau access operations are possible and meaningful.

Note
Implementors please note that this method may be called before enableFactorization.

Reimplemented in OsiCpxSolverInterface, OsiGrbSolverInterface, and OsiClpSolverInterface.

bool OsiSolverInterface::optimalBasisIsAvailable ( ) const
inline

Synonym for basisIsAvailable.

Definition at line 1809 of file OsiSolverInterface.hpp.

virtual void OsiSolverInterface::getBasisStatus ( int *  cstat,
int *  rstat 
) const
virtual

Retrieve status information for column and row variables.

This method returns status as integer codes:

  • 0: free
  • 1: basic
  • 2: nonbasic at upper bound
  • 3: nonbasic at lower bound

The getWarmStart method provides essentially the same functionality for a simplex-oriented solver, but the implementation details are very different.

Note
Logical variables associated with rows are all assumed to have +1 coefficients, so for a <= constraint the logical will be at lower bound if the constraint is tight.
Implementors may choose to implement this method as a wrapper which converts a CoinWarmStartBasis to the requested representation.

Reimplemented in OsiCpxSolverInterface, OsiGrbSolverInterface, and OsiClpSolverInterface.

virtual int OsiSolverInterface::setBasisStatus ( const int *  cstat,
const int *  rstat 
)
virtual

Set the status of column and row variables and update the basis factorization and solution.

Status information should be coded as documented for getBasisStatus. Returns 0 if all goes well, 1 if something goes wrong.

This method differs from setWarmStart in the format of the input and in its immediate effect. Think of it as setWarmStart immediately followed by resolve, but no pivots are allowed.

Note
Implementors may choose to implement this method as a wrapper that calls setWarmStart and resolve if the no pivot requirement can be satisfied.

Reimplemented in OsiClpSolverInterface.

virtual void OsiSolverInterface::getReducedGradient ( double *  columnReducedCosts,
double *  duals,
const double *  c 
) const
virtual

Calculate duals and reduced costs for the given objective coefficients.

The solver's objective coefficient vector is not changed.

Reimplemented in OsiClpSolverInterface.

virtual void OsiSolverInterface::getBInvARow ( int  row,
double *  z,
double *  slack = NULL 
) const
virtual

Get a row of the tableau.

If slack is not null, it will be loaded with the coefficients for the artificial (logical) variables (i.e., the row of the basis inverse).

Reimplemented in OsiCpxSolverInterface, and OsiClpSolverInterface.

virtual void OsiSolverInterface::getBInvRow ( int  row,
double *  z 
) const
virtual

Get a row of the basis inverse.

Reimplemented in OsiCpxSolverInterface, and OsiClpSolverInterface.

virtual void OsiSolverInterface::getBInvACol ( int  col,
double *  vec 
) const
virtual

Get a column of the tableau.

Reimplemented in OsiCpxSolverInterface, and OsiClpSolverInterface.

virtual void OsiSolverInterface::getBInvCol ( int  col,
double *  vec 
) const
virtual

Get a column of the basis inverse.

Reimplemented in OsiCpxSolverInterface, and OsiClpSolverInterface.

virtual void OsiSolverInterface::getBasics ( int *  index) const
virtual

Get indices of basic variables.

If the logical (artificial) for row i is basic, the index should be coded as (getNumCols + i). The order of indices must match the order of elements in the vectors returned by getBInvACol and getBInvCol.

Reimplemented in OsiCpxSolverInterface, and OsiClpSolverInterface.

virtual void OsiSolverInterface::enableSimplexInterface ( bool  doingPrimal)
virtual

Enables normal operation of subsequent functions.

This method is supposed to ensure that all typical things (like reduced costs, etc.) are updated when individual pivots are executed and can be queried by other methods. says whether will be doing primal or dual

Reimplemented in OsiClpSolverInterface.

virtual void OsiSolverInterface::disableSimplexInterface ( )
virtual

Undo whatever setting changes the above method had to make.

Reimplemented in OsiCpxSolverInterface, OsiGrbSolverInterface, and OsiClpSolverInterface.

virtual int OsiSolverInterface::pivot ( int  colIn,
int  colOut,
int  outStatus 
)
virtual

Perform a pivot by substituting a colIn for colOut in the basis.

The status of the leaving variable is given in outStatus. Where 1 is to upper bound, -1 to lower bound Return code was undefined - now for OsiClp is 0 for okay, 1 if inaccuracy forced re-factorization (should be okay) and -1 for singular factorization

Reimplemented in OsiClpSolverInterface.

virtual int OsiSolverInterface::primalPivotResult ( int  colIn,
int  sign,
int &  colOut,
int &  outStatus,
double &  t,
CoinPackedVector dx 
)
virtual

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.

Inputs: colIn – entering column, sign – direction of its change (+/-1). Both for colIn and colOut, artificial variables are index by the negative of the row index minus 1. Return code (for now): 0 – leaving variable found, -1 – everything else? Clearly, more informative set of return values is required Primal and dual solutions are updated

Reimplemented in OsiClpSolverInterface.

virtual int OsiSolverInterface::dualPivotResult ( int &  colIn,
int &  sign,
int  colOut,
int  outStatus,
double &  t,
CoinPackedVector dx 
)
virtual

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.

Reimplemented in OsiClpSolverInterface.

virtual OsiSolverInterface* OsiSolverInterface::clone ( bool  copyData = true) const
pure virtual
OsiSolverInterface& OsiSolverInterface::operator= ( const OsiSolverInterface rhs)

Assignment operator.

virtual void OsiSolverInterface::reset ( )
virtual

Reset the solver interface.

A call to reset() returns the solver interface to the same state as it would have if it had just been constructed by calling the default constructor OsiSolverInterface().

Reimplemented in OsiClpSolverInterface, OsiGlpkSolverInterface, OsiCpxSolverInterface, and OsiGrbSolverInterface.

virtual void OsiSolverInterface::applyRowCut ( const OsiRowCut rc)
protectedpure virtual
virtual void OsiSolverInterface::applyColCut ( const OsiColCut cc)
protectedpure virtual
void OsiSolverInterface::convertBoundToSense ( const double  lower,
const double  upper,
char &  sense,
double &  right,
double &  range 
) const
inlineprotected

A quick inlined function to convert from the lb/ub style of constraint definition to the sense/rhs/range style.

Definition at line 2081 of file OsiSolverInterface.hpp.

void OsiSolverInterface::convertSenseToBound ( const char  sense,
const double  right,
const double  range,
double &  lower,
double &  upper 
) const
inlineprotected

A quick inlined function to convert from the sense/rhs/range style of constraint definition to the lb/ub style.

Definition at line 2115 of file OsiSolverInterface.hpp.

template<class T >
T OsiSolverInterface::forceIntoRange ( const T  value,
const T  lower,
const T  upper 
) const
inlineprotected

A quick inlined function to force a value to be between a minimum and a maximum value.

Definition at line 1997 of file OsiSolverInterface.hpp.

void OsiSolverInterface::setInitialData ( )
protected

Set OsiSolverInterface object state for default constructor.

This routine establishes the initial values of data fields in the OsiSolverInterface object when the object is created using the default constructor.

Friends And Related Function Documentation

void OsiSolverInterfaceCommonUnitTest ( const OsiSolverInterface emptySi,
const std::string &  mpsDir,
const std::string &  netlibDir 
)
friend

A function that tests the methods in the OsiSolverInterface class.

Some time ago, if this method is compiled with optimization, the compilation took 10-15 minutes and the machine pages (has 256M core memory!)...

void OsiSolverInterfaceMpsUnitTest ( const std::vector< OsiSolverInterface * > &  vecSiP,
const std::string &  mpsDir 
)
friend

A function that tests that a lot of problems given in MPS files (mostly the NETLIB problems) solve properly with all the specified solvers.

The routine creates a vector of NetLib problems (problem name, objective, various other characteristics), and a vector of solvers to be tested.

Each solver is run on each problem. The run is deemed successful if the solver reports the correct problem size after loading and returns the correct objective value after optimization.

If multiple solvers are available, the results are compared pairwise against the results reported by adjacent solvers in the solver vector. Due to limitations of the volume solver, it must be the last solver in vecEmptySiP.

Member Data Documentation

OsiRowCutDebugger* OsiSolverInterface::rowCutDebugger_
mutableprotected

Pointer to row cut debugger object.

Mutable so that we can update the solution held in the debugger while maintaining const'ness for the Osi object.

Definition at line 2016 of file OsiSolverInterface.hpp.

CoinMessageHandler* OsiSolverInterface::handler_
protected

Message handler.

Definition at line 2019 of file OsiSolverInterface.hpp.

bool OsiSolverInterface::defaultHandler_
protected

Flag to say if the currrent handler is the default handler.

Indicates if the solver interface object is responsible for destruction of the handler (true) or if the client is responsible (false).

Definition at line 2025 of file OsiSolverInterface.hpp.

CoinMessages OsiSolverInterface::messages_
protected

Messages.

Definition at line 2027 of file OsiSolverInterface.hpp.

int OsiSolverInterface::numberIntegers_
protected

Number of integers.

Definition at line 2029 of file OsiSolverInterface.hpp.

int OsiSolverInterface::numberObjects_
protected

Total number of objects.

Definition at line 2031 of file OsiSolverInterface.hpp.

OsiObject** OsiSolverInterface::object_
protected

Integer and ... information (integer info normally at beginning)

Definition at line 2034 of file OsiSolverInterface.hpp.

char* OsiSolverInterface::columnType_
mutableprotected

Column type 0 - continuous 1 - binary (may get fixed later) 2 - general integer (may get fixed later)

Definition at line 2040 of file OsiSolverInterface.hpp.

OsiAuxInfo* OsiSolverInterface::appDataEtc_
private

Pointer to user-defined data structure - and more if user wants.

Definition at line 2050 of file OsiSolverInterface.hpp.

int OsiSolverInterface::intParam_[OsiLastIntParam]
private

Array of integer parameters.

Definition at line 2052 of file OsiSolverInterface.hpp.

double OsiSolverInterface::dblParam_[OsiLastDblParam]
private

Array of double parameters.

Definition at line 2054 of file OsiSolverInterface.hpp.

std::string OsiSolverInterface::strParam_[OsiLastStrParam]
private

Array of string parameters.

Definition at line 2056 of file OsiSolverInterface.hpp.

bool OsiSolverInterface::hintParam_[OsiLastHintParam]
private

Array of hint parameters.

Definition at line 2058 of file OsiSolverInterface.hpp.

OsiHintStrength OsiSolverInterface::hintStrength_[OsiLastHintParam]
private

Array of hint strengths.

Definition at line 2060 of file OsiSolverInterface.hpp.

CoinWarmStart* OsiSolverInterface::ws_
private

Warm start information used for hot starts when the default hot start implementation is used.

Definition at line 2063 of file OsiSolverInterface.hpp.

std::vector<double> OsiSolverInterface::strictColSolution_
private

Column solution satisfying lower and upper column bounds.

Definition at line 2065 of file OsiSolverInterface.hpp.

OsiNameVec OsiSolverInterface::rowNames_
private

Row names.

Definition at line 2068 of file OsiSolverInterface.hpp.

OsiNameVec OsiSolverInterface::colNames_
private

Column names.

Definition at line 2070 of file OsiSolverInterface.hpp.

std::string OsiSolverInterface::objName_
private

Objective name.

Definition at line 2072 of file OsiSolverInterface.hpp.


The documentation for this class was generated from the following file: