7 #ifndef OsiTestSolverInterface_H 
    8 #define OsiTestSolverInterface_H 
   49     void timesMajor(
const double* x, 
double* y) 
const;
 
   64       throw CoinError(
"Sorry, the Volume Algorithm doesn't implement B&B",
 
   65                      "branchAndBound", 
"OsiTestSolverInterface");
 
  234       virtual bool isBinary(
int colNumber) 
const;
 
  241       virtual bool isInteger(
int colNumber) 
const;
 
  306       virtual std::vector<double*> 
getDualRays(
int maxNumRays,
 
  307                                                bool fullRay = 
false) 
const;
 
  319       virtual std::vector<double*> 
getPrimalRays(
int maxNumRays) 
const;
 
  338       virtual void setObjCoeff( 
int elementIndex, 
double elementValue ) {
 
  345       virtual void setColLower( 
int elementIndex, 
double elementValue ) {
 
  352       virtual void setColUpper( 
int elementIndex, 
double elementValue ) {
 
  358                                  double lower, 
double upper ) {
 
  372                                    const int* indexLast,
 
  373                                    const double* boundList);
 
  377       virtual void setRowLower( 
int elementIndex, 
double elementValue ) {
 
  386       virtual void setRowUpper( 
int elementIndex, 
double elementValue ) {
 
  395                                  double lower, 
double upper ) {
 
  404       virtual void setRowType(
int index, 
char sense, 
double rightHandSide,
 
  407         rhs_[index] = rightHandSide;
 
  422                                    const int* indexLast,
 
  423                                    const double* boundList);
 
  436                                   const int* indexLast,
 
  437                                   const char* senseList,
 
  438                                   const double* rhsList,
 
  439                                   const double* rangeList);
 
  454       virtual void setInteger(
const int* indices, 
int len);
 
  494                              const double collb, 
const double colub,   
 
  499       virtual void addCols(
const int numcols,
 
  501                            const double* collb, 
const double* colub,   
 
  506                            const double* collb, 
const double* colub,   
 
  510       virtual void deleteCols(
const int num, 
const int * colIndices);
 
  515                           const double rowlb, 
const double rowub);
 
  518                           const char rowsen, 
const double rowrhs,   
 
  519                           const double rowrng);
 
  523       virtual void addRows(
const int numrows,
 
  525                            const double* rowlb, 
const double* rowub);
 
  527       virtual void addRows(
const int numrows,
 
  529                            const char* rowsen, 
const double* rowrhs,   
 
  530                            const double* rowrng);
 
  534                            const double* rowlb, 
const double* rowub);
 
  537                            const char* rowsen, 
const double* rowrhs,   
 
  538                            const double* rowrng);
 
  541       virtual void deleteRows(
const int num, 
const int * rowIndices);
 
  567                                             double effectivenessLb = 0.0);
 
  577                       const double* rowlb, 
const double* rowub);
 
  579                              const double* rowrhs, 
const double* rowrng);
 
  581                          const double* colub, 
const double* obj);
 
  598                              const double* collb, 
const double* colub,   
 
  600                              const double* rowlb, 
const double* rowub);
 
  610                              double*& collb, 
double*& colub, 
double*& obj,
 
  611                              double*& rowlb, 
double*& rowub);
 
  626                            const double* collb, 
const double* colub,
 
  628                            const char* rowsen, 
const double* rowrhs,   
 
  629                            const double* rowrng);
 
  639                              double*& collb, 
double*& colub, 
double*& obj,
 
  640                              char*& rowsen, 
double*& rowrhs,
 
  645     virtual void loadProblem(
const int numcols, 
const int numrows,
 
  646                              const int* start, 
const int* index,
 
  648                              const double* collb, 
const double* colub,   
 
  650                              const double* rowlb, 
const double* rowub);
 
  654     virtual void loadProblem(
const int numcols, 
const int numrows,
 
  655                              const int* start, 
const int* index,
 
  657                              const double* collb, 
const double* colub,   
 
  659                              const char* rowsen, 
const double* rowrhs,   
 
  660                              const double* rowrng);
 
  664     virtual int readMps(
const char *filename,
 
  665                          const char *extension = 
"mps");
 
  671     virtual void writeMps(
const char *filename,
 
  672                           const char *extension = 
"mps",
 
  673                           double objSense=0.0) 
const;
 
  752     void compute_rc_(
const double* u, 
double* rc) 
const;
 
void colRimResize_(const int newSize)
Reallocate the rim arrays corresponding to the columns. 
 
virtual void setContinuous(int index)
Set the index-th variable to be a continuous variable. 
 
virtual void writeMps(const char *filename, const char *extension="mps", double objSense=0.0) const 
Write the problem into an mps file of the given filename. 
 
virtual void assignProblem(CoinPackedMatrix *&matrix, double *&collb, double *&colub, double *&obj, double *&rowlb, double *&rowub)
Load in an problem by assuming ownership of the arguments (the constraints on the rows are given by l...
 
Error Class thrown by an exception. 
 
virtual void addRows(const int numrows, const CoinPackedVectorBase *const *rows, const double *rowlb, const double *rowub)
Add a set of rows (constraints) to the problem. 
 
virtual int readMps(const char *filename, const char *extension="mps")
Read a problem in MPS format from the given filename. 
 
double * rowupper_
Pointer to dense vector of slack variable upper bounds. 
 
virtual const char * getRowSense() const 
Get pointer to array[getNumRows()] of row constraint senses. 
 
void compute_rc_(const double *u, double *rc) const 
Compute the reduced costs (rc) with respect to the dual values given in u. 
 
virtual int getIterationCount() const 
Get how many iterations it took to solve the problem (whatever "iteration" mean to the solver...
 
virtual bool isProvenDualInfeasible() const 
Is dual infeasiblity proven? 
 
CoinBigIndex getNumElements() const 
Number of entries in the packed matrix. 
 
virtual void setRowType(int index, char sense, double rightHandSide, double range)
Set the type of a single row  
 
virtual bool isDualObjectiveLimitReached() const 
Is the given dual objective limit reached? 
 
double * rowrange_
Pointer to dense vector of slack upper bounds for range constraints (undefined for non-range rows)...
 
virtual void loadProblem(const CoinPackedMatrix &matrix, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub)
Load in an problem by copying the arguments (the constraints on the rows are given by lower and upper...
 
virtual void setColLower(int elementIndex, double elementValue)
Set a single column lower bound  Use -COIN_DBL_MAX for -infinity. 
 
bool colMatrixCurrent_
A flag indicating whether the column ordered matrix is up-to-date. 
 
virtual const double * getColLower() const 
Get pointer to array[getNumCols()] of column lower bounds. 
 
virtual void setColSetBounds(const int *indexFirst, const int *indexLast, const double *boundList)
Set the bounds on a number of columns simultaneously  The default implementation just invokes setColL...
 
virtual void setColBounds(int elementIndex, double lower, double upper)
Set a single column lower and upper bound. 
 
virtual double getObjSense() const 
Get objective function sense (1 for min (default), -1 for max) 
 
void initFromClbCubObj(const int colnum, const double *collb, const double *colub, const double *obj)
 
virtual void applyColCut(const OsiColCut &cc)
Apply a column cut (adjust one or more bounds). 
 
The user hooks should be overridden by the user to provide the problem specific routines for the volu...
 
virtual bool isIntegerNonBinary(int colIndex) const 
Return true if the variable is general integer. 
 
int maxNumcols_
allocated size of the column related rim vectors 
 
virtual const double * getColUpper() const 
Get pointer to array[getNumCols()] of column upper bounds. 
 
int iter() const 
returns the iteration number 
 
virtual void setColLower(int elementIndex, double elementValue)=0
Set a single column lower bound. 
 
void updateColMatrix_() const 
Update the column ordered matrix from the row ordered one. 
 
void rowRimResize_(const int newSize)
Reallocate the rim arrays corresponding to the rows. 
 
virtual void addCols(const int numcols, const CoinPackedVectorBase *const *cols, const double *collb, const double *colub, const double *obj)
Add a set of columns (primal variables) to the problem. 
 
virtual const double * getRowActivity() const 
Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vecto...
 
virtual bool isProvenOptimal() const 
Is optimality proven? 
 
virtual void setObjCoeff(int elementIndex, double elementValue)
Set an objective function coefficient. 
 
virtual bool isContinuous(int colNumber) const 
Return true if column is continuous. 
 
virtual const double * getColSolution() const 
Get pointer to array[getNumCols()] of primal solution vector. 
 
bool rowMatrixCurrent_
A flag indicating whether the row ordered matrix is up-to-date. 
 
virtual const CoinPackedMatrix * getMatrixByCol() const 
Get pointer to column-wise copy of matrix. 
 
This class holds every data for the Volume Algorithm and its solve method must be invoked to solve th...
 
Collections of row cuts and column cuts. 
 
virtual int heuristics(const VOL_problem &, const VOL_dvector &, double &heur_val)
Starting from the primal vector x, run a heuristic to produce an integer solution. 
 
virtual void setRowPrice(const double *rowprice)
Set dual solution vector. 
 
virtual void unmarkHotStart()
Delete the snapshot. 
 
bool getStrParam(OsiStrParam key, std::string &value) const 
Get a string parameter. 
 
virtual CoinWarmStart * getEmptyWarmStart() const 
Get an empty warm start object. 
 
virtual bool isAbandoned() const 
Are there a numerical difficulties? 
 
virtual void setColUpper(int elementIndex, double elementValue)=0
Set a single column upper bound. 
 
virtual void addRow(const CoinPackedVectorBase &vec, const double rowlb, const double rowub)
Add a row (constraint) to the problem. 
 
void convertSensesToBounds_()
For each row convert sense/rhs style row constraints to LB/UB style. 
 
virtual const double * getObjCoefficients() const 
Get pointer to array[getNumCols()] of objective function coefficients. 
 
virtual void branchAndBound()
Invoke solver's built-in enumeration algorithm. 
 
double * colsol_
Pointer to dense vector of primal structural variable values. 
 
CoinPackedMatrix colMatrix_
The problem matrix in a column ordered form. 
 
virtual bool isInteger(int colIndex) const 
Return true if the variable is integer. 
 
virtual bool isProvenPrimalInfeasible() const 
Is primal infeasiblity proven? 
 
bool getDblParam(OsiDblParam key, double &value) const 
Get a double parameter. 
 
bool isZeroOneMinusOne_
An indicator whether the matrix is 0/1/-1. 
 
virtual void addCol(const CoinPackedVectorBase &vec, const double collb, const double colub, const double obj)=0
Add a column (primal variable) to the problem. 
 
double * colupper_
Pointer to dense vector of structural variable upper bounds. 
 
Abstract Base Class for describing an interface to a solver. 
 
double * collower_
Pointer to dense vector of structural variable lower bounds. 
 
bool getIntParam(OsiIntParam key, int &value) const 
Get an integer parameter. 
 
void OsiTestSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir)
A function that tests the methods in the OsiTestSolverInterface class. 
 
Abstract base class for various sparse vectors. 
 
virtual OsiVectorInt getFractionalIndices(const double etol=1.e-05) const 
Get vector of indices of primal variables which are integer variables but have fractional values in t...
 
double objsense_
Sense of objective (1 for min; -1 for max) 
 
virtual int compute_rc(const VOL_dvector &u, VOL_dvector &rc)
compute reduced costs 
 
int getNumCols() const 
Number of columns. 
 
void updateRowMatrix_() const 
Update the row ordered matrix from the column ordered one. 
 
double * objcoeffs_
Pointer to dense vector of objective coefficients. 
 
virtual void addRows(const int numrows, const CoinPackedVectorBase *const *rows, const double *rowlb, const double *rowub)
Add a set of rows (constraints) to the problem. 
 
virtual int getNumElements() const 
Get number of nonzero elements. 
 
bool * continuous_
Pointer to dense vector of bool to indicate if column is continuous. 
 
Vol(ume) Solver Interface. 
 
double * lhs_
Pointer to dense vector of left hand sides (row activity levels) 
 
void initFromRlbRub(const int rownum, const double *rowlb, const double *rowub)
 
double * rowlower_
Pointer to dense vector of slack variable lower bounds. 
 
void colRimAllocator_()
A method allocating sufficient space for the rim vectors corresponding to the columns. 
 
virtual void deleteRows(const int num, const int *rowIndices)
Delete a set of rows (constraints) from the problem. 
 
virtual void setInteger(int index)
Set the index-th variable to be an integer variable. 
 
VOL_problem * volprob()
Get pointer to Vol model. 
 
virtual const double * getReducedCost() const 
Get a pointer to array[getNumCols()] of reduced costs. 
 
virtual void setObjSense(double s)
Set objective function sense (1 for min (default), -1 for max,) 
 
virtual void setRowBounds(int elementIndex, double lower, double upper)
Set a single row lower and upper bound. 
 
double * rc_
Pointer to dense vector of reduced costs. 
 
virtual void setRowSetTypes(const int *indexFirst, const int *indexLast, const char *senseList, const double *rhsList, const double *rangeList)
Set the type of a number of rows simultaneously  The default implementation just invokes setRowType()...
 
void convertSenseToBound(const char sense, const double right, const double range, double &lower, double &upper) const 
A quick inlined function to convert from the sense/rhs/range style of constraint definition to the lb...
 
virtual void addCols(const int numcols, const CoinPackedVectorBase *const *cols, const double *collb, const double *colub, const double *obj)
Add a set of columns (primal variables) to the problem. 
 
virtual bool isBinary(int colIndex) const 
Return true if the variable is binary. 
 
double lagrangeanCost_
The Lagrangean cost, a lower bound on the objective value. 
 
OsiTestSolverInterface & operator=(const OsiTestSolverInterface &rhs)
Assignment operator. 
 
virtual const CoinPackedMatrix * getMatrixByRow() const 
Get pointer to row-wise copy of matrix. 
 
virtual CoinWarmStart * getWarmStart() const 
Get warmstarting information. 
 
virtual const double * getRowLower() const 
Get pointer to array[getNumRows()] of row lower bounds. 
 
virtual double getObjValue() const =0
Get the objective function value. 
 
virtual void addCol(const CoinPackedVectorBase &vec, const double collb, const double colub, const double obj)
Add a column (primal variable) to the problem. 
 
int getNumRows() const 
Number of rows. 
 
virtual OsiSolverInterface * clone(bool copyData=true) const 
Clone. 
 
bool setIntParam(OsiIntParam key, int value)
Set an integer parameter. 
 
friend void OsiTestSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir)
A function that tests the methods in the OsiTestSolverInterface class. 
 
virtual bool setWarmStart(const CoinWarmStart *warmstart)
Set warmstarting information. 
 
virtual ApplyCutsReturnCode applyCuts(const OsiCuts &cs, double effectivenessLb=0.0)
Apply a collection of cuts. 
 
virtual bool isIterationLimitReached() const 
Iteration limit reached? 
 
virtual std::vector< double * > getPrimalRays(int maxNumRays) const 
Get as many primal rays as the solver can provide. 
 
virtual const double * getRowRange() const 
Get pointer to array[getNumRows()] of row ranges. 
 
Sparse Matrix Base Class. 
 
virtual void initialSolve()
Solve initial LP relaxation. 
 
virtual const double * getRowUpper() const 
Get pointer to array[getNumRows()] of row upper bounds. 
 
virtual void setRowUpper(int elementIndex, double elementValue)
Set a single row upper bound  Use COIN_DBL_MAX for infinity. 
 
virtual void setRowLower(int elementIndex, double elementValue)
Set a single row lower bound  Use -COIN_DBL_MAX for -infinity. 
 
virtual void setColSolution(const double *colsol)
Set the primal solution column values. 
 
void convertBoundToSense(const double lower, const double upper, char &sense, double &right, double &range) const 
A quick inlined function to convert from the lb/ub style of constraint definition to the sense/rhs/ra...
 
virtual bool isFreeBinary(int colIndex) const 
Return true if the variable is binary and not fixed. 
 
virtual void applyRowCut(const OsiRowCut &rc)
Apply a row cut (append to constraint matrix). 
 
void convertBoundsToSenses_()
For each row convert LB/UB style row constraints to sense/rhs style. 
 
virtual int readMps(const char *filename, const char *extension="mps")
Read an mps file from the given filename. 
 
double * rhs_
Pointer to dense vector of row right-hand side values. 
 
virtual double getInfinity() const 
Get solver's value for infinity. 
 
void checkData_() const 
Test whether the Volume Algorithm can be applied to the given problem. 
 
virtual std::vector< double * > getDualRays(int maxNumRays, bool fullRay=false) const 
Get as many dual rays as the solver can provide. 
 
double * rowprice_
Pointer to dense vector of dual row variable values. 
 
OsiVolMatrixOneMinusOne_ * rowMatrixOneMinusOne_
The row ordered matrix without the elements. 
 
virtual void setRowSetBounds(const int *indexFirst, const int *indexLast, const double *boundList)
Set the bounds on a number of rows simultaneously  The default implementation just invokes setRowLowe...
 
char * rowsense_
Pointer to dense vector of row sense indicators. 
 
bool setStrParam(OsiStrParam key, const std::string &value)
Set a string parameter. 
 
virtual void resolve()
Resolve an LP relaxation after problem modification. 
 
virtual bool isPrimalObjectiveLimitReached() const 
Is the given primal objective limit reached? 
 
static const double OsiTestInfinity
 
int maxNumrows_
allocated size of the row related rim vectors 
 
virtual void solveFromHotStart()
Optimize starting from the hotstart. 
 
void gutsOfDestructor_()
A method deleting every member data. 
 
virtual const double * getRowPrice() const 
Get pointer to array[getNumRows()] of dual prices. 
 
virtual void addRow(const CoinPackedVectorBase &vec, const double rowlb, const double rowub)=0
Add a row (constraint) to the problem. 
 
CoinPackedMatrix rowMatrix_
The problem matrix in a row ordered form. 
 
std::vector< int > OsiVectorInt
Vector of int. 
 
virtual double getObjValue() const 
Get objective function value. 
 
const double COIN_DBL_MAX
 
virtual int solve_subproblem(const VOL_dvector &dual, const VOL_dvector &rc, double &lcost, VOL_dvector &x, VOL_dvector &v, double &pcost)
Solve the subproblem for the subgradient step. 
 
bool setDblParam(OsiDblParam key, double value)
Set a double parameter. 
 
bool test_zero_one_minusone_(const CoinPackedMatrix &m) const 
test whether the given matrix is 0/1/-1 entries only. 
 
virtual void markHotStart()
Create a hotstart point of the optimization process. 
 
OsiVolMatrixOneMinusOne_(const CoinPackedMatrix &m)
 
OsiTestSolverInterface()
Default Constructor. 
 
virtual int getNumCols() const 
Get number of columns. 
 
virtual void setColUpper(int elementIndex, double elementValue)
Set a single column upper bound  Use COIN_DBL_MAX for infinity. 
 
VOL_problem volprob_
The volume solver. 
 
void rowRimAllocator_()
A method allocating sufficient space for the rim vectors corresponding to the rows. 
 
virtual int getNumRows() const 
Get number of rows. 
 
Abstract base class for warm start information. 
 
double * rowpriceHotStart_
An array to store the hotstart information between solveHotStart() calls. 
 
~OsiVolMatrixOneMinusOne_()
 
void initFromRhsSenseRange(const int rownum, const char *rowsen, const double *rowrhs, const double *rowrng)
 
void timesMajor(const double *x, double *y) const 
 
virtual ~OsiTestSolverInterface()
Destructor. 
 
virtual void deleteCols(const int num, const int *colIndices)
Remove a set of columns (primal variables) from the problem. 
 
virtual const double * getRightHandSide() const 
Get pointer to array[getNumRows()] of rows right-hand sides. 
 
OsiVolMatrixOneMinusOne_ * colMatrixOneMinusOne_
The column ordered matrix without the elements.