Logo Search packages:      
Sourcecode: rsymphony version File versions  Download package

OsiDylpSolverInterface Class Reference

#include <OsiDylpSolverInterface.hpp>

Inheritance diagram for OsiDylpSolverInterface:

OsiSolverInterface

List of all members.


Detailed Description

COIN OSI layer for dylp.

The class OsiDylpSolverInterface (ODSI) implements the public functions defined for a COIN OsiSolverInterface (OSI) object.

OsiDylpSolverInterface Principles for Users

In addition to the principles outlined for the OsiSolverInterface class, ODSI maintains the following:

Construction of a Constraint System: A constraint system can be batch loaded from a file (MPS format) or from a data structure, or it can be built incrementally. When building a constraint system incrementally, keep in mind that you must create a row or column (addRow or addCol, respectively) before you can adjust other properties (row or column bounds, objective, variable values, etc.)

Existence of a Solution: For proper operation, OSI requires that a SI maintain a basic primal solution at all times after a problem has been loaded.

When a problem is loaded, ODSI generates a basic primal solution (primal variable values and a matching basis). The solution is not necessarily primal or dual feasible. In terms of the objective function, this solution is pessimistic, but not necessarily worst-case. ODSI does not generate matching values for the dual variables (row prices).

Any successful call to dylp (i.e., a call that results in an optimal, infeasible, or unbounded result, or that terminates on iteration limit) will replace the existing solution with the result of the call to dylp.

It is possible to specify initial values for the primal and dual variables using setColSolution() and setRowPrice(). To specify an initial basis, see the documentation for the CoinWarmStartBasis and OsiDylpWarmStartBasis classes. When these functions are used, it is the responsibility of the client to ensure validity and consistency.

Maintenance of an LP Basis Skirting the edges of the principle that changing the problem invalidates the solution, OsiDylp will maintain a valid basis across two common operations used in branch-and-cut: deletion of a loose constraint and deletion of a nonbasic variable. Arguably the set of allowable modifications could be increased.

Assignment Assignment (operator=()) works pretty much as you'd expect, with one exception. Only one ODSI object can control the dylp solver at a time, so hot start information is not copied on assignment.

Detailed documentation is contained in OsiDylpSolverInterface.cpp, which is not normally scanned when generating COIN OSI layer documentation.

Definition at line 100 of file OsiDylpSolverInterface.hpp.


Solver instance control variables

These variables maintain state for individual ODSI instances.

enum  basisCondition { basisNone = 0, basisFresh, basisModified, basisDamaged }
 Codes for basis condition. More...
struct {
   int   balance
   CoinWarmStart *   basis
   basisCondition   condition
activeBasis
 Active basis.
CoinWarmStarthotstart_fallback
 Warm start object used as a fallback for hot start.
void * info_ [OsiLastHintParam]
 Array for info blocks associated with hints.
bool initial_gtxecho
 Controls output of log information to stdout during initialSolve().
ioid local_logchn
 Log file for this ODSI instance.
ioid local_outchn
 Output file for this ODSI instance.
lpret_enum lp_retval
 Result of last call to solver for this ODSI instance.
bool mps_debug
 Allow messages from CoinMpsIO package.
double obj_sense
 Objective function sense for this ODSI instance.
double odsiInfinity
 The value of infinity.
bool resolve_gtxecho
 Controls output of log information to stdout during resolve() and solveFromHotStart().
bool solnIsFresh
 The most recent solution from dylp is valid.
const std::string solvername
 Solver name (dylp).

Public Types

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

Public Member Functions

Debugging Methods


void activateRowCutDebugger (const double *solution)
 Activate the row cut debugger.
void activateRowCutDebugger (const char *modelName)
 Activate the row cut debugger.
Methods to modify the constraint system.
Note that new columns are added as continuous variables.

virtual void addCol (int numberElements, const int *rows, const double *elements, const double collb, const double colub, const double obj, std::string name)
 Add a named column (primal variable) to the problem.
virtual void addCol (int numberElements, const int *rows, const double *elements, const double collb, const double colub, const double obj)
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.
int addCols (CoinModel &modelObject)
void addCols (const CoinBuild &buildObject)
 Add columns using a CoinBuild object.
virtual void addCols (const int numcols, const int *columnStarts, const int *rows, const double *elements, const double *collb, const double *colub, const double *obj)
virtual void addCols (const int numcols, const CoinPackedVectorBase *const *cols, const double *collb, const double *colub, const double *obj)
virtual void addRow (int numberElements, const int *columns, const double *element, const double rowlb, const double rowub)
virtual void addRow (const CoinPackedVectorBase &vec, const char rowsen, const double rowrhs, const double rowrng, std::string name)
 Add a named row (constraint) to the problem.
virtual void addRow (const CoinPackedVectorBase &vec, const double rowlb, const double rowub, std::string name)
 Add a named row (constraint) to the problem.
int addRows (CoinModel &modelObject)
void addRows (const CoinBuild &buildObject)
 Add rows using a CoinBuild object.
virtual void addRows (const int numrows, const int *rowStarts, const int *columns, const double *element, const double *rowlb, const double *rowub)
virtual void addRows (const int numrows, const CoinPackedVectorBase *const *rows, const char *rowsen, const double *rowrhs, const double *rowrng)
virtual void addRows (const int numrows, const CoinPackedVectorBase *const *rows, const double *rowlb, const double *rowub)
virtual ApplyCutsReturnCode applyCuts (const OsiCuts &cs, double effectivenessLb=0.0)
virtual void applyRowCuts (int numberCuts, const OsiRowCut **cuts)
virtual void applyRowCuts (int numberCuts, const OsiRowCut *cuts)
void deleteBranchingInfo (int numberDeleted, const int *which)
 Deletes branching information before columns deleted.
virtual void restoreBaseModel (int numberRows)
virtual void saveBaseModel ()
Methods to modify the problem


void addCol (const CoinPackedVectorBase &vec, const double collb, const double colub, const double obj)
 Add a column (variable) to the problem.
void addRow (const CoinPackedVectorBase &row, const char rowsen, const double rowrhs, const double rowrng)
 Add a row (constraint) to the problem.
void addRow (const CoinPackedVectorBase &row, const double rowlb, const double rowub)
 Add a row (constraint) to the problem.
void applyColCut (const OsiColCut &cut)
 Apply a column (variable) cut (adjust one or more bounds).
void applyRowCut (const OsiRowCut &cut)
 Apply a row (constraint) cut (add one constraint).
void deleteCols (const int num, const int *colIndices)
 Remove column(s) (variable(s)) from the problem.
void deleteRows (const int num, const int *rowIndices)
 Delete row(s) (constraint(s)) from the problem.
void setColLower (int index, double value)
 Set the lower bound on a column (variable).
void setColSolution (const double *colsol)
 Set the value of the primal variables in the problem solution.
void setColUpper (int index, double value)
 Set the upper bound on a column (variable).
void setContinuous (const int *indices, int len)
 Set a list of variables to be continuous.
void setContinuous (int index)
 Set a single variable to be continuous.
void setInteger (const int *indices, int len)
 Set a list of variables to be integer.
void setInteger (int index)
 Set a single variable to be integer.
void setObjCoeff (int index, double value)
 Set an objective function coefficient.
void setObjSense (double sense)
 Set the sense (min/max) of the objective.
void setRowLower (int index, double value)
 Set the lower bound on a row (constraint).
void setRowPrice (const double *)
 Set the value of the dual variables in the problem solution.
void setRowType (int index, char rowsen, double rowrhs, double rowrng)
 Set the type of a row (constraint).
void setRowUpper (int index, double value)
 Set the upper bound on a row (constraint).
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 addObjects (int numberObjects, OsiObject **objects)
void deleteObjects ()
 Delete all object information.
void findIntegers (bool justCount)
 Identify integer variables and create corresponding objects.
virtual int findIntegersAndSOS (bool justCount)
 Identify integer variables and SOS and create corresponding objects.
double forceFeasible ()
OsiObjectmodifiableObject (int which) const
 Get the specified object.
int numberObjects () const
 Get the number of objects.
const OsiObjectobject (int which) const
 Get the specified object.
OsiObject ** objects () const
 Get the array of objects.
void setNumberObjects (int number)
 Set the number of objects.
Methods to load a problem


void assignProblem (CoinPackedMatrix *&matrix, double *&collb, double *&colub, double *&obj, double *&rowlb, double *&rowub)
 Load a problem description (OSI packed matrix, row bounds, parameters destroyed).
void assignProblem (CoinPackedMatrix *&matrix, double *&collb, double *&colub, double *&obj, char *&rowsen, double *&rowrhs, double *&rowrng)
 Load a problem description (OSI packed matrix, row sense, parameters destroyed).
void loadProblem (const int colcnt, const int rowcnt, const int *start, const int *index, const double *value, const double *collb, const double *colub, const double *obj, const double *row_lower, const double *row_upper)
 Load a problem description (standard column-major packed matrix, row bounds, parameters unaffected).
void loadProblem (const int colcnt, const int rowcnt, const int *start, const int *index, const double *value, const double *collb, const double *colub, const double *obj, const char *sense, const double *rhsin, const double *range)
 Load a problem description (standard column-major packed matrix, row sense, parameters unaffected).
void loadProblem (const CoinPackedMatrix &matrix, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub)
 Load a problem description (OSI packed matrix, row bounds, parameters unaffected).
void loadProblem (const CoinPackedMatrix &matrix, const double *collb, const double *colub, const double *obj, const char *rowsen, const double *rowrhs, const double *rowrng)
 Load a problem description (OSI packed matrix, row sense, parameters unaffected).
int readMps (const char *filename, const char *extension, int &numberSets, CoinSet **&sets)
 Read a problem description in MPS format from a file, including SOS information.
int readMps (const char *filename, const char *extension="mps")
 Read a problem description in MPS format from a file.
void writeMps (const char *basename, const char *extension="mps", double objsense=0.0) const
 Write the problem into the specified file in MPS format.
OsiSimplexInterface methods
All OsiSimplex methods now moved here

Simplex Interface Abstract Base Class

Abstract Base Class for describing an advanced interface to a simplex solver. When switched on allows great control of simplex iterations. Also allows access to tableau.

virtual bool basisIsAvailable () const
virtual int canDoSimplexInterface () const
virtual void disableFactorization () const
 and stop
virtual void disableSimplexInterface ()
 Undo whatever setting changes the above method had to make.
virtual int dualPivotResult (int &colIn, int &sign, int colOut, int outStatus, double &t, CoinPackedVector *dx)
virtual void enableFactorization () const
virtual void enableSimplexInterface (bool doingPrimal)
virtual void getBasics (int *index) const
virtual void getBasisStatus (int *cstat, int *rstat) const
virtual void getBInvACol (int col, double *vec) const
 Get a column of the tableau.
virtual void getBInvARow (int row, double *z, double *slack=NULL) const
 Get a row of the tableau (slack part in slack if not NULL).
virtual void getBInvCol (int col, double *vec) const
 Get a column of the basis inverse.
virtual void getBInvRow (int row, double *z) const
 Get a row of the basis inverse.
virtual void getReducedGradient (double *columnReducedCosts, double *duals, const double *c)
 Get the reduced gradient for the cost vector c.
bool optimalBasisIsAvailable () const
 Synonym for basisIsAvailable!
virtual int pivot (int colIn, int colOut, int outStatus)
virtual int primalPivotResult (int colIn, int sign, int &colOut, int &outStatus, double &t, CoinPackedVector *dx)
virtual int setBasisStatus (const int *cstat, const int *rstat)
virtual void setObjectiveAndRefresh (double *c)
Unsupported functions


void branchAndBound ()
 Invoke the solver's built-in branch-and-bound algorithm.
std::vector< double * > getDualRays (int) const
 Get as many dual rays as the solver can provide.
std::vector< double * > getPrimalRays (int) const
 Get as many primal rays as the solver can provide.
Constructors and Destructors


OsiSolverInterfaceclone (bool copyData=true) const
 Clone the solver object.
OsiDylpSolverInterfaceoperator= (const OsiDylpSolverInterface &rhs)
 Assignment.
 OsiDylpSolverInterface (const OsiDylpSolverInterface &src)
 Copy constructor.
 OsiDylpSolverInterface ()
 Default constructor.
void reset ()
 Reset the solver object to the state produced by the default constructor.
 ~OsiDylpSolverInterface ()
 Destructor.
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.

const char * columnType (bool refresh=false) const
virtual const char * getColType (bool refresh=false) const
virtual CoinPackedMatrixgetMutableMatrixByCol () const
 Get pointer to mutable column-wise copy of matrix (returns NULL if not meaningful).
virtual CoinPackedMatrixgetMutableMatrixByRow () const
 Get pointer to mutable row-wise copy of matrix (returns NULL if not meaningful).
virtual bool isFreeBinary (int colIndex) const
 Return true if variable is binary and not fixed at either bound.
Parameter set/get methods
The set methods return true if the parameter was set to the given value, false otherwise. When a set method returns false, the original value (if any) should be unchanged. There can be various reasons for failure: the given parameter is not applicable for the solver (e.g., refactorization frequency for the volume algorithm), the parameter is not yet implemented for the solver or simply the value of the parameter is out of the range the solver accepts. If a parameter setting call returns false check the details of your solver.

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

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

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


void copyParameters (OsiSolverInterface &rhs)
virtual bool getHintParam (OsiHintParam key, bool &yesNo) const
virtual bool getHintParam (OsiHintParam key, bool &yesNo, OsiHintStrength &strength) const
double getIntegerTolerance () const
Message handling
See the COIN library documentation for additional information about COIN message facilities.

bool defaultHandler () const
 Return true if default handler.
CoinMessageHandlermessageHandler () const
 Return a pointer to the current message handler.
CoinMessages messages ()
 Return the current set of messages.
CoinMessagesmessagesPointer ()
 Return a pointer to the current set of messages.
virtual void passInMessageHandler (CoinMessageHandler *handler)
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 void deleteColNames (int tgtStart, int len)
 Delete len column names starting at index tgtStart.
virtual void deleteRowNames (int tgtStart, int len)
 Delete len row names starting at index tgtStart.
virtual std::string dfltRowColName (char rc, int ndx, unsigned digits=7) const
 Generate a standard name of the form Rnnnnnnn or Cnnnnnnn.
virtual std::string getColName (int colIndex, unsigned maxLen=static_cast< unsigned >(std::string::npos)) const
 Return the name of the column.
virtual const OsiNameVecgetColNames ()
 Return a pointer to a vector of column names.
virtual std::string getObjName (unsigned maxLen=static_cast< unsigned >(std::string::npos)) const
 Return the name of the objective function.
virtual std::string getRowName (int rowIndex, unsigned maxLen=static_cast< unsigned >(std::string::npos)) const
 Return the name of the row.
virtual const OsiNameVecgetRowNames ()
 Return a pointer to a vector of row names.
virtual void setColNames (OsiNameVec &srcNames, int srcStart, int len, int tgtStart)
 Set multiple column names.
void setRowColNames (CoinLpIO &mod)
 Set row and column names from a CoinLpIO object.
void setRowColNames (CoinModel &mod)
 Set row and column names from a CoinModel object.
void setRowColNames (const CoinMpsIO &mps)
 Set row and column names from a CoinMpsIO object.
virtual void setRowNames (OsiNameVec &srcNames, int srcStart, int len, int tgtStart)
 Set multiple row names.
Dylp-specific methods


void dylp_controlfile (const char *name, const bool silent, const bool mustexist=true)
 Process an options (.spc) file.
void dylp_logfile (const char *name, bool echo=false)
 Establish a log file.
void dylp_outfile (const char *name)
 Establish an output (solution and/or statistics) file.
void dylp_printsoln (bool wantSoln, bool wantStats)
 Print the solution and/or statistics to the output file.
void setOsiDylpMessages (CoinMessages::Language local_language)
 Set the language for messages.
Setting/Accessing application data
void * getApplicationData () const
 Get application data.
OsiAuxInfogetAuxiliaryInfo () const
 Get pointer to auxiliary info object.
void setApplicationData (void *appData)
void setAuxiliaryInfo (OsiAuxInfo *auxiliaryInfo)
Methods to obtain problem information


const double * getColLower () const
 Get the column (variable) lower bound vector.
const double * getColUpper () const
 Get the column (variable) upper bound vector.
const CoinPackedMatrixgetMatrixByCol () const
 Get a pointer to a column-major copy of the constraint matrix.
const CoinPackedMatrixgetMatrixByRow () const
 Get a pointer to a row-major copy of the constraint matrix.
int getNumCols () const
 Get the number of columns (variables).
int getNumElements () const
 Get the number of non-zero coefficients.
int getNumIntegers () const
 Get the number of integer variables.
int getNumRows () const
 Get the number of rows (constraints).
const double * getObjCoefficients () const
 Get the objective function coefficient vector.
double getObjSense () const
 Get the objective function sense (min/max).
const double * getRightHandSide () const
 Get the row (constraint) right-hand-side vector.
const double * getRowLower () const
 Get the row (constraint) lower bound vector.
const double * getRowRange () const
 Get the row (constraint) range vector.
const char * getRowSense () const
 Get the row sense (constraint type) vector.
const double * getRowUpper () const
 Get the row (constraint) upper bound vector.
bool isBinary (int colIndex) const
 Return true if the variable is binary.
bool isContinuous (int colIndex) const
 Return true if the variable is continuous.
bool isInteger (int colIndex) const
 Return true if the variable is integer (general or binary).
bool isIntegerNonBinary (int colIndex) const
 Return true if the variable is general integer.
Methods to obtain solution information


const double * getColSolution () const
 Return the vector of primal variables for the solution.
double getObjValue () const
 Get the objective function value for the solution.
const double * getReducedCost () const
 Return the vector of reduced costs for the solution.
const double * getRowActivity () const
 Return the vector of row activity for the solution.
const double * getRowPrice () const
 Return the vector of dual variables for the solution.
Methods to set/get solver parameters


bool getDblParam (OsiDblParam key, double &value) const
 Get an OSI double parameter.
bool getHintParam (OsiHintParam key, bool &sense, OsiHintStrength &strength, void *&info) const
 Get an OSI hint.
double getInfinity () const
 Get dylp's value for infinity.
bool getIntParam (OsiIntParam key, int &value) const
 Get an OSI integer parameter.
bool getStrParam (OsiStrParam key, std::string &value) const
 Get an OSI string parameter.
void newLanguage (CoinMessages::Language language)
 Change the language for OsiDylp messages.
bool setDblParam (OsiDblParam key, double value)
 Set an OSI double parameter.
bool setHintParam (OsiHintParam key, bool sense=true, OsiHintStrength strength=OsiHintTry, void *info=0)
 Set an OSI hint.
bool setIntParam (OsiIntParam key, int value)
 Set an OSI integer parameter.
void setLanguage (CoinMessages::Language language)
 An alias for OsiDylpSolverInterface::newLanguage.
bool setStrParam (OsiStrParam key, const std::string &value)
 Set an OSI string parameter.
Solve methods


CoinWarmStartgetEmptyWarmStart () const
 Get an empty OsiDylpWarmStartBasis object.
CoinWarmStartgetWarmStart () const
 Build a warm start object for the current lp solution.
void initialSolve ()
 Solve an lp from scratch.
void markHotStart ()
 Create a hot start snapshot.
void resolve ()
 Call dylp to reoptimize (warm start).
bool setWarmStart (const CoinWarmStart *warmStart)
 Apply a warm start object.
void solveFromHotStart ()
 Call dylp to reoptimize (hot start).
void unmarkHotStart ()
 Delete the hot start snapshot.
Solution query methods
virtual OsiVectorInt getFractionalIndices (const double etol=1.e-05) const
const double * getStrictColSolution ()
Methods returning solver termination status


int getIterationCount () const
 Get the number of iterations for the last lp.
bool isAbandoned () const
 True if dylp abandoned the problem.
bool isDualObjectiveLimitReached () const
 Is the dual objective limit reached?
bool isIterationLimitReached () const
 True if dylp reached the iteration limit.
bool isPrimalObjectiveLimitReached () const
 Is the primal objective limit reached?
bool isProvenDualInfeasible () const
 True if dylp reported the problem to be dual infeasible (primal unbounded).
bool isProvenOptimal () const
 True if dylp reported an optimal solution.
bool isProvenPrimalInfeasible () const
 True if dylp reported the problem to be primal infeasible.
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 CoinWarmStartgetPointerToWarmStart (bool &mustDelete)
 Get warm start information.
Methods related to testing generated cuts
const OsiRowCutDebuggergetRowCutDebugger () const
const OsiRowCutDebuggergetRowCutDebuggerAlways () const
 If you want to get debugger object even if not on optimal path then use this.
Methods for problem input and output
virtual int loadFromCoinModel (CoinModel &modelObject, bool keepSolution=false)
 Load a model from a CoinModel object. Return the number of errors encountered.
virtual int readGMPL (const char *filename, const char *dataname=NULL)
 Read a problem in GMPL format from the given filenames.
int readLp (FILE *fp, const double epsilon=1e-5)
virtual int readLp (const char *filename, const double epsilon=1e-5)
virtual void replaceMatrix (const CoinPackedMatrix &)
 And if it does matter (not used at present).
virtual void replaceMatrixOptional (const CoinPackedMatrix &)
virtual void writeLp (FILE *fp, double epsilon=1e-5, int numberAcross=10, int decimals=5, double objSense=0.0, bool useRowNames=true) const
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
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
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
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.
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 int reducedCostFix (double gap, bool justInteger=true)
virtual void setColBounds (int elementIndex, double lower, double upper)
virtual void setColLower (const double *array)
virtual void setColSetBounds (const int *indexFirst, const int *indexLast, const double *boundList)
virtual void setColUpper (const double *array)
virtual void setObjCoeffSet (const int *indexFirst, const int *indexLast, const double *coeffList)
virtual void setObjective (const double *array)
virtual void setRowBounds (int elementIndex, double lower, double upper)
virtual void setRowSetBounds (const int *indexFirst, const int *indexLast, const double *boundList)
virtual void setRowSetTypes (const int *indexFirst, const int *indexLast, const char *senseList, const double *rhsList, const double *rangeList)
Methods for row and column names.
Only the set methods need to be overridden to ensure consistent names between OsiDylp and the OSI base class.

void setColName (int ndx, std::string name)
 Set a column name.
void setObjName (std::string name)
 Set the objective function name.
void setRowName (int ndx, std::string name)
 Set a row name.

Public Attributes

Dylp data structures
These structures contain dylp control options and tolerances.

lpopts_struct * initialSolveOptions
lpopts_struct * resolveOptions
lptols_struct * tolerances

Protected Member Functions

Protected methods
void convertBoundToSense (const double lower, const double upper, char &sense, double &right, double &range) const
void convertSenseToBound (const char sense, const double right, const double range, double &lower, double &upper) const
template<class T>
forceIntoRange (const T value, const T lower, const T upper) const
void setInitialData ()

Protected Attributes

Protected member data
char * columnType_
bool defaultHandler_
CoinMessageHandlerhandler_
 Message handler.
CoinMessages messages_
 Messages.
int numberIntegers_
 Number of integers.
int numberObjects_
 Total number of objects.
OsiObject ** object_
 Integer and ... information (integer info normally at beginning).
OsiRowCutDebuggerrowCutDebugger_
 Pointer to row cut debugger object.

Private Member Functions

Helper functions for problem modification


void add_col (const CoinPackedVectorBase &coin_coli, vartyp_enum vtypi, double vlbi, double vubi, double obji, const std::string *nme)
void add_row (const CoinPackedVectorBase &coin_rowi, char clazzi, contyp_enum ctypi, double rhsi, double rhslowi, const std::string *nme)
contyp_enum bound_to_type (double lower, double upper)
void calc_objval ()
void gen_rowiparms (contyp_enum *ctypi, double *rhsi, double *rhslowi, double rowlbi, double rowubi)
void gen_rowiparms (contyp_enum *ctypi, double *rhsi, double *rhslowi, char sensei, double rhsini, double rangei)
void pessimal_primal ()
void reduceActiveBasis ()
void unimp_hint (bool dylpSense, bool hintSense, OsiHintStrength hintStrength, const char *msgString)
Helper functions for problem construction


void construct_consys (int cols, int rows)
void construct_lpprob ()
void construct_options ()
void dylp_ioinit ()
void gen_rowparms (int rowcnt, double *rhs, double *rhslow, contyp_enum *ctyp, const char *sense, const double *rhsin, const double *range)
void gen_rowparms (int rowcnt, double *rhs, double *rhslow, contyp_enum *ctyp, const double *rowlb, const double *rowub)
void load_problem (const int colcnt, const int rowcnt, const int *start, const int *lens, const int *index, const double *value, const double *col_lower, const double *col_upper, const double *obj, const contyp_enum *ctyp, const double *rhs, const double *rhslow)
void load_problem (const CoinPackedMatrix &matrix, const double *col_lower, const double *col_upper, const double *obj, const contyp_enum *ctyp, const double *rhs, const double *rhslow)
void load_problem (const CoinMpsIO &mps)
Destructor helpers


void destruct_cache (bool rowStructure, bool colStructure)
void destruct_col_cache (bool structure)
void destruct_problem (bool preserve_interface)
void destruct_row_cache (bool structure)
void detach_dylp ()
Helper functions for presolve
Functions used to access the CoinPresolve capabilities. There are no public functions associated with presolve --- the only control is the OsiDoPresolveInInitial and OsiDoPresolveInResolve hints. The functions declared here do the work. See OsiDylpPresolve.cpp for additional explanation.

void destruct_presolve ()
 Delete presolve information.
void doPostsolve ()
 Apply the postsolve transforms from postActions_.
void doPresolve ()
 Perform presolve transformations.
bool evalPresolve ()
 Decide whether presolve was effective enough to use.
CoinPostsolveMatrixinitialisePostsolve (CoinPresolveMatrix *&preObj)
 Create and load a postsolve object.
CoinPresolveMatrixinitialisePresolve (bool keepIntegers)
 Create and load a presolve object.
void installPostsolve ()
 Reload the original constraint system with the postsolved basis.
void installPresolve ()
 Load the presolved problem into the ODSI object.
void saveOriginalSys ()
 Save the original problem.
Helper functions for invoking dylp


lpret_enum do_lp (ODSI_start_enum start)
 Common core method to invoke dylp.

Static Private Member Functions

Copy verification functions
Copy verification functions, to check that two structures are identical.

static void assert_same (const OsiDylpSolverInterface &o1, const OsiDylpSolverInterface &o2, bool exact)
static void assert_same (const lpprob_struct &l1, const lpprob_struct &l2, bool exact)
static void assert_same (const conbnd_struct &c1, const conbnd_struct &c2, bool exact)
static void assert_same (const consys_struct &c1, const consys_struct &c2, bool exact)
static void assert_same (const basis_struct &b1, const basis_struct &b2, bool exact)
static void assert_same (double d1, double d2, bool exact)
template<class T>
static void assert_same (const T *t1, const T *t2, int n, bool exact)
template<class T>
static void assert_same (const T &t1, const T &t2, bool exact)
Copy helpers
Copy function templates for simple vectors and fixed-size objects, and specializations for various complex structures.

template<class T>
static T * copy (const T *src)
template<class T>
static T * copy (const T *src, int n)
template<class T>
static void copy (const T *src, T *dst, int n)
static void copy_basis (const basis_struct *src, basis_struct *dst)
static basis_struct * copy_basis (const basis_struct *src, int dstsze)
static lpprob_struct * copy_lpprob (const lpprob_struct *src)
Vector helper functions


static int idx (int i)
template<class T>
static T * idx_vec (T *data)
static int inv (int i)
template<class T>
static T * inv_vec (T *data)
static void packed_vector (const CoinShallowPackedVector vector, int dimension, pkvec_struct *dst)
static pkvec_struct * packed_vector (const CoinShallowPackedVector vector, int dimension)
File i/o helper routines


static std::string make_filename (const char *filename, const char *ext1, const char *ext2)
Helper functions for problem modification


static contyp_enum sense_to_type (char type)
static char type_to_sense (contyp_enum type)

Private Attributes

Cached problem information
Problem information is cached for efficiency, to avoid repeated reconstruction of OSI structures from dylp structures.

double * _col_cbar
double * _col_obj
double * _col_x
CoinPackedMatrix_matrix_by_col
CoinPackedMatrix_matrix_by_row
double _objval
double * _row_lhs
double * _row_lower
double * _row_price
double * _row_range
double * _row_rhs
char * _row_sense
double * _row_upper
Dylp data structures
These fields hold pointers to the data structures which are used to pass an lp problem to dylp.

consys_struct * consys
lpprob_struct * lpprob
lpstats_struct * statistics
Data for presolve
Data related to the use of the CoinPresolve capabilities (which see for further information).

bool keepIntegers_
 true if presolve should consider integrality
int passLimit_
 Limit for iterations of the major presolve loop.
const CoinPresolveActionpostActions_
 List of postsolve actions.
CoinPostsolveMatrixpostObj_
 The postsolve object.
CoinPresolveMatrixpreObj_
 The presolve object.
double * saved_col_obj
 Saved pointers to cached structural vectors.
CoinPackedMatrixsaved_matrix_by_col
CoinPackedMatrixsaved_matrix_by_row
double * saved_row_lower
double * saved_row_range
double * saved_row_rhs
char * saved_row_sense
double * saved_row_upper
consys_struct * savedConsys_
 Saved copy of original problem.

Static Private Attributes

Dylp residual control variables


static bool basis_ready
 Tracks basis initialisation.
static OsiDylpSolverInterfacedylp_owner
 ODSI instance controlling dylp.
static int reference_count
 Tracks the number of ODSI objects in existence.

Friends

int OsiDylpSolverInterfaceUnitTest (const std::string &mpsDir, const std::string &netLibDir)
 Unit test for OsiDylpSolverInterface.

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

Generated by  Doxygen 1.6.0   Back to index