Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

OsiOslSolverInterface Class Reference

#include <OsiOslSolverInterface.hpp>

Inheritance diagram for OsiOslSolverInterface:

OsiSolverInterface List of all members.

Public Member Functions

virtual void setObjSense (double s)
 Set objective function sense (1 for min (default), -1 for max,).

virtual void setColSolution (const double *colsol)
virtual void setRowPrice (const double *rowprice)
Solve methods
virtual void initialSolve ()
 Solve initial LP relaxation.

virtual void resolve ()
 Resolve an LP relaxation after problem modification.

virtual void branchAndBound ()
 Invoke solver's built-in enumeration algorithm.

Parameter set/get methods
The set methods return true if the parameter was set to the given value, false otherwise. 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.

bool setIntParam (OsiIntParam key, int value)
bool setDblParam (OsiDblParam key, double value)
bool setStrParam (OsiStrParam key, const std::string &value)
bool getIntParam (OsiIntParam key, int &value) const
bool getDblParam (OsiDblParam key, double &value) const
bool getStrParam (OsiStrParam key, std::string &value) const
Methods returning info on how the solution process terminated
virtual bool isAbandoned () const
 Are there a numerical difficulties?

virtual bool isProvenOptimal () const
 Is optimality proven?

virtual bool isProvenPrimalInfeasible () const
 Is primal infeasiblity proven?

virtual bool isProvenDualInfeasible () const
 Is dual infeasiblity proven?

virtual bool isPrimalObjectiveLimitReached () const
 Is the given primal objective limit reached?

virtual bool isDualObjectiveLimitReached () const
 Is the given dual objective limit reached?

virtual bool isIterationLimitReached () const
 Iteration limit reached?

WarmStart related methods
CoinWarmStartgetEmptyWarmStart () const
 Get empty warm start object.

virtual CoinWarmStartgetWarmStart () const
 Get warmstarting information.

virtual bool setWarmStart (const CoinWarmStart *warmstart)
Hotstart related methods (primarily used in strong branching). <br>
The user can create a hotstart (a snapshot) of the optimization process then reoptimize over and over again always starting from there.
NOTE: between hotstarted optimizations only bound changes are allowed.

virtual void markHotStart ()
 Create a hotstart point of the optimization process.

virtual void solveFromHotStart ()
 Optimize starting from the hotstart.

virtual void unmarkHotStart ()
 Delete the snapshot.

Methods related to querying the input data
virtual int getNumCols () const
 Get number of columns.

virtual int getNumRows () const
 Get number of rows.

virtual int getNumElements () const
 Get number of nonzero elements.

virtual const double * getColLower () const
 Get pointer to array[getNumCols()] of column lower bounds.

virtual const double * getColUpper () const
 Get pointer to array[getNumCols()] of column upper bounds.

virtual const char * getRowSense () const
virtual const double * getRightHandSide () const
virtual const double * getRowRange () const
virtual const double * getRowLower () const
 Get pointer to array[getNumRows()] of row lower bounds.

virtual const double * getRowUpper () const
 Get pointer to array[getNumRows()] of row upper bounds.

virtual const double * getObjCoefficients () const
 Get pointer to array[getNumCols()] of objective function coefficients.

virtual double getObjSense () const
 Get objective function sense (1 for min (default), -1 for max).

virtual bool isContinuous (int colNumber) const
 Return true if column is continuous.

virtual const CoinPackedMatrix * getMatrixByRow () const
 Get pointer to row-wise copy of matrix.

virtual const CoinPackedMatrix * getMatrixByCol () const
 Get pointer to column-wise copy of matrix.

virtual double getInfinity () const
 Get solver's value for infinity.

Methods related to querying the solution
virtual const double * getColSolution () const
 Get pointer to array[getNumCols()] of primal solution vector.

virtual const double * getRowPrice () const
 Get pointer to array[getNumRows()] of dual prices.

virtual const double * getReducedCost () const
 Get a pointer to array[getNumCols()] of reduced costs.

virtual const double * getRowActivity () const
virtual double getObjValue () const
 Get objective function value.

virtual int getIterationCount () const
virtual std::vector< double * > getDualRays (int maxNumRays) const
virtual std::vector< double * > getPrimalRays (int maxNumRays) const
Changing bounds on variables and constraints
virtual void setObjCoeff (int elementIndex, double elementValue)
virtual void setColLower (int elementIndex, double elementValue)
virtual void setColUpper (int elementIndex, double elementValue)
virtual void setColSetBounds (const int *indexFirst, const int *indexLast, const double *boundList)
virtual void setRowLower (int elementIndex, double elementValue)
virtual void setRowUpper (int elementIndex, double elementValue)
virtual void setRowBounds (int elementIndex, double lower, double upper)
virtual void setRowType (int index, char sense, double rightHandSide, double range)
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)
Integrality related changing methods
virtual void setContinuous (int index)
virtual void setInteger (int index)
virtual void setContinuous (const int *indices, int len)
virtual void setInteger (const int *indices, int len)
Methods to expand a problem.<br>
Note that if a column is added then by default it will correspond to a continuous variable.

virtual void addCol (const CoinPackedVectorBase &vec, 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 deleteCols (const int num, const int *colIndices)
virtual void addRow (const CoinPackedVectorBase &vec, const double rowlb, const double rowub)
virtual void addRow (const CoinPackedVectorBase &vec, 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 void addRows (const int numrows, const CoinPackedVectorBase *const *rows, const char *rowsen, const double *rowrhs, const double *rowrng)
virtual void deleteRows (const int num, const int *rowIndices)
Methods to input a problem
virtual void loadProblem (const CoinPackedMatrix &matrix, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub)
virtual void assignProblem (CoinPackedMatrix *&matrix, double *&collb, double *&colub, double *&obj, double *&rowlb, double *&rowub)
virtual void loadProblem (const CoinPackedMatrix &matrix, const double *collb, const double *colub, const double *obj, const char *rowsen, const double *rowrhs, const double *rowrng)
virtual void assignProblem (CoinPackedMatrix *&matrix, double *&collb, double *&colub, double *&obj, char *&rowsen, double *&rowrhs, double *&rowrng)
virtual void loadProblem (const int numcols, const int numrows, const int *start, const int *index, const double *value, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub)
virtual void loadProblem (const int numcols, const int numrows, const int *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)
virtual int readMps (const char *filename, const char *extension="mps")
virtual void writeMps (const char *filename, const char *extension="mps", double objSense=0.0) const
OSL specific public interfaces
EKKModel * getModelPtr ()
 Get pointer to OSL model.

Constructors and destructors
 OsiOslSolverInterface ()
 Default Constructor.

virtual OsiSolverInterfaceclone (bool copyData=true) const
 Clone.

 OsiOslSolverInterface (const OsiOslSolverInterface &)
 Copy constructor.

OsiOslSolverInterfaceoperator= (const OsiOslSolverInterface &rhs)
 Assignment operator.

virtual ~OsiOslSolverInterface ()
 Destructor.

virtual void reset ()
 Resets as if default constructor.


Static Public Member Functions

Static instance counter methods
void incrementInstanceCounter ()
void decrementInstanceCounter ()
unsigned int getNumInstances ()

Protected Member Functions

Protected methods
virtual void applyRowCut (const OsiRowCut &rc)
virtual void applyColCut (const OsiColCut &cc)

Private Member Functions

Private methods
EKKModel * getMutableModelPtr () const
void gutsOfDestructor ()
 The real work of a copy constructor (used by copy and assignment).

void freeCachedResults ()
 The real work of a destructor (used by copy and assignment).

void extractSenseRhsRange () const
 A method that fills up the rowsense_, rhs_ and rowrange_ arrays.


Static Private Member Functions

Private static class functions
EKKContext * getContextPtr ()
 Method to access OSL context pointer.


Private Attributes

Private member data
EKKModel * modelPtr_
 OSL model represented by this class instance.

Cached information derived from the OSL model
char * rowsense_
 Pointer to dense vector of row sense indicators.

double * rhs_
 Pointer to dense vector of row right-hand side values.

double * rowrange_
CoinWarmStartBasisws_
int itlimOrig_
CoinPackedMatrix * matrixByRow_
 Pointer to row-wise copy of problem matrix coefficients.

CoinPackedMatrix * matrixByColumn_
 Pointer to column-wise copy of problem matrix coefficients.


Static Private Attributes

Private static class data
EKKContext * contextPtr_ = NULL
 OSL context pointer.

unsigned int numInstances_ = 0
 Number of live problem instances.


Friends

void OsiOslSolverInterfaceUnitTest (const std::string &mpsDir, const std::string &netlibDir)

Detailed Description

OSL Solver Interface

Instantiation of OsiOslSolverInterface for OSL

Definition at line 25 of file OsiOslSolverInterface.hpp.


Member Function Documentation

void OsiOslSolverInterface::addCol const CoinPackedVectorBase vec,
const double  collb,
const double  colub,
const double  obj
[virtual]
 

Add a column (primal variable) to the problem.

Implements OsiSolverInterface.

Definition at line 1130 of file OsiOslSolverInterface.cpp.

References CoinPackedVectorBase::getElements(), CoinPackedVectorBase::getIndices(), getModelPtr(), and CoinPackedVectorBase::getNumElements().

01133 {
01134   // *TEST*
01135   ekk_addOneColumn(getModelPtr(), obj, collb, colub,
01136                    vec.getNumElements(), vec.getIndices(), vec.getElements());
01137 }

void OsiOslSolverInterface::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 from OsiSolverInterface.

Definition at line 1140 of file OsiOslSolverInterface.cpp.

References CoinPackedVectorBase::getElements(), CoinPackedVectorBase::getIndices(), getModelPtr(), and CoinPackedVectorBase::getNumElements().

01144 {
01145   // *TEST*
01146   int i;
01147   int nz = 0;
01148   for (i = 0; i < numcols; ++i)
01149     nz += cols[i]->getNumElements();
01150 
01151   int* index = new int[nz];
01152   double* elem = new double[nz];
01153   int* start = new int[numcols+1];
01154 
01155   nz = 0;
01156   start[0] = 0;
01157   for (i = 0; i < numcols; ++i) {
01158     const CoinPackedVectorBase* col = cols[i];
01159     const int len = col->getNumElements();
01160     CoinDisjointCopyN(col->getIndices(), len, index+nz);
01161     CoinDisjointCopyN(col->getElements(), len, elem+nz);
01162     nz += len;
01163     start[i+1] = nz;
01164   }
01165   ekk_addColumns(getModelPtr(), numcols, obj, collb, colub,
01166                  start, index, elem);
01167   delete[] start;
01168   delete[] elem;
01169   delete[] index;
01170 }

void OsiOslSolverInterface::addRow const CoinPackedVectorBase vec,
const double  rowlb,
const double  rowub
[virtual]
 

Add a row (constraint) to the problem.

Implements OsiSolverInterface.

Definition at line 1180 of file OsiOslSolverInterface.cpp.

References CoinPackedVectorBase::getElements(), CoinPackedVectorBase::getIndices(), getModelPtr(), and CoinPackedVectorBase::getNumElements().

01182 {
01183   // *TEST*
01184   ekk_addOneRow(getModelPtr(), rowlb, rowub,
01185                 vec.getNumElements(), vec.getIndices(), vec.getElements());
01186 }

void OsiOslSolverInterface::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 from OsiSolverInterface.

Definition at line 1232 of file OsiOslSolverInterface.cpp.

References OsiSolverInterface::convertSenseToBound(), CoinPackedVectorBase::getElements(), CoinPackedVectorBase::getIndices(), getModelPtr(), and CoinPackedVectorBase::getNumElements().

01236 {
01237   // *TEST*
01238   int i;
01239   int nz = 0;
01240   for (i = 0; i < numrows; ++i)
01241     nz += rows[i]->getNumElements();
01242 
01243   int* index = new int[nz];
01244   double* elem = new double[nz];
01245   int* start = new int[numrows+1];
01246   double* rowlb = new double[numrows];
01247   double* rowub = new double[numrows];
01248 
01249   nz = 0;
01250   start[0] = 0;
01251   for (i = 0; i < numrows; ++i) {
01252     convertSenseToBound(rowsen[i], rowrhs[i], rowrng[i], rowlb[i], rowub[i]);
01253     const CoinPackedVectorBase* row = rows[i];
01254     const int len = row->getNumElements();
01255     CoinDisjointCopyN(row->getIndices(), len, index+nz);
01256     CoinDisjointCopyN(row->getElements(), len, elem+nz);
01257     nz += len;
01258     start[i+1] = nz;
01259   }
01260   ekk_addRows(getModelPtr(), numrows, rowlb, rowub, start, index, elem);
01261   delete[] rowub;
01262   delete[] rowlb;
01263   delete[] start;
01264   delete[] elem;
01265   delete[] index;
01266 }

void OsiOslSolverInterface::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 from OsiSolverInterface.

Definition at line 1201 of file OsiOslSolverInterface.cpp.

References CoinPackedVectorBase::getElements(), CoinPackedVectorBase::getIndices(), getModelPtr(), and CoinPackedVectorBase::getNumElements().

01204 {
01205   // *TEST*
01206   int i;
01207   int nz = 0;
01208   for (i = 0; i < numrows; ++i)
01209     nz += rows[i]->getNumElements();
01210 
01211   int* index = new int[nz];
01212   double* elem = new double[nz];
01213   int* start = new int[numrows+1];
01214 
01215   nz = 0;
01216   start[0] = 0;
01217   for (i = 0; i < numrows; ++i) {
01218     const CoinPackedVectorBase* row = rows[i];
01219     const int len = row->getNumElements();
01220     CoinDisjointCopyN(row->getIndices(), len, index+nz);
01221     CoinDisjointCopyN(row->getElements(), len, elem+nz);
01222     nz += len;
01223     start[i+1] = nz;
01224   }
01225   ekk_addRows(getModelPtr(), numrows, rowlb, rowub, start, index, elem);
01226   delete[] start;
01227   delete[] elem;
01228   delete[] index;
01229 }

void OsiOslSolverInterface::applyColCut const OsiColCut cc  )  [protected, virtual]
 

Apply a column cut (adjust one or more bounds).

Implements OsiSolverInterface.

Definition at line 1584 of file OsiOslSolverInterface.cpp.

References CoinPackedVector::getElements(), CoinPackedVector::getIndices(), getModelPtr(), CoinPackedVector::getNumElements(), OsiColCut::lbs(), and OsiColCut::ubs().

01585 {
01586   EKKModel * m = getModelPtr();
01587   const double * oslColLB = ekk_collower(m);
01588   const double * oslColUB = ekk_colupper(m);
01589   const CoinPackedVector & lbs = cc.lbs();
01590   const CoinPackedVector & ubs = cc.ubs();
01591   int i;
01592 
01593   for ( i=0; i<lbs.getNumElements(); i++ ) {
01594     if ( lbs.getElements()[i] > oslColLB[lbs.getIndices()[i]] )
01595        //oslColLB[lbs.getIndices()[i]] = lbs.getElements()[i];
01596        ekk_copyCollower(m, &(lbs.getElements()[i]),
01597                         lbs.getIndices()[i],lbs.getIndices()[i]+1);
01598   }
01599   for ( i=0; i<ubs.getNumElements(); i++ ) {
01600     if ( ubs.getElements()[i] < oslColUB[ubs.getIndices()[i]] )
01601       // oslColUB[ubs.getIndices()[i]] = ubs.getElements()[i];
01602       ekk_copyColupper(m, &(ubs.getElements()[i]),
01603                        ubs.getIndices()[i],ubs.getIndices()[i]+1);
01604   }
01605 }

void OsiOslSolverInterface::applyRowCut const OsiRowCut rc  )  [protected, virtual]
 

Apply a row cut (append to constraint matrix).

Implements OsiSolverInterface.

Definition at line 1574 of file OsiOslSolverInterface.cpp.

References CoinPackedVector::getElements(), CoinPackedVector::getIndices(), getModelPtr(), CoinPackedVector::getNumElements(), OsiRowCut::lb(), OsiRowCut::row(), and OsiRowCut::ub().

01575 {
01576   EKKModel * m = getModelPtr();
01577   const CoinPackedVector & row=rowCut.row();
01578   ekk_addOneRow(m, rowCut.lb(),rowCut.ub(),
01579                 row.getNumElements(),row.getIndices(),row.getElements() ); 
01580 }

void OsiOslSolverInterface::assignProblem CoinPackedMatrix *&  matrix,
double *&  collb,
double *&  colub,
double *&  obj,
char *&  rowsen,
double *&  rowrhs,
double *&  rowrng
[virtual]
 

Load in an problem by assuming ownership of the arguments (the constraints on the rows are given by sense/rhs/range triplets). For default values see the previous method.
WARNING: The arguments passed to this method will be freed using the C++ delete and delete[] functions.

Implements OsiSolverInterface.

Definition at line 1330 of file OsiOslSolverInterface.cpp.

References loadProblem().

01335 {
01336    loadProblem(*matrix, collb, colub, obj, rowsen, rowrhs, rowrng);
01337    delete matrix;   matrix = 0;
01338    delete[] collb;  collb = 0;
01339    delete[] colub;  colub = 0;
01340    delete[] obj;    obj = 0;
01341    delete[] rowsen; rowsen = 0;
01342    delete[] rowrhs; rowrhs = 0;
01343    delete[] rowrng; rowrng = 0;
01344 }

void OsiOslSolverInterface::assignProblem CoinPackedMatrix *&  matrix,
double *&  collb,
double *&  colub,
double *&  obj,
double *&  rowlb,
double *&  rowub
[virtual]
 

Load in an problem by assuming ownership of the arguments (the constraints on the rows are given by lower and upper bounds). For default values see the previous method.
WARNING: The arguments passed to this method will be freed using the C++ delete and delete[] functions.

Implements OsiSolverInterface.

Definition at line 1296 of file OsiOslSolverInterface.cpp.

References loadProblem().

01300 {
01301    loadProblem(*matrix, collb, colub, obj, rowlb, rowub);
01302    delete matrix;   matrix = 0;
01303    delete[] collb;  collb = 0;
01304    delete[] colub;  colub = 0;
01305    delete[] obj;    obj = 0;
01306    delete[] rowlb;  rowlb = 0;
01307    delete[] rowub;  rowub = 0;
01308 }

void OsiOslSolverInterface::decrementInstanceCounter  )  [static]
 

OSL has a context that should be deleted after OSL calls. This method:

  • Decrements by 1 the number of uses of the OSL environment.
  • Deletes the OSL context when the number of uses is change to 0 from 1.

Definition at line 1452 of file OsiOslSolverInterface.cpp.

References contextPtr_, getNumInstances(), and numInstances_.

Referenced by ~OsiOslSolverInterface().

01453 {
01454   assert( getNumInstances() != 0 );
01455   numInstances_--;
01456   if ( numInstances_ == 0 ) {
01457     //FILE * oslMesgFile =
01458     //   ekk_getLogfileFilePointer(ekk_baseModel(contextPtr_));
01459     //fclose(oslMesgFile);
01460     ekk_endContext(contextPtr_);
01461     contextPtr_ = NULL;
01462   }
01463 }

void OsiOslSolverInterface::deleteCols const int  num,
const int *  colIndices
[virtual]
 

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

Implements OsiSolverInterface.

Definition at line 1173 of file OsiOslSolverInterface.cpp.

References getModelPtr().

01174 {
01175   // *TEST*
01176   ekk_deleteColumns(getModelPtr(), num, columnIndices);
01177 }

void OsiOslSolverInterface::deleteRows const int  num,
const int *  rowIndices
[virtual]
 

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

Implements OsiSolverInterface.

Definition at line 1269 of file OsiOslSolverInterface.cpp.

References getModelPtr().

01270 {
01271   // *TEST*
01272   ekk_deleteRows(getModelPtr(), num, rowIndices);
01273 }

std::vector< double * > OsiOslSolverInterface::getDualRays int  maxNumRays  )  const [virtual]
 

Get as many dual rays as the solver can provide. (In case of proven primal infeasibility there should be at least one.)

NOTE for implementers of solver interfaces:
The double pointers in the vector should point to arrays of length getNumRows() and they should be allocated via new[].

NOTE for users of solver interfaces:
It is the user's responsibility to free the double pointers in the vector using delete[].

Implements OsiSolverInterface.

Definition at line 796 of file OsiOslSolverInterface.cpp.

References getMutableModelPtr(), and getNumRows().

00797 {
00798   const int m = getNumRows();
00799   double* ray = new double[m];
00800   const double* negray = ekk_rowaux(getMutableModelPtr());
00801   for (int i = 0; i < m; ++i) {
00802      ray[i] = -negray[i];
00803   }
00804   return std::vector<double*>(1, ray);
00805 }

int OsiOslSolverInterface::getIterationCount  )  const [virtual]
 

Get how many iterations it took to solve the problem (whatever "iteration" mean to the solver.

Implements OsiSolverInterface.

Definition at line 791 of file OsiOslSolverInterface.cpp.

References getMutableModelPtr().

00792 {
00793   return ekk_getIiternum(getMutableModelPtr());
00794 }

EKKModel * OsiOslSolverInterface::getMutableModelPtr  )  const [private]
 

Model pointer for models that are changed in benign ways or not at all. This method is used to obtain the EKKModel* in const member functions.

Definition at line 1634 of file OsiOslSolverInterface.cpp.

References getContextPtr(), and modelPtr_.

Referenced by branchAndBound(), extractSenseRhsRange(), getColLower(), getColSolution(), getColUpper(), getDualRays(), getIterationCount(), getMatrixByCol(), getMatrixByRow(), getModelPtr(), getNumCols(), getNumElements(), getNumRows(), getObjCoefficients(), getObjSense(), getObjValue(), getPrimalRays(), getReducedCost(), getRowActivity(), getRowLower(), getRowPrice(), getRowUpper(), getWarmStart(), initialSolve(), isAbandoned(), isContinuous(), isDualObjectiveLimitReached(), isIterationLimitReached(), isPrimalObjectiveLimitReached(), isProvenDualInfeasible(), isProvenOptimal(), isProvenPrimalInfeasible(), loadProblem(), resolve(), setColLower(), setColSetBounds(), setColSolution(), setColUpper(), setContinuous(), setInteger(), setObjCoeff(), setObjSense(), setRowBounds(), setRowLower(), setRowPrice(), setRowSetBounds(), setRowSetTypes(), setRowUpper(), setWarmStart(), solveFromHotStart(), unmarkHotStart(), and writeMps().

01635 {
01636   if ( modelPtr_ == NULL ) {
01637     modelPtr_ = ekk_newModel(getContextPtr(),NULL);
01638   }
01639   return modelPtr_;
01640 }

unsigned int OsiOslSolverInterface::getNumInstances  )  [static]
 

Return the number of instances of instantiated objects using OSL services.

Definition at line 1467 of file OsiOslSolverInterface.cpp.

References numInstances_.

Referenced by decrementInstanceCounter().

01468 {
01469   return numInstances_;
01470 }

std::vector< double * > OsiOslSolverInterface::getPrimalRays int  maxNumRays  )  const [virtual]
 

Get as many primal rays as the solver can provide. (In case of proven dual infeasibility there should be at least one.)

NOTE for implementers of solver interfaces:
The double pointers in the vector should point to arrays of length getNumCols() and they should be allocated via new[].

NOTE for users of solver interfaces:
It is the user's responsibility to free the double pointers in the vector using delete[].

Implements OsiSolverInterface.

Definition at line 807 of file OsiOslSolverInterface.cpp.

References getMutableModelPtr(), and getNumCols().

00808 {
00809   const int n = getNumCols();
00810   double* ray = new double[n];
00811   CoinDisjointCopyN(ekk_colaux(getMutableModelPtr()), n, ray);
00812   return std::vector<double*>(1, ray);
00813 }

const double * OsiOslSolverInterface::getRightHandSide  )  const [virtual]
 

Get pointer to array[getNumRows()] of rows right-hand sides

  • if rowsense()[i] == 'L' then rhs()[i] == rowupper()[i]
  • if rowsense()[i] == 'G' then rhs()[i] == rowlower()[i]
  • if rowsense()[i] == 'R' then rhs()[i] == rowupper()[i]
  • if rowsense()[i] == 'N' then rhs()[i] == 0.0

Implements OsiSolverInterface.

Definition at line 622 of file OsiOslSolverInterface.cpp.

References extractSenseRhsRange(), and rhs_.

00623 {
00624   extractSenseRhsRange();
00625   return rhs_;
00626 }

const double * OsiOslSolverInterface::getRowActivity  )  const [virtual]
 

Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vector

Implements OsiSolverInterface.

Definition at line 774 of file OsiOslSolverInterface.cpp.

References getMutableModelPtr().

00775 {
00776   // *TEST*
00777   return ekk_rowacts(getMutableModelPtr());
00778 }

const double * OsiOslSolverInterface::getRowRange  )  const [virtual]
 

Get pointer to array[getNumRows()] of row ranges.

  • if rowsense()[i] == 'R' then rowrange()[i] == rowupper()[i] - rowlower()[i]
  • if rowsense()[i] != 'R' then rowrange()[i] is 0.0

Implements OsiSolverInterface.

Definition at line 628 of file OsiOslSolverInterface.cpp.

References extractSenseRhsRange(), and rowrange_.

00629 {
00630   extractSenseRhsRange();
00631   return rowrange_;
00632 }

const char * OsiOslSolverInterface::getRowSense  )  const [virtual]
 

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

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

Implements OsiSolverInterface.

Definition at line 616 of file OsiOslSolverInterface.cpp.

References extractSenseRhsRange(), and rowsense_.

00617 {
00618   extractSenseRhsRange();
00619   return rowsense_;
00620 }

void OsiOslSolverInterface::incrementInstanceCounter  )  [static]
 

OSL has a context that must be created prior to all other OSL calls. This method:

  • Increments by 1 the number of uses of the OSL environment.
  • Creates the OSL context when the number of uses is change to 1 from 0.

Definition at line 1437 of file OsiOslSolverInterface.cpp.

References contextPtr_, and numInstances_.

Referenced by OsiOslSolverInterface().

01438 {
01439   if ( numInstances_ == 0 ) {
01440     contextPtr_ = ekk_initializeContext();
01441     assert( contextPtr_ != NULL );    
01442     ekk_messagesPrintOff(ekk_baseModel(contextPtr_), 1, 5999);
01443     //FILE *oslMesgFILE = fopen("osl.log","a+");    
01444     //ekk_setLogfileFilePointer(ekk_baseModel(contextPtr_),stderr );    
01445     //ekk_messagesPrintOn(NULL ,1,2999);
01446   }
01447   numInstances_++;
01448 }

void OsiOslSolverInterface::loadProblem const int  numcols,
const int  numrows,
const int *  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
[virtual]
 

Just like the other loadProblem() methods except that the matrix is given in a standard column major ordered format (without gaps).

Implements OsiSolverInterface.

Definition at line 1368 of file OsiOslSolverInterface.cpp.

References OsiSolverInterface::convertSenseToBound(), freeCachedResults(), and getMutableModelPtr().

01375 {
01376    assert( rowsen != NULL );
01377    assert( rowrhs != NULL );
01378    double * rowlb = new double[numrows];
01379    double * rowub = new double[numrows];
01380    for (int i = numrows-1; i >= 0; --i) {   
01381       convertSenseToBound(rowsen[i],rowrhs[i],rowrng[i],rowlb[i],rowub[i]);
01382    }
01383    // Use getMutableModelPtr(), so that the cached stuff is not immediately
01384    // deleted.
01385    ekk_loadRimModel(getMutableModelPtr(),
01386                     numrows, rowlb, rowub, numcols, obj, collb, colub);
01387    ekk_addColumnElementBlock(getMutableModelPtr(),
01388                              numcols, index, start, value);
01389    // Now we can free the cached results
01390    freeCachedResults();
01391    delete[] rowlb;
01392    delete[] rowub;
01393 }

void OsiOslSolverInterface::loadProblem const int  numcols,
const int  numrows,
const int *  start,
const int *  index,
const double *  value,
const double *  collb,
const double *  colub,
const double *  obj,
const double *  rowlb,
const double *  rowub
[virtual]
 

Just like the other loadProblem() methods except that the matrix is given in a standard column major ordered format (without gaps).

Implements OsiSolverInterface.

Definition at line 1349 of file OsiOslSolverInterface.cpp.

References freeCachedResults(), and getMutableModelPtr().

01355 {
01356    // Use getMutableModelPtr(), so that the cached stuff is not immediately
01357    // deleted.
01358    ekk_loadRimModel(getMutableModelPtr(),
01359                     numrows, rowlb, rowub, numcols, obj, collb, colub);
01360    ekk_addColumnElementBlock(getMutableModelPtr(),
01361                              numcols, index, start, value);
01362    // Now we can free the cached results
01363    freeCachedResults();
01364 }

void OsiOslSolverInterface::loadProblem const CoinPackedMatrix &  matrix,
const double *  collb,
const double *  colub,
const double *  obj,
const char *  rowsen,
const double *  rowrhs,
const double *  rowrng
[virtual]
 

Load in an 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

Implements OsiSolverInterface.

Definition at line 1313 of file OsiOslSolverInterface.cpp.

References loadProblem().

01318 {
01319    const CoinPackedMatrix * m = toColumnOrderedGapFree(matrix);
01320    loadProblem(m->getNumCols(), m->getNumRows(),
01321                m->getVectorStarts(), m->getIndices(), m->getElements(),
01322                collb, colub, obj, rowsen, rowrhs, rowrng);
01323    if (m != &matrix)
01324       delete m;
01325 }

void OsiOslSolverInterface::loadProblem const CoinPackedMatrix &  matrix,
const double *  collb,
const double *  colub,
const double *  obj,
const double *  rowlb,
const double *  rowub
[virtual]
 

Load in an 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

Implements OsiSolverInterface.

Definition at line 1280 of file OsiOslSolverInterface.cpp.

Referenced by assignProblem(), and loadProblem().

01284 {
01285    const CoinPackedMatrix * m = toColumnOrderedGapFree(matrix);
01286    loadProblem(m->getNumCols(), m->getNumRows(),
01287                m->getVectorStarts(), m->getIndices(), m->getElements(),
01288                collb, colub, obj, rowlb, rowub);
01289    if (m != &matrix)
01290       delete m;
01291 }

int OsiOslSolverInterface::readMps const char *  filename,
const char *  extension = "mps"
[virtual]
 

Read an mps file from the given filename - returns number of errors (see OsiMpsReader class)

Reimplemented from OsiSolverInterface.

Definition at line 1399 of file OsiOslSolverInterface.cpp.

References OsiSolverInterface::readMps().

01401 {
01402    return OsiSolverInterface::readMps(filename, extension);
01403 }

void OsiOslSolverInterface::setColLower int  elementIndex,
double  elementValue
[virtual]
 

Set a single column lower bound
Use -DBL_MAX for -infinity.

Implements OsiSolverInterface.

Definition at line 849 of file OsiOslSolverInterface.cpp.

References OsiSolverInterface::forceIntoRange(), and getMutableModelPtr().

00850 {
00851   // *TEST*
00852   EKKModel* model = getMutableModelPtr();
00853   const double newVal =
00854     forceIntoRange(elementValue, -OSL_INFINITY, OSL_INFINITY);
00855   ekk_copyCollower(model, &newVal, elementIndex, elementIndex+1 );
00856 }

void OsiOslSolverInterface::setColSetBounds const int *  indexFirst,
const int *  indexLast,
const double *  boundList
[virtual]
 

Set the bounds on a number of columns simultaneously
The default implementation just invokes setColLower() and setColUpper() over and over again.

Parameters:
indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the variables whose either bound changes
boundList the new lower/upper bound pairs for the variables

Reimplemented from OsiSolverInterface.

Definition at line 868 of file OsiOslSolverInterface.cpp.

References OsiSolverInterface::forceIntoRange(), getMutableModelPtr(), getNumCols(), and OsiSolverInterface::setColBounds().

00871 {
00872   // *TEST*
00873   const int numcols = getNumCols();
00874   if (indexLast - indexFirst < numcols/8) {
00875     // It's probably more effective to invoke setColBounds() iteratively
00876     while (indexFirst != indexLast) {
00877       setColBounds(*indexFirst, boundList[0], boundList[1]);
00878       ++indexFirst;
00879       boundList += 2;
00880     }
00881   } else {
00882     // probably faster to set everything at once
00883     EKKModel* model = getMutableModelPtr();
00884     double * lower = ekk_getCollower(model);
00885     double * upper = ekk_getColupper(model);
00886     while (indexFirst != indexLast) {
00887       const int iCol=*indexFirst++;
00888       lower[iCol]= forceIntoRange(*boundList++, -OSL_INFINITY, OSL_INFINITY);
00889       upper[iCol]= forceIntoRange(*boundList++, -OSL_INFINITY, OSL_INFINITY);
00890     }
00891     ekk_setCollower(model, lower);
00892     ekk_setColupper(model, upper);
00893     ekk_free(lower);
00894     ekk_free(upper);
00895   }
00896 }

void OsiOslSolverInterface::setColSolution const double *  colsol  )  [virtual]
 

Set the primal solution column values

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

Implements OsiSolverInterface.

Definition at line 1114 of file OsiOslSolverInterface.cpp.

References getMutableModelPtr().

01115 {
01116   EKKModel * m = getMutableModelPtr();
01117   ekk_copyColsol(m,cs,0,ekk_getInumcols(m));
01118 }

void OsiOslSolverInterface::setColUpper int  elementIndex,
double  elementValue
[virtual]
 

Set a single column upper bound
Use DBL_MAX for infinity.

Implements OsiSolverInterface.

Definition at line 859 of file OsiOslSolverInterface.cpp.

References OsiSolverInterface::forceIntoRange(), and getMutableModelPtr().

00860 {
00861   // *TEST*
00862   EKKModel* model = getMutableModelPtr();
00863   const double newVal =
00864     forceIntoRange(elementValue, -OSL_INFINITY, OSL_INFINITY);
00865   ekk_copyColupper(model, &newVal, elementIndex, elementIndex+1 );
00866 }

void OsiOslSolverInterface::setContinuous const int *  indices,
int  len
[virtual]
 

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

Reimplemented from OsiSolverInterface.

Definition at line 1078 of file OsiOslSolverInterface.cpp.

References getMutableModelPtr().

01079 {
01080   // *FIXME*: This is really painful, but this is the only way...
01081   EKKModel* model = getMutableModelPtr();
01082   int intnum = ekk_getInumints(model);
01083   if (intnum > 0 && len > 0) {
01084     int * intlist = ekk_listOfIntegers(model);
01085     int * sorted = new int[len];
01086     CoinDisjointCopyN(indices, len, sorted);
01087     std::sort(sorted, sorted+len);
01088     int * diff = new int[intnum];
01089     int numdiff = std::set_difference(intlist, intlist+intnum,
01090                                       indices, indices+len, diff) - diff;
01091     if (numdiff < intnum) {
01092       ekk_deleteIntegerInformation(model);
01093       if (numdiff > 0) {
01094         ekk_addIntegerSet(model, 100, numdiff, diff, NULL, NULL);
01095       }
01096     }
01097     delete[] diff;
01098     delete[] sorted;
01099     ekk_free(intlist);
01100   }
01101 }

void OsiOslSolverInterface::setContinuous int  index  )  [virtual]
 

Set the index-th variable to be a continuous variable

Implements OsiSolverInterface.

Definition at line 1051 of file OsiOslSolverInterface.cpp.

References getMutableModelPtr().

01052 {
01053   // *FIXME*: This is really painful, but this is the only way...
01054   EKKModel* model = getMutableModelPtr();
01055   int intnum = ekk_getInumints(model);
01056   if (intnum > 0) {
01057     int * intlist = ekk_listOfIntegers(model);
01058     int * inspoint = std::lower_bound(intlist, intlist + intnum, index);
01059     if (*inspoint == index) {
01060       ekk_deleteIntegerInformation(model);
01061       if (intnum > 1) {
01062         // *inspoint = intlist[intnum - 1];
01063         CoinCopy(inspoint + 1, intlist + intnum, inspoint);
01064         ekk_addIntegerSet(model, 100, intnum - 1, intlist, NULL, NULL);
01065       }
01066     }
01067     ekk_free(intlist);
01068   }
01069 }

void OsiOslSolverInterface::setInteger const int *  indices,
int  len
[virtual]
 

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

Reimplemented from OsiSolverInterface.

Definition at line 1104 of file OsiOslSolverInterface.cpp.

References getMutableModelPtr().

01105 {
01106   ekk_addIntegerSet(getMutableModelPtr(), 100, len, indices, NULL, NULL);
01107 }

void OsiOslSolverInterface::setInteger int  index  )  [virtual]
 

Set the index-th variable to be an integer variable

Implements OsiSolverInterface.

Definition at line 1072 of file OsiOslSolverInterface.cpp.

References getMutableModelPtr().

01073 {
01074   ekk_markAsInteger(getMutableModelPtr(), index);
01075 }

void OsiOslSolverInterface::setObjCoeff int  elementIndex,
double  elementValue
[virtual]
 

Set an objective function coefficient

Implements OsiSolverInterface.

Definition at line 841 of file OsiOslSolverInterface.cpp.

References getMutableModelPtr().

00842 {
00843   // *TEST*
00844   EKKModel* model = getMutableModelPtr();
00845   ekk_copyObjective(model, &elementValue, elementIndex, elementIndex+1 );
00846 }

void OsiOslSolverInterface::setRowBounds int  elementIndex,
double  lower,
double  upper
[virtual]
 

Set a single row lower and upper bound
The default implementation just invokes setRowLower() and setRowUpper()

Reimplemented from OsiSolverInterface.

Definition at line 928 of file OsiOslSolverInterface.cpp.

References OsiSolverInterface::convertBoundToSense(), OsiSolverInterface::forceIntoRange(), getMutableModelPtr(), rhs_, rowrange_, and rowsense_.

Referenced by setRowSetBounds(), and setRowType().

00930 {
00931   // *TEST*
00932   const double newLower = forceIntoRange(lower, -OSL_INFINITY, OSL_INFINITY);
00933   const double newUpper = forceIntoRange(upper, -OSL_INFINITY, OSL_INFINITY);
00934   EKKModel* model = getMutableModelPtr();
00935   ekk_copyRowlower(model, &newLower, i, i+1 );
00936   ekk_copyRowupper(model, &newUpper, i, i+1 );
00937   if (rowsense_ != NULL) {
00938     assert ((rhs_ != NULL) && (rowrange_ != NULL));
00939     convertBoundToSense(newLower, newUpper,
00940                         rowsense_[i], rhs_[i], rowrange_[i]);
00941   }
00942 }

void OsiOslSolverInterface::setRowLower int  elementIndex,
double  elementValue
[virtual]
 

Set a single row lower bound
Use -DBL_MAX for -infinity.

Implements OsiSolverInterface.

Definition at line 899 of file OsiOslSolverInterface.cpp.

References OsiSolverInterface::convertBoundToSense(), OsiSolverInterface::forceIntoRange(), getMutableModelPtr(), getRowUpper(), rhs_, rowrange_, and rowsense_.

00900 {
00901   // *TEST*
00902   EKKModel* model = getMutableModelPtr();
00903   const double newVal =
00904     forceIntoRange(elementValue, -OSL_INFINITY, OSL_INFINITY);
00905   ekk_copyRowlower(model, &newVal, i, i+1 );
00906   if (rowsense_ != NULL) {
00907     assert ((rhs_ != NULL) && (rowrange_ != NULL));
00908     convertBoundToSense(newVal, getRowUpper()[i],
00909                         rowsense_[i], rhs_[i], rowrange_[i]);
00910   }
00911 }

void OsiOslSolverInterface::setRowPrice const double *  rowprice  )  [virtual]
 

Set dual solution vector

rowprice[numrows()] is an array of values of the problem row dual variables. These values are copied to memory owned by the solver object or the solver. They will be returned as the result of rowprice() 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.

Implements OsiSolverInterface.

Definition at line 1120 of file OsiOslSolverInterface.cpp.

References getMutableModelPtr().

01121 {
01122   EKKModel * m = getMutableModelPtr();
01123   ekk_copyRowduals(m,rs,0,ekk_getInumrows(m));
01124 }

void OsiOslSolverInterface::setRowSetBounds const int *  indexFirst,
const int *  indexLast,
const double *  boundList
[virtual]
 

Set the bounds on a number of rows simultaneously
The default implementation just invokes setRowLower() and setRowUpper() over and over again.

Parameters:
indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the constraints whose either bound changes
boundList the new lower/upper bound pairs for the constraints

Reimplemented from OsiSolverInterface.

Definition at line 954 of file OsiOslSolverInterface.cpp.

References OsiSolverInterface::convertBoundToSense(), OsiSolverInterface::forceIntoRange(), getMutableModelPtr(), getNumRows(), rhs_, rowrange_, rowsense_, and setRowBounds().

00957 {
00958   // *TEST*
00959   const int numrows = getNumRows();
00960   if (indexLast - indexFirst < numrows / 16) {
00961     // It's probably more effective to invoke setRowBounds() iteratively
00962     while (indexFirst != indexLast) {
00963       setRowBounds(*indexFirst, boundList[0], boundList[1]);
00964       ++indexFirst;
00965       boundList += 2;
00966     }
00967   } else {
00968     // probably faster to set everything at once
00969     EKKModel* model = getMutableModelPtr();
00970     double * lower = ekk_getRowlower(model);
00971     double * upper = ekk_getRowupper(model);
00972     const int len = indexLast - indexFirst;
00973     while (indexFirst != indexLast) {
00974       const int iRow=*indexFirst++;
00975       lower[iRow]= forceIntoRange(*boundList++, -OSL_INFINITY, OSL_INFINITY);
00976       upper[iRow]= forceIntoRange(*boundList++, -OSL_INFINITY, OSL_INFINITY);
00977     }
00978     if (rowsense_ != NULL) {
00979       assert ((rhs_ != NULL) && (rowrange_ != NULL));
00980       indexFirst -= len;
00981       while (indexFirst != indexLast) {
00982         const int iRow=*indexFirst++;
00983         convertBoundToSense(lower[iRow], upper[iRow],
00984                             rowsense_[iRow], rhs_[iRow], rowrange_[iRow]);
00985       }
00986     }
00987     ekk_setRowlower(model, lower);
00988     ekk_setRowupper(model, upper);
00989     ekk_free(lower);
00990     ekk_free(upper);
00991   }
00992 }

void OsiOslSolverInterface::setRowSetTypes const int *  indexFirst,
const int *  indexLast,
const char *  senseList,
const double *  rhsList,
const double *  rangeList
[virtual]
 

Set the type of a number of rows simultaneously
The default implementation just invokes setRowType() over and over again.

Parameters:
indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the constraints whose any characteristics changes
senseList the new senses
rhsList the new right hand sides
rangeList the new ranges

Reimplemented from OsiSolverInterface.

Definition at line 995 of file OsiOslSolverInterface.cpp.

References OsiSolverInterface::convertSenseToBound(), getMutableModelPtr(), getNumRows(), rhs_, rowrange_, rowsense_, and setRowType().

01000 {
01001   // *TEST*
01002   const int numrows = getNumRows();
01003   if (indexLast - indexFirst < numrows / 16) {
01004     // It's probably more effective to invoke setRowType() iteratively
01005     while (indexFirst != indexLast) {
01006       if (rangeList){
01007         setRowType(*indexFirst++, *senseList++, *rhsList++, *rangeList++);
01008       } else {
01009         setRowType(*indexFirst++, *senseList++, *rhsList++, 0);
01010       } 
01011     }
01012   } else {
01013     // probably faster to set everything at once
01014     EKKModel* model = getMutableModelPtr();
01015     double * lower = ekk_getRowlower(model);
01016     double * upper = ekk_getRowupper(model);
01017     const int len = indexLast - indexFirst;
01018     while (indexFirst != indexLast) {
01019       const int iRow= *indexFirst++;
01020       if (rangeList){
01021         convertSenseToBound(*senseList++, *rhsList++, *rangeList++,
01022                             lower[iRow], upper[iRow]);
01023       } else {
01024         convertSenseToBound(*senseList++, *rhsList++, 0,
01025                             lower[iRow], upper[iRow]);
01026       }
01027     }
01028     if (rowsense_ != NULL) {
01029       assert ((rhs_ != NULL) && (rowrange_ != NULL));
01030       indexFirst -= len;
01031       senseList -= len;
01032       rhsList -= len;
01033       if (rangeList)
01034         rangeList -= len;
01035       while (indexFirst != indexLast) {
01036         const int iRow=*indexFirst++;
01037         rowsense_[iRow] = *senseList++;
01038         rhs_[iRow] = *rhsList++;
01039         if (rangeList)
01040           rowrange_[iRow] = *rangeList++;
01041       }
01042     }
01043     ekk_setRowlower(model, lower);
01044     ekk_setRowupper(model, upper);
01045     ekk_free(lower);
01046     ekk_free(upper);
01047   }
01048 }

void OsiOslSolverInterface::setRowType int  index,
char  sense,
double  rightHandSide,
double  range
[virtual]
 

Set the type of a single row

Implements OsiSolverInterface.

Definition at line 945 of file OsiOslSolverInterface.cpp.

References OsiSolverInterface::convertSenseToBound(), and setRowBounds().

Referenced by setRowSetTypes().

00947 {
00948   // *TEST*
00949   double lower, upper;
00950   convertSenseToBound(sense, rightHandSide, range, lower, upper);
00951   setRowBounds(i, lower, upper);
00952 }

void OsiOslSolverInterface::setRowUpper int  elementIndex,
double  elementValue
[virtual]
 

Set a single row upper bound
Use DBL_MAX for infinity.

Implements OsiSolverInterface.

Definition at line 914 of file OsiOslSolverInterface.cpp.

References OsiSolverInterface::convertBoundToSense(), OsiSolverInterface::forceIntoRange(), getMutableModelPtr(), getRowLower(), rhs_, rowrange_, and rowsense_.

00915 {
00916   // *TEST*
00917   const double newVal =
00918     forceIntoRange(elementValue, -OSL_INFINITY, OSL_INFINITY);
00919   ekk_copyRowupper(getMutableModelPtr(), &newVal, i, i+1 );
00920   if (rowsense_ != NULL) {
00921     assert ((rhs_ != NULL) && (rowrange_ != NULL));
00922     convertBoundToSense(getRowLower()[i], newVal,
00923                         rowsense_[i], rhs_[i], rowrange_[i]);
00924   }
00925 }

bool OsiOslSolverInterface::setWarmStart const CoinWarmStart warmstart  )  [virtual]
 

Set warmstarting information. Return true/false depending on whether the warmstart information was accepted or not.

Implements OsiSolverInterface.

Definition at line 461 of file OsiOslSolverInterface.cpp.

References CoinWarmStartBasis::getArtifStatus(), getMutableModelPtr(), CoinWarmStartBasis::getNumArtificial(), CoinWarmStartBasis::getNumStructural(), and CoinWarmStartBasis::getStructStatus().

Referenced by solveFromHotStart().

00462 {
00463   // *TEST*
00464   const CoinWarmStartBasis* ws =
00465     dynamic_cast<const CoinWarmStartBasis*>(warmstart);
00466 
00467   if (! ws)
00468     return false;
00469 
00470   const int numcols = ws->getNumStructural();
00471   const int numrows = ws->getNumArtificial();
00472 
00473   EKKModel* model = getMutableModelPtr();
00474 
00475   const int maxdim = CoinMax(numcols, numrows);
00476   int * atLower = new int[maxdim];
00477   int * atUpper = new int[maxdim];
00478   int * basic = new int[maxdim];
00479   int numLower = 0;
00480   int numUpper = 0;
00481   int numBasic = 0;
00482   int i;
00483 
00484   for (i = 0; i < numrows; ++i) {
00485     switch (ws->getArtifStatus(i)) {
00486     case CoinWarmStartBasis::atUpperBound:
00487       atUpper[numUpper++] = i;
00488       break;
00489     case CoinWarmStartBasis::atLowerBound:
00490       atLower[numLower++] = i;
00491       break;
00492     case CoinWarmStartBasis::basic:
00493       basic[numBasic++] = i;
00494       break;
00495     case CoinWarmStartBasis::isFree: // superbasic
00496       basic[numBasic++] = i;
00497       break;
00498     }
00499   }
00500   if (ekk_setRowsNonBasicAtLower(model, numLower, atLower) != 0)
00501     goto setWarmStart_Error;
00502   if (ekk_setRowsNonBasicAtUpper(model, numUpper, atUpper) != 0)
00503     goto setWarmStart_Error;
00504   if (ekk_markRowsAsBasic(model, numBasic, basic) != 0)
00505     goto setWarmStart_Error;
00506 
00507   numLower = 0;
00508   numUpper = 0;
00509   numBasic = 0;
00510   for (i = 0; i < numcols; ++i) {
00511     switch (ws->getStructStatus(i)) {
00512     case CoinWarmStartBasis::atUpperBound:
00513       atUpper[numUpper++] = i;
00514       break;
00515     case CoinWarmStartBasis::atLowerBound:
00516       atLower[numLower++] = i;
00517       break;
00518     case CoinWarmStartBasis::basic:
00519       basic[numBasic++] = i;
00520       break;
00521     case CoinWarmStartBasis::isFree: // superbasic
00522       basic[numBasic++] = i;
00523       break;
00524     }
00525   }
00526   if (ekk_setColumnsNonBasicAtLower(model, numLower, atLower) != 0)
00527     goto setWarmStart_Error;
00528   if (ekk_setColumnsNonBasicAtUpper(model, numUpper, atUpper) != 0)
00529     goto setWarmStart_Error;
00530   if (ekk_markColumnsAsBasic(model, numBasic, basic) != 0)
00531     goto setWarmStart_Error;
00532 
00533   delete[] basic;
00534   delete[] atUpper;
00535   delete[] atLower;
00536   return true;
00537 
00538   setWarmStart_Error:
00539   delete[] basic;
00540   delete[] atUpper;
00541   delete[] atLower;
00542   return false;
00543 }

void OsiOslSolverInterface::writeMps const char *  filename,
const char *  extension = "mps",
double  objSense = 0.0
const [virtual]
 

Write the problem into an mps file of the given filename. If objSense is non zero then -1.0 forces the code to write a maximization objective and +1.0 to write a minimization one. If 0.0 then solver can do what it wants

Implements OsiSolverInterface.

Definition at line 1409 of file OsiOslSolverInterface.cpp.

References getMutableModelPtr().

01412 {
01413   std::string f(filename);
01414   std::string e(extension);
01415   std::string fullname;
01416   if (e!="") {
01417     fullname = f + "." + e;
01418   } else {
01419     // no extension so no trailing period
01420     fullname = f;
01421   }
01422   ekk_exportModel(getMutableModelPtr(), fullname.c_str(), 1, 2);
01423 }


Friends And Related Function Documentation

void OsiOslSolverInterfaceUnitTest const std::string &  mpsDir,
const std::string &  netlibDir
[friend]
 

A function that tests the methods in the OsiOslSolverInterface class. The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging. Also, if this method is compiled with optimization, the compilation takes 10-15 minutes and the machine pages (has 256M core memory!)...

Definition at line 422 of file OsiOslSolverInterfaceTest.cpp.

00423 {
00424 
00425   // Test default constructor
00426   {
00427     assert( OsiOslSolverInterface::getNumInstances()==0 );
00428     OsiOslSolverInterface m;
00429     assert( m.modelPtr_==NULL );
00430     assert( m.rowsense_==NULL );
00431     assert( m.rhs_==NULL );
00432     assert( m.rowrange_==NULL );
00433     assert( m.matrixByRow_==NULL );
00434     assert( m.matrixByColumn_==NULL );
00435     assert( OsiOslSolverInterface::getNumInstances()==1 );
00436     assert( m.getApplicationData() == NULL );
00437     int i=2346;
00438     m.setApplicationData(&i);
00439     assert( *((int *)(m.getApplicationData())) == i );
00440   }
00441   assert( OsiOslSolverInterface::getNumInstances()==0 );
00442 
00443   
00444   {    
00445     CoinRelFltEq eq;
00446     OsiOslSolverInterface m;
00447     assert( OsiOslSolverInterface::getNumInstances()==1 );
00448     std::string fn = mpsDir+"exmip1";
00449     m.readMps(fn.c_str(),"mps");
00450     int ad = 13579;
00451     m.setApplicationData(&ad);
00452     assert( *((int *)(m.getApplicationData())) == ad );
00453     
00454     {
00455       OsiOslSolverInterface im;    
00456       assert( im.modelPtr_==NULL );
00457       
00458       assert( im.getNumCols() == 0 ); 
00459       
00460       assert( im.getModelPtr()!=NULL );
00461       assert( im.getMutableModelPtr()!=NULL );
00462       assert( im.getModelPtr() == im.getMutableModelPtr() );
00463     }
00464     
00465     // Test copy constructor and assignment operator
00466     {
00467       OsiOslSolverInterface lhs;
00468       {      
00469         assert( *((int *)(m.getApplicationData())) == ad );
00470         OsiOslSolverInterface im(m);        
00471         assert( *((int *)(im.getApplicationData())) == ad );
00472 
00473         OsiOslSolverInterface imC1(im);
00474         assert( imC1.getMutableModelPtr()!=im.getMutableModelPtr() );
00475         assert( imC1.getModelPtr()!=im.getModelPtr() );
00476         assert( imC1.getNumCols() == im.getNumCols() );
00477         assert( imC1.getNumRows() == im.getNumRows() );   
00478         assert( *((int *)(imC1.getApplicationData())) == ad ); 
00479         
00480         //im.setModelPtr(m);
00481         
00482         
00483         OsiOslSolverInterface imC2(im);
00484         assert( imC2.getMutableModelPtr()!=im.getMutableModelPtr() );
00485         assert( imC2.getModelPtr()!=im.getModelPtr() );
00486         assert( imC2.getNumCols() == im.getNumCols() );
00487         assert( imC2.getNumRows() == im.getNumRows() );  
00488         assert( *((int *)(imC2.getApplicationData())) == ad ); 
00489         
00490         assert( imC2.getMutableModelPtr()!=imC1.getMutableModelPtr() );
00491         assert( imC2.getModelPtr()!=imC1.getModelPtr() );
00492         
00493         lhs=imC2;
00494       }
00495       // Test that lhs has correct values even though rhs has gone out of scope
00496       
00497       assert( lhs.getMutableModelPtr() != m.getMutableModelPtr() );
00498       assert( lhs.getModelPtr() != m.getModelPtr() );
00499       assert( lhs.getNumCols() == m.getNumCols() );
00500       assert( lhs.getNumRows() == m.getNumRows() );      
00501       assert( *((int *)(lhs.getApplicationData())) == ad );
00502     }
00503     
00504     // Test clone
00505     {
00506       OsiOslSolverInterface oslSi(m);
00507       OsiSolverInterface * siPtr = &oslSi;
00508       OsiSolverInterface * siClone = siPtr->clone();
00509       OsiOslSolverInterface * oslClone = dynamic_cast<OsiOslSolverInterface*>(siClone);
00510       assert( oslClone != NULL );
00511       assert( oslClone->getModelPtr() != oslSi.getModelPtr() );
00512       assert( oslClone->getModelPtr() != m.getModelPtr() );
00513       assert( oslClone->getNumRows() == oslSi.getNumRows() );
00514       assert( oslClone->getNumCols() == m.getNumCols() );
00515       
00516       assert( *((int *)(oslClone->getApplicationData())) == ad );
00517       // Test reset
00518       siClone->reset();
00519       assert( oslClone->rowsense_==NULL );
00520       assert( oslClone->rhs_==NULL );
00521       assert( oslClone->rowrange_==NULL );
00522       assert( oslClone->matrixByRow_==NULL );
00523       assert( oslClone->ws_==NULL);
00524       assert( oslClone->itlimOrig_==9999999);
00525       delete siClone;
00526     }
00527    
00528     // test infinity
00529     {
00530       OsiOslSolverInterface si;
00531       assert( eq(si.getInfinity(),OSL_INFINITY));
00532     }     
00533 
00534     //--------------
00535     // Test rowsense, rhs, rowrange, matrixByRow
00536     {
00537       OsiOslSolverInterface lhs;
00538       {      
00539         assert( m.rowrange_==NULL );
00540         assert( m.rowsense_==NULL );
00541         assert( m.rhs_==NULL );
00542         assert( m.matrixByRow_==NULL );
00543         
00544         OsiOslSolverInterface siC1(m);     
00545         assert( siC1.rowrange_==NULL );
00546         assert( siC1.rowsense_==NULL );
00547         assert( siC1.rhs_==NULL );
00548         assert( siC1.matrixByRow_==NULL );
00549 
00550         const char   * siC1rs  = siC1.getRowSense();
00551         assert( siC1rs[0]=='G' );
00552         assert( siC1rs[1]=='L' );
00553         assert( siC1rs[2]=='E' );
00554         assert( siC1rs[3]=='R' );
00555         assert( siC1rs[4]=='R' );
00556         
00557         const double * siC1rhs = siC1.getRightHandSide();
00558         assert( eq(siC1rhs[0],2.5) );
00559         assert( eq(siC1rhs[1],2.1) );
00560         assert( eq(siC1rhs[2],4.0) );
00561         assert( eq(siC1rhs[3],5.0) );
00562         assert( eq(siC1rhs[4],15.) ); 
00563         
00564         const double * siC1rr  = siC1.getRowRange();
00565         assert( eq(siC1rr[0],0.0) );
00566         assert( eq(siC1rr[1],0.0) );
00567         assert( eq(siC1rr[2],0.0) );
00568         assert( eq(siC1rr[3],5.0-1.8) );
00569         assert( eq(siC1rr[4],15.0-3.0) );
00570         
00571         const CoinPackedMatrix * siC1mbr = siC1.getMatrixByRow();
00572         assert( siC1mbr != NULL );
00573         
00574         const double * ev = siC1mbr->getElements();
00575         assert( eq(ev[0],   3.0) );
00576         assert( eq(ev[1],   1.0) );
00577         assert( eq(ev[2],  -2.0) );
00578         assert( eq(ev[3],  -1.0) );
00579         assert( eq(ev[4],  -1.0) );
00580         assert( eq(ev[5],   2.0) );
00581         assert( eq(ev[6],   1.1) );
00582         assert( eq(ev[7],   1.0) );
00583         assert( eq(ev[8],   1.0) );
00584         assert( eq(ev[9],   2.8) );
00585         assert( eq(ev[10], -1.2) );
00586         assert( eq(ev[11],  5.6) );
00587         assert( eq(ev[12],  1.0) );
00588         assert( eq(ev[13],  1.9) );
00589         
00590         const int * mi = siC1mbr->getVectorStarts();
00591         assert( mi[0]==0 );
00592         assert( mi[1]==5 );
00593         assert( mi[2]==7 );
00594         assert( mi[3]==9 );
00595         assert( mi[4]==11 );
00596         assert( mi[5]==14 );
00597         
00598         const int * ei = siC1mbr->getIndices();
00599         assert( ei[0]  ==  0 );
00600         assert( ei[1]  ==  1 );
00601         assert( ei[2]  ==  3 );
00602         assert( ei[3]  ==  4 );
00603         assert( ei[4]  ==  7 );
00604         assert( ei[5]  ==  1 );
00605         assert( ei[6]  ==  2 );
00606         assert( ei[7]  ==  2 );
00607         assert( ei[8]  ==  5 );
00608         assert( ei[9]  ==  3 );
00609         assert( ei[10] ==  6 );
00610         assert( ei[11] ==  0 );
00611         assert( ei[12] ==  4 );
00612         assert( ei[13] ==  7 );    
00613         
00614         assert( siC1mbr->getMajorDim() == 5 ); 
00615         assert( siC1mbr->getNumElements() == 14 );
00616         
00617 
00618         assert( siC1rs  == siC1.getRowSense() );
00619         assert( siC1rhs == siC1.getRightHandSide() );
00620         assert( siC1rr  == siC1.getRowRange() );
00621 
00622         // Change OSL Model by adding free row
00623         OsiRowCut rc;
00624         rc.setLb(-DBL_MAX);
00625         rc.setUb( DBL_MAX);
00626         OsiCuts cuts;
00627         cuts.insert(rc);
00628         siC1.applyCuts(cuts);
00629              
00630         // Since model was changed, test that cached
00631         // data is now freed.
00632         assert( siC1.rowrange_==NULL );
00633         assert( siC1.rowsense_==NULL );
00634         assert( siC1.rhs_==NULL );
00635         assert( siC1.matrixByRow_==NULL );
00636         
00637         siC1rs  = siC1.getRowSense();
00638         assert( siC1rs[0]=='G' );
00639         assert( siC1rs[1]=='L' );
00640         assert( siC1rs[2]=='E' );
00641         assert( siC1rs[3]=='R' );
00642         assert( siC1rs[4]=='R' );
00643         assert( siC1rs[5]=='N' );
00644 
00645         siC1rhs = siC1.getRightHandSide();
00646         assert( eq(siC1rhs[0],2.5) );
00647         assert( eq(siC1rhs[1],2.1) );
00648         assert( eq(siC1rhs[2],4.0) );
00649         assert( eq(siC1rhs[3],5.0) );
00650         assert( eq(siC1rhs[4],15.) ); 
00651         assert( eq(siC1rhs[5],0.0 ) ); 
00652 
00653         siC1rr  = siC1.getRowRange();
00654         assert( eq(siC1rr[0],0.0) );
00655         assert( eq(siC1rr[1],0.0) );
00656         assert( eq(siC1rr[2],0.0) );
00657         assert( eq(siC1rr[3],5.0-1.8) );
00658         assert( eq(siC1rr[4],15.0-3.0) );
00659         assert( eq(siC1rr[5],0.0) );
00660     
00661         lhs=siC1;
00662       }
00663       // Test that lhs has correct values even though siC1 has gone out of scope    
00664       assert( lhs.rowrange_==NULL );
00665       assert( lhs.rowsense_==NULL );
00666       assert( lhs.rhs_==NULL ); 
00667       assert( lhs.matrixByRow_==NULL ); 
00668       
00669       const char * lhsrs  = lhs.getRowSense();
00670       assert( lhsrs[0]=='G' );
00671       assert( lhsrs[1]=='L' );
00672       assert( lhsrs[2]=='E' );
00673       assert( lhsrs[3]=='R' );
00674       assert( lhsrs[4]=='R' );
00675       assert( lhsrs[5]=='N' );
00676       
00677       const double * lhsrhs = lhs.getRightHandSide();
00678       assert( eq(lhsrhs[0],2.5) );
00679       assert( eq(lhsrhs[1],2.1) );
00680       assert( eq(lhsrhs[2],4.0) );
00681       assert( eq(lhsrhs[3],5.0) );
00682       assert( eq(lhsrhs[4],15.) ); 
00683       assert( eq(lhsrhs[5],0.0) ); 
00684       
00685       const double *lhsrr  = lhs.getRowRange();
00686       assert( eq(lhsrr[0],0.0) );
00687       assert( eq(lhsrr[1],0.0) );
00688       assert( eq(lhsrr[2],0.0) );
00689       assert( eq(lhsrr[3],5.0-1.8) );
00690       assert( eq(lhsrr[4],15.0-3.0) );
00691       assert( eq(lhsrr[5],0.0) );      
00692       
00693       const CoinPackedMatrix * lhsmbr = lhs.getMatrixByRow();
00694       assert( lhsmbr != NULL );       
00695       const double * ev = lhsmbr->getElements();
00696       assert( eq(ev[0],   3.0) );
00697       assert( eq(ev[1],   1.0) );
00698       assert( eq(ev[2],  -2.0) );
00699       assert( eq(ev[3],  -1.0) );
00700       assert( eq(ev[4],  -1.0) );
00701       assert( eq(ev[5],   2.0) );
00702       assert( eq(ev[6],   1.1) );
00703       assert( eq(ev[7],   1.0) );
00704       assert( eq(ev[8],   1.0) );
00705       assert( eq(ev[9],   2.8) );
00706       assert( eq(ev[10], -1.2) );
00707       assert( eq(ev[11],  5.6) );
00708       assert( eq(ev[12],  1.0) );
00709       assert( eq(ev[13],  1.9) );
00710       
00711       const int * mi = lhsmbr->getVectorStarts();
00712       assert( mi[0]==0 );
00713       assert( mi[1]==5 );
00714       assert( mi[2]==7 );
00715       assert( mi[3]==9 );
00716       assert( mi[4]==11 );
00717       assert( mi[5]==14 );
00718       
00719       const int * ei = lhsmbr->getIndices();
00720       assert( ei[0]  ==  0 );
00721       assert( ei[1]  ==  1 );
00722       assert( ei[2]  ==  3 );
00723       assert( ei[3]  ==  4 );
00724       assert( ei[4]  ==  7 );
00725       assert( ei[5]  ==  1 );
00726       assert( ei[6]  ==  2 );
00727       assert( ei[7]  ==  2 );
00728       assert( ei[8]  ==  5 );
00729       assert( ei[9]  ==  3 );
00730       assert( ei[10] ==  6 );
00731       assert( ei[11] ==  0 );
00732       assert( ei[12] ==  4 );
00733       assert( ei[13] ==  7 );    
00734       
00735       int md = lhsmbr->getMajorDim();
00736       assert(  md == 6 ); 
00737       assert( lhsmbr->getNumElements() == 14 );
00738     }
00739     
00740     assert(OsiOslSolverInterface::getNumInstances()==1);
00741   }
00742   assert(OsiOslSolverInterface::getNumInstances()==0);
00743 
00744   // Do common solverInterface testing 
00745   {
00746     OsiOslSolverInterface m;
00747     OsiSolverInterfaceCommonUnitTest(&m, mpsDir, netlibDir );
00748   }
00749 
00750   // Do primitive branch and bound
00751   // And test message handling
00752   /* This could be moved down to OsiSolverInterface by
00753      putting in branchAndBound and taking off m.
00754   */
00755   int iPass;
00756   for (iPass=0;iPass<2;iPass++) {
00757     OsiOslSolverInterface m;
00758     std::string fn = mpsDir+"p0033";
00759     m.readMps(fn.c_str(),"mps");
00760      // derived message handler (only used on second pass)
00761     OsiOslMessageTest messageHandler;
00762    if (iPass) {
00763       std::cout<<"Testing derived message handler"<<std::endl;
00764       m.passInMessageHandler(&messageHandler);
00765       ekk_registerMsguCallBack(m.getModelPtr(),trapMessages);
00766       // say all messages to be trapped
00767       ekk_mset(m.getModelPtr(),1,0,-1,2,9999,0);
00768       // pass handler to OSL
00769       ekk_setUserData(m.getModelPtr(),&messageHandler);
00770    }
00771     // solve LP
00772     m.initialSolve();
00773     // setColBounds prints every time - don't even get to message handler
00774     ekk_messagePrintOff(m.getModelPtr() ,317);
00775     ekk_messagePrintOff(m.getModelPtr() ,318);
00776     ekk_messagePrintOff(m.getModelPtr() ,3048);
00777     ekk_messagePrintOff(m.getModelPtr() ,85);
00778     ekk_messagePrintOff(m.getModelPtr() ,82);
00779     ekk_messagePrintOff(m.getModelPtr() ,38);
00780 
00781     if (m.isProvenOptimal()&&!m.isDualObjectiveLimitReached()) {
00782       // This is a really simple Branch and Bound code - mainly
00783       // to test strong branching
00784       // I should look at STL more to allow other than depth first
00785       int numberIntegers=0;
00786       int numberColumns = m.getNumCols();
00787       int iColumn;
00788       int i;
00789       for (iColumn=0;iColumn<numberColumns;iColumn++) {
00790         if( m.isInteger(iColumn))
00791           numberIntegers++;
00792       }
00793       if (!numberIntegers) {
00794         std::cout<<"No integer variables"
00795           <<std::endl;
00796         return;
00797       }
00798       int * which = new int[numberIntegers]; // which variables are integer
00799       numberIntegers=0;
00800       for (iColumn=0;iColumn<numberColumns;iColumn++) {
00801         if( m.isInteger(iColumn))
00802           which[numberIntegers++]=iColumn;
00803       }
00804       
00805       // empty tree
00806       OsiVectorNode branchingTree;
00807       
00808       // Add continuous to it;
00809       branchingTree.push_back(OsiNodeSimple(m,numberIntegers,which));
00810       
00811       // For printing totals
00812       int numberIterations=0;
00813       int numberNodes =0;
00814       
00815       OsiNodeSimple bestNode;
00816       // while until nothing on stack
00817       while (branchingTree.size()) {
00818         // last node
00819         OsiNodeSimple node = branchingTree.back();
00820         branchingTree.pop_back();
00821         numberNodes++;
00822         if (node.variable_>=0) {
00823           // branch - do bounds
00824           for (i=0;i<numberIntegers;i++) {
00825             iColumn=which[i];
00826             m.setColBounds( iColumn,node.lower_[i],node.upper_[i]);
00827           }
00828           // move basis
00829           m.setWarmStart(&node.basis_);
00830           // do branching variable
00831           if (node.way_<0) {
00832             m.setColUpper(which[node.variable_],floor(node.value_));
00833             // now push back node if more to come
00834             if (node.way_==-1) { 
00835               node.way_=+2;       // Swap direction
00836               branchingTree.push_back(node);
00837             }
00838           } else {
00839             m.setColLower(which[node.variable_],ceil(node.value_));
00840             // now push back node if more to come
00841             if (node.way_==1) { 
00842               node.way_=-2;       // Swap direction
00843               branchingTree.push_back(node);
00844             }
00845           }
00846           // solve
00847           m.resolve();
00848           numberIterations += m.getIterationCount();
00849           if (!m.isIterationLimitReached()) {
00850             OsiNodeSimple newNode(m,numberIntegers,which);
00851             // something extra may have been fixed by strong branching
00852             // if so go round again
00853             while (newNode.variable_==numberIntegers) {
00854               m.resolve();
00855               newNode = OsiNodeSimple(m,numberIntegers,which);
00856             }
00857             if (newNode.objectiveValue_<1.0e100) {
00858               // push on stack
00859               branchingTree.push_back(newNode);
00860             }
00861           } else {
00862             // maximum iterations - exit
00863             std::cout<<"Exiting on maximum iterations"
00864               <<std::endl;
00865           break;
00866           }
00867         } else {
00868           // integer solution - save
00869           bestNode = node;
00870           // set cutoff (hard coded tolerance)
00871           m.setDblParam(OsiDualObjectiveLimit,bestNode.objectiveValue_-1.0e-5);
00872           std::cout<<"Integer solution of "
00873                    <<bestNode.objectiveValue_
00874                    <<" found after "<<numberIterations
00875                    <<" iterations and "<<numberNodes<<" nodes"
00876                    <<std::endl;
00877         }
00878       }
00879       std::cout<<"Search took "
00880                <<numberIterations
00881                <<" iterations and "<<numberNodes<<" nodes"
00882                <<std::endl;
00883       if (bestNode.numberIntegers_) {
00884         // we have a solution restore
00885         // do bounds
00886         for (i=0;i<numberIntegers;i++) {
00887           iColumn=which[i];
00888           m.setColBounds( iColumn,bestNode.lower_[i],bestNode.upper_[i]);
00889         }
00890         // move basis
00891         m.setWarmStart(&bestNode.basis_);
00892         m.resolve();
00893       }
00894       delete [] which;
00895     } else {
00896       std::cout<<"The LP relaxation is infeasible"
00897                <<std::endl;
00898       throw CoinError("The LP relaxation is infeasible or too expensive",
00899                       "branchAndBound", "OsiClpSolverInterface");
00900     }
00901     ekk_messagePrintOn(m.getModelPtr() ,317);
00902     ekk_messagePrintOn(m.getModelPtr() ,318);
00903     ekk_messagePrintOn(m.getModelPtr() ,3048);
00904     ekk_messagePrintOn(m.getModelPtr() ,85);
00905     ekk_messagePrintOn(m.getModelPtr() ,82);
00906     ekk_messagePrintOn(m.getModelPtr() ,38);
00907     // Very important to normalize before going out of scope
00908     ekk_clearMsguCallBack(m.getModelPtr());
00909     ekk_setUserData(m.getModelPtr(),NULL);
00910    }
00911 
00912   assert(OsiOslSolverInterface::getNumInstances()==0);
00913 
00914 }


Member Data Documentation

int OsiOslSolverInterface::itlimOrig_ [private]
 

The original iteration limit before hotstarts started.

Definition at line 707 of file OsiOslSolverInterface.hpp.

Referenced by reset(), solveFromHotStart(), and unmarkHotStart().

double* OsiOslSolverInterface::rowrange_ [mutable, private]
 

Pointer to dense vector of slack upper bounds for range constraints (undefined for non-range rows)

Definition at line 701 of file OsiOslSolverInterface.hpp.

Referenced by extractSenseRhsRange(), freeCachedResults(), getRowRange(), gutsOfDestructor(), setRowBounds(), setRowLower(), setRowSetBounds(), setRowSetTypes(), and setRowUpper().

CoinWarmStartBasis* OsiOslSolverInterface::ws_ [private]
 

A pointer to the warmstart information to be used in the hotstarts. This is NOT efficient and more thought should be given to it...

Reimplemented from OsiSolverInterface.

Definition at line 705 of file OsiOslSolverInterface.hpp.

Referenced by freeCachedResults(), gutsOfDestructor(), markHotStart(), operator=(), solveFromHotStart(), and unmarkHotStart().


The documentation for this class was generated from the following files:
Generated on Wed Dec 3 14:35:42 2003 for Osi by doxygen 1.3.5