Osi  0.108.6
OsiGlpkSolverInterface.hpp
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // name: OSI Interface for GLPK
3 //-----------------------------------------------------------------------------
4 // Copyright (C) 2001, Vivian De Smedt, Braden Hunsaker
5 // Copyright (C) 2003 University of Pittsburgh
6 // University of Pittsburgh coding done by Brady Hunsaker
7 // All Rights Reserved.
8 // This code is licensed under the terms of the Eclipse Public License (EPL).
9 
10 #ifndef OsiGlpkSolverInterface_H
11 #define OsiGlpkSolverInterface_H
12 
13 #include <string>
14 #include "OsiSolverInterface.hpp"
15 #include "CoinPackedMatrix.hpp"
16 #include "CoinWarmStartBasis.hpp"
17 
18 extern "C" {
19 #include <glpk.h>
20 }
21 
27 #ifndef LPX
28 #define LPX glp_prob
29 #endif
30 
32  friend void OsiGlpkSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir);
33 
34 public:
35  //---------------------------------------------------------------------------
38  virtual void initialSolve();
40 
42  virtual void resolve();
43 
45  virtual void branchAndBound();
47 
48  //---------------------------------------------------------------------------
64  // Set an integer parameter
65  bool setIntParam(OsiIntParam key, int value);
66  // Set an double parameter
67  bool setDblParam(OsiDblParam key, double value);
68  // Set a string parameter
69  bool setStrParam(OsiStrParam key, const std::string &value);
70  // Set a hint parameter
71  bool setHintParam(OsiHintParam key, bool sense = true,
72  OsiHintStrength strength = OsiHintTry, void *info = 0);
73  // Get an integer parameter
74  bool getIntParam(OsiIntParam key, int &value) const;
75  // Get an double parameter
76  bool getDblParam(OsiDblParam key, double &value) const;
77  // Get a string parameter
78  bool getStrParam(OsiStrParam key, std::string &value) const;
80 
81  //---------------------------------------------------------------------------
83 
84  virtual bool isAbandoned() const;
87  virtual bool isProvenOptimal() const;
89  virtual bool isProvenPrimalInfeasible() const;
91  virtual bool isProvenDualInfeasible() const;
93  virtual bool isPrimalObjectiveLimitReached() const;
95  virtual bool isDualObjectiveLimitReached() const;
97  virtual bool isIterationLimitReached() const;
99  virtual bool isTimeLimitReached() const;
101  virtual bool isFeasible() const;
103 
104  //---------------------------------------------------------------------------
113  inline CoinWarmStart *getEmptyWarmStart() const
114  {
115  return (dynamic_cast< CoinWarmStart * >(new CoinWarmStartBasis()));
116  }
118  virtual CoinWarmStart *getWarmStart() const;
121  virtual bool setWarmStart(const CoinWarmStart *warmstart);
123 
124  //---------------------------------------------------------------------------
131  virtual void markHotStart();
134  virtual void solveFromHotStart();
136  virtual void unmarkHotStart();
138 
139  //---------------------------------------------------------------------------
154  virtual int getNumCols() const;
156 
158  virtual int getNumRows() const;
159 
161  virtual CoinBigIndex getNumElements() const;
162 
164  virtual const double *getColLower() const;
165 
167  virtual const double *getColUpper() const;
168 
178  virtual const char *getRowSense() const;
179 
188  virtual const double *getRightHandSide() const;
189 
198  virtual const double *getRowRange() const;
199 
201  virtual const double *getRowLower() const;
202 
204  virtual const double *getRowUpper() const;
205 
207  virtual const double *getObjCoefficients() const;
208 
210  virtual double getObjSense() const;
211 
213  virtual bool isContinuous(int colNumber) const;
214 
215 #if 0
216  virtual bool isBinary(int columnNumber) const;
218 
223  virtual bool isInteger(int columnNumber) const;
224 
226  virtual bool isIntegerNonBinary(int columnNumber) const;
227 
229  virtual bool isFreeBinary(int columnNumber) const;
230 #endif
231 
233  virtual const CoinPackedMatrix *getMatrixByRow() const;
234 
236  virtual const CoinPackedMatrix *getMatrixByCol() const;
237 
239  virtual double getInfinity() const;
241 
244  virtual const double *getColSolution() const;
246 
248  virtual const double *getRowPrice() const;
249 
251  virtual const double *getReducedCost() const;
252 
255  virtual const double *getRowActivity() const;
256 
258  virtual double getObjValue() const;
259 
262  virtual int getIterationCount() const;
263 
275  virtual std::vector< double * > getDualRays(int maxNumRays,
276  bool fullRay = false) const;
294  virtual std::vector< double * > getPrimalRays(int maxNumRays) const;
295 
296 #if 0
297 
299  virtual OsiVectorInt getFractionalIndices(const double etol=1.e-05)
300  const;
301 #endif
302 
303 
304 
305  //---------------------------------------------------------------------------
306 
309  //-------------------------------------------------------------------------
313  virtual void setObjCoeff(int elementIndex, double elementValue);
314 
318  virtual void setColLower(int elementIndex, double elementValue);
319 
323  virtual void setColUpper(int elementIndex, double elementValue);
324 
328  virtual void setColBounds(int elementIndex,
329  double lower, double upper);
330 
339  virtual void setColSetBounds(const int *indexFirst,
340  const int *indexLast,
341  const double *boundList);
342 
345  virtual void setRowLower(int elementIndex, double elementValue);
346 
349  virtual void setRowUpper(int elementIndex, double elementValue);
350 
354  virtual void setRowBounds(int elementIndex,
355  double lower, double upper);
356 
358  virtual void setRowType(int index, char sense, double rightHandSide,
359  double range);
360 
369  virtual void setRowSetBounds(const int *indexFirst,
370  const int *indexLast,
371  const double *boundList);
372 
383  virtual void setRowSetTypes(const int *indexFirst,
384  const int *indexLast,
385  const char *senseList,
386  const double *rhsList,
387  const double *rangeList);
389 
390  //-------------------------------------------------------------------------
394  virtual void setContinuous(int index);
396  virtual void setInteger(int index);
399  virtual void setContinuous(const int *indices, int len);
402  virtual void setInteger(const int *indices, int len);
404 
405  //-------------------------------------------------------------------------
407  virtual void setObjSense(double s);
408 
419  virtual void setColSolution(const double *colsol);
420 
431  virtual void setRowPrice(const double *rowprice);
432 
433  //-------------------------------------------------------------------------
438 
441  virtual void addCol(const CoinPackedVectorBase &vec,
442  const double collb, const double colub,
443  const double obj);
444 
447  virtual void addCols(const int numcols,
448  const CoinPackedVectorBase *const *cols,
449  const double *collb, const double *colub,
450  const double *obj);
452  virtual void deleteCols(const int num, const int *colIndices);
453 
456  virtual void addRow(const CoinPackedVectorBase &vec,
457  const double rowlb, const double rowub);
459  virtual void addRow(const CoinPackedVectorBase &vec,
460  const char rowsen, const double rowrhs,
461  const double rowrng);
462 
465  virtual void addRows(const int numrows,
466  const CoinPackedVectorBase *const *rows,
467  const double *rowlb, const double *rowub);
469  virtual void addRows(const int numrows,
470  const CoinPackedVectorBase *const *rows,
471  const char *rowsen, const double *rowrhs,
472  const double *rowrng);
474  virtual void deleteRows(const int num, const int *rowIndices);
475 
476 #if 0
477  // ??? implemented in OsiSolverInterface
478  //-----------------------------------------------------------------------
500  virtual ApplyCutsReturnCode applyCuts(const OsiCuts & cs,
501  double effectivenessLb = 0.0);
502 #endif
503 
504 
505 
506  //---------------------------------------------------------------------------
507 
521  virtual void loadProblem(const CoinPackedMatrix &matrix,
522  const double *collb, const double *colub,
523  const double *obj,
524  const double *rowlb, const double *rowub);
525 
533  virtual void assignProblem(CoinPackedMatrix *&matrix,
534  double *&collb, double *&colub, double *&obj,
535  double *&rowlb, double *&rowub);
536 
549  virtual void loadProblem(const CoinPackedMatrix &matrix,
550  const double *collb, const double *colub,
551  const double *obj,
552  const char *rowsen, const double *rowrhs,
553  const double *rowrng);
554 
562  virtual void assignProblem(CoinPackedMatrix *&matrix,
563  double *&collb, double *&colub, double *&obj,
564  char *&rowsen, double *&rowrhs,
565  double *&rowrng);
566 
569  virtual void loadProblem(const int numcols, const int numrows,
570  const CoinBigIndex *start, const int *index,
571  const double *value,
572  const double *collb, const double *colub,
573  const double *obj,
574  const double *rowlb, const double *rowub);
575 
578  virtual void loadProblem(const int numcols, const int numrows,
579  const CoinBigIndex *start, const int *index,
580  const double *value,
581  const double *collb, const double *colub,
582  const double *obj,
583  const char *rowsen, const double *rowrhs,
584  const double *rowrng);
585 
588  virtual int readMps(const char *filename,
589  const char *extension = "mps");
590 
595  virtual void writeMps(const char *filename,
596  const char *extension = "mps",
597  double objSense = 0.0) const;
599 
600  //---------------------------------------------------------------------------
601 
608 
611  void setObjName(std::string name);
612 
618  void setRowName(int ndx, std::string name);
619 
625  void setColName(int ndx, std::string name);
626 
628 
629  //---------------------------------------------------------------------------
630 
656  };
657 
660 
662 
672 
681 
683  static unsigned int getNumInstances() { return numInstances_; }
685 
690 
692  virtual OsiSolverInterface *clone(bool copyData = true) const;
693 
696 
699 
702 
704  virtual void reset();
706 
707 protected:
710  virtual void applyRowCut(const OsiRowCut &rc);
712 
716  virtual void applyColCut(const OsiColCut &cc);
717 
720 
722 
723 private:
726 
728  void gutsOfCopy(const OsiGlpkSolverInterface &source);
729 
732 
735 
738 
741 
744 
747 
749  void freeCachedData(int keepCached = KEEPCACHED_NONE);
750 
753 
755  void printBounds();
756 
758  void fillColBounds() const;
760 
763  mutable LPX *lp_;
765 
767  glp_smcp simplex_params_;
768 
770  glp_iocp integer_params_;
771 
772  // The scale parameter
773  int scale_;
774 
776  static unsigned int numInstances_;
777 
778  // Remember whether simplex or b&b was most recently done
779  // 0 = simplex; 1 = b&b
781 
782  // Int parameters.
789 
790  // Double parameters.
800  double objOffset_;
801 
802  // String parameters
804  std::string probName_;
805 
807  mutable void *info_[OsiLastHintParam];
808 
810 
816  double *hotStartCVal_;
819 
825  double *hotStartRVal_;
828 
829  // Status information
854 
857 
859  mutable int iter_used_;
860 
862  mutable double *obj_;
863 
865  mutable double *collower_;
866 
868  mutable double *colupper_;
869 
871  mutable char *ctype_;
872 
874  mutable char *rowsense_;
875 
877  mutable double *rhs_;
878 
880  mutable double *rowrange_;
881 
883  mutable double *rowlower_;
884 
886  mutable double *rowupper_;
887 
889  mutable double *colsol_;
890 
892  mutable double *rowsol_;
893 
895  mutable double *redcost_;
896 
898  mutable double *rowact_;
899 
901  mutable CoinPackedMatrix *matrixByRow_;
902 
904  mutable CoinPackedMatrix *matrixByCol_;
906 
907 };
908 
909 //#############################################################################
911 void OsiGlpkSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir);
912 
913 #endif // OsiGlpkSolverInterface_H
914 
915 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
916 */
OsiGlpkSolverInterface::getEmptyWarmStart
CoinWarmStart * getEmptyWarmStart() const
Get an empty warm start object.
Definition: OsiGlpkSolverInterface.hpp:113
OsiGlpkSolverInterface::setColName
void setColName(int ndx, std::string name)
Set a column name.
OsiGlpkSolverInterface::KEEPCACHED_MATRIX
@ KEEPCACHED_MATRIX
problem matrix: matrix ordered by column and by row
Definition: OsiGlpkSolverInterface.hpp:641
OsiGlpkSolverInterface::setIntParam
bool setIntParam(OsiIntParam key, int value)
Set an integer parameter.
OsiGlpkSolverInterface::isIterationLimitReached
virtual bool isIterationLimitReached() const
Iteration limit reached?
OsiGlpkSolverInterface::setRowLower
virtual void setRowLower(int elementIndex, double elementValue)
Set a single row lower bound Use -COIN_DBL_MAX for -infinity.
OsiGlpkSolverInterface::setRowType
virtual void setRowType(int index, char sense, double rightHandSide, double range)
Set the type of a single row
OsiSolverInterface::setColUpper
virtual void setColUpper(int elementIndex, double elementValue)=0
Set a single column upper bound.
OsiGlpkSolverInterface::resolve
virtual void resolve()
Resolve an LP relaxation after problem modification.
OsiGlpkSolverInterface::getModelPtr
LPX * getModelPtr()
Get pointer to GLPK model.
OsiHintParam
OsiHintParam
Definition: OsiSolverParameters.hpp:106
OsiGlpkSolverInterface::getNumInstances
static unsigned int getNumInstances()
Return the number of LP/MIP instances of instantiated objects using the GLPK environment.
Definition: OsiGlpkSolverInterface.hpp:683
OsiGlpkSolverInterface::applyColCut
virtual void applyColCut(const OsiColCut &cc)
Apply a column cut (bound adjustment).
OsiGlpkSolverInterface::getNumCols
virtual int getNumCols() const
Get number of columns.
OsiSolverInterface::isBinary
virtual bool isBinary(int colIndex) const
Return true if the variable is binary.
OsiGlpkSolverInterface::addRow
virtual void addRow(const CoinPackedVectorBase &vec, const double rowlb, const double rowub)
Add a row (constraint) to the problem.
OsiGlpkSolverInterface::deleteCols
virtual void deleteCols(const int num, const int *colIndices)
Remove a set of columns (primal variables) from the problem.
OsiGlpkSolverInterface::hotStartCVal_
double * hotStartCVal_
primal variable values
Definition: OsiGlpkSolverInterface.hpp:816
OsiGlpkSolverInterface::primalObjectiveLimit_
double primalObjectiveLimit_
primal objective limit (measure of goodness; stop if we're better)
Definition: OsiGlpkSolverInterface.hpp:794
OsiGlpkSolverInterface::assignProblem
virtual void assignProblem(CoinPackedMatrix *&matrix, double *&collb, double *&colub, double *&obj, char *&rowsen, double *&rowrhs, double *&rowrng)
Load in an problem by assuming ownership of the arguments (the constraints on the rows are given by s...
OsiGlpkSolverInterface::readMps
virtual int readMps(const char *filename, const char *extension="mps")
Read an mps file from the given filename.
OsiGlpkSolverInterface::setRowSetTypes
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()...
OsiGlpkSolverInterface::freeCachedMatrix
void freeCachedMatrix()
free cached matrices
OsiGlpkSolverInterface::gutsOfCopy
void gutsOfCopy(const OsiGlpkSolverInterface &source)
The real work of a copy constructor (used by copy and assignment)
LPX
#define LPX
GPLK Solver Interface.
Definition: OsiGlpkSolverInterface.hpp:28
OsiGlpkSolverInterface::isFeasible
virtual bool isFeasible() const
(Integer) Feasible solution found?
OsiGlpkSolverInterface::setContinuous
virtual void setContinuous(const int *indices, int len)
Set the variables listed in indices (which is of length len) to be continuous variables.
OsiGlpkSolverInterface::isIterationLimitReached_
bool isIterationLimitReached_
glpk stopped on iteration limit
Definition: OsiGlpkSolverInterface.hpp:831
OsiGlpkSolverInterface::freeCachedData
void freeCachedData(int keepCached=KEEPCACHED_NONE)
free all cached data (except specified entries, see getLpPtr())
OsiGlpkSolverInterface::branchAndBound
virtual void branchAndBound()
Invoke solver's built-in enumeration algorithm.
OsiGlpkSolverInterface::obj_
double * obj_
Pointer to objective vector.
Definition: OsiGlpkSolverInterface.hpp:862
OsiGlpkSolverInterface::addRow
virtual void addRow(const CoinPackedVectorBase &vec, const char rowsen, const double rowrhs, const double rowrng)
Add a row (constraint) to the problem.
OsiGlpkSolverInterface::getObjSense
virtual double getObjSense() const
Get objective function sense (1 for min (default), -1 for max)
OsiGlpkSolverInterface::nameDisc_
int nameDisc_
OSI name discipline.
Definition: OsiGlpkSolverInterface.hpp:788
OsiSolverInterface::isInteger
virtual bool isInteger(int colIndex) const
Return true if the variable is integer.
OsiGlpkSolverInterface::KEEPCACHED_COLUMN
@ KEEPCACHED_COLUMN
column information: objective values, lower and upper bounds, variable types
Definition: OsiGlpkSolverInterface.hpp:637
OsiGlpkSolverInterface::isFeasible_
bool isFeasible_
glpk declared the problem feasible
Definition: OsiGlpkSolverInterface.hpp:853
OsiGlpkSolverInterface::colsol_
double * colsol_
Pointer to primal solution vector.
Definition: OsiGlpkSolverInterface.hpp:889
OsiGlpkSolverInterface::getColSolution
virtual const double * getColSolution() const
Get pointer to array[getNumCols()] of primal solution vector.
OsiGlpkSolverInterface::KEEPCACHED_PROBLEM
@ KEEPCACHED_PROBLEM
only discard cached LP solution
Definition: OsiGlpkSolverInterface.hpp:645
OsiGlpkSolverInterface::getStrParam
bool getStrParam(OsiStrParam key, std::string &value) const
Get a string parameter.
OsiGlpkSolverInterface::getObjValue
virtual double getObjValue() const
Get objective function value.
OsiGlpkSolverInterface::FREECACHED_MATRIX
@ FREECACHED_MATRIX
free only cached matrix and LP solution information
Definition: OsiGlpkSolverInterface.hpp:653
OsiGlpkSolverInterface::getMatrixByRow
virtual const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of matrix.
OsiGlpkSolverInterface::printBounds
void printBounds()
Just for testing purposes.
OsiGlpkSolverInterface::getMutableModelPtr
LPX * getMutableModelPtr() const
Pointer to the model.
OsiGlpkSolverInterface::objOffset_
double objOffset_
constant offset for objective function
Definition: OsiGlpkSolverInterface.hpp:800
OsiGlpkSolverInterface::writeMps
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.
OsiGlpkSolverInterface::getRowRange
virtual const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
OsiGlpkSolverInterface::setColLower
virtual void setColLower(int elementIndex, double elementValue)
Set a single column lower bound Use -COIN_DBL_MAX for -infinity.
OsiGlpkSolverInterface::setStrParam
bool setStrParam(OsiStrParam key, const std::string &value)
Set a string parameter.
OsiGlpkSolverInterface::lp_
LPX * lp_
GPLK model represented by this class instance.
Definition: OsiGlpkSolverInterface.hpp:764
OsiGlpkSolverInterface::loadProblem
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...
OsiGlpkSolverInterface::isProvenPrimalInfeasible
virtual bool isProvenPrimalInfeasible() const
Is primal infeasiblity proven?
OsiGlpkSolverInterface::isObjUpperLimitReached_
bool isObjUpperLimitReached_
glpk stopped on upper objective limit
Definition: OsiGlpkSolverInterface.hpp:847
OsiGlpkSolverInterface::isPrimInfeasible_
bool isPrimInfeasible_
glpk declared the problem primal infeasible
Definition: OsiGlpkSolverInterface.hpp:849
OsiGlpkSolverInterface::rowrange_
double * rowrange_
Pointer to dense vector of slack upper bounds for range constraints (undefined for non-range rows)
Definition: OsiGlpkSolverInterface.hpp:880
OsiGlpkSolverInterface::getWarmStart
virtual CoinWarmStart * getWarmStart() const
Get warmstarting information.
OsiSolverInterface::readMps
virtual int readMps(const char *filename, const char *extension="mps")
Read a problem in MPS format from the given filename.
OsiGlpkSolverInterface::dualTolerance_
double dualTolerance_
dual feasibility tolerance
Definition: OsiGlpkSolverInterface.hpp:796
OsiGlpkSolverInterface::freeCachedColRim
void freeCachedColRim()
free cached column rim vectors
OsiHintTry
@ OsiHintTry
This means it is only a hint.
Definition: OsiSolverParameters.hpp:134
OsiGlpkSolverInterface::getIterationCount
virtual int getIterationCount() const
Get how many iterations it took to solve the problem (whatever "iteration" mean to the solver.
OsiGlpkSolverInterface::freeCachedRowRim
void freeCachedRowRim()
free cached row rim vectors
OsiGlpkSolverInterface::isDualInfeasible_
bool isDualInfeasible_
glpk declared the problem dual infeasible
Definition: OsiGlpkSolverInterface.hpp:851
OsiGlpkSolverInterface::markHotStart
virtual void markHotStart()
Create a hotstart point of the optimization process.
OsiGlpkSolverInterface::getDualRays
virtual std::vector< double * > getDualRays(int maxNumRays, bool fullRay=false) const
Get as many dual rays as the solver can provide.
OsiGlpkSolverInterface::setWarmStart
virtual bool setWarmStart(const CoinWarmStart *warmstart)
Set warmstarting information.
OsiSolverInterface::isFreeBinary
virtual bool isFreeBinary(int colIndex) const
Return true if the variable is binary and not fixed.
OsiGlpkSolverInterface::iter_used_
int iter_used_
Number of iterations.
Definition: OsiGlpkSolverInterface.hpp:859
OsiGlpkSolverInterfaceUnitTest
void OsiGlpkSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir)
A function that tests the methods in the OsiGlpkSolverInterface class.
OsiGlpkSolverInterface::hotStartCStat_
int * hotStartCStat_
column status array
Definition: OsiGlpkSolverInterface.hpp:814
OsiGlpkSolverInterface::setInteger
virtual void setInteger(const int *indices, int len)
Set the variables listed in indices (which is of length len) to be integer variables.
OsiGlpkSolverInterface::setRowUpper
virtual void setRowUpper(int elementIndex, double elementValue)
Set a single row upper bound Use COIN_DBL_MAX for infinity.
OsiGlpkSolverInterface::maxIteration_
int maxIteration_
simplex iteration limit (per call to solver)
Definition: OsiGlpkSolverInterface.hpp:784
OsiCuts
Collections of row cuts and column cuts.
Definition: OsiCuts.hpp:19
OsiGlpkSolverInterface::loadProblem
virtual void loadProblem(const int numcols, const int numrows, const CoinBigIndex *start, const int *index, const double *value, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub)
Just like the other loadProblem() methods except that the matrix is given in a standard column major ...
OsiSolverInterface::addRows
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.
OsiGlpkSolverInterface::hotStartCStatSize_
int hotStartCStatSize_
Hotstart information.
Definition: OsiGlpkSolverInterface.hpp:812
OsiGlpkSolverInterface::isAbandoned
virtual bool isAbandoned() const
Are there a numerical difficulties?
OsiGlpkSolverInterface::setObjCoeff
virtual void setObjCoeff(int elementIndex, double elementValue)
Set an objective function coefficient.
OsiGlpkSolverInterface::numInstances_
static unsigned int numInstances_
number of GLPK instances currently in use (counts only those created by OsiGlpk)
Definition: OsiGlpkSolverInterface.hpp:776
OsiGlpkSolverInterface::primalTolerance_
double primalTolerance_
primal feasibility tolerance
Definition: OsiGlpkSolverInterface.hpp:798
OsiGlpkSolverInterface::rowlower_
double * rowlower_
Pointer to dense vector of row lower bounds.
Definition: OsiGlpkSolverInterface.hpp:883
OsiGlpkSolverInterface::isPrimalObjectiveLimitReached
virtual bool isPrimalObjectiveLimitReached() const
Is the given primal objective limit reached?
OsiGlpkSolverInterface::bbWasLast_
int bbWasLast_
Definition: OsiGlpkSolverInterface.hpp:780
OsiGlpkSolverInterface::getRowLower
virtual const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
OsiColCut
Column Cut Class.
Definition: OsiColCut.hpp:23
OsiGlpkSolverInterface::setObjSense
virtual void setObjSense(double s)
Set objective function sense (1 for min (default), -1 for max,)
OsiGlpkSolverInterface::setInteger
virtual void setInteger(int index)
Set the index-th variable to be an integer variable.
OsiGlpkSolverInterface::isDualObjectiveLimitReached
virtual bool isDualObjectiveLimitReached() const
Is the given dual objective limit reached?
OsiSolverInterface::isIntegerNonBinary
virtual bool isIntegerNonBinary(int colIndex) const
Return true if the variable is general integer.
OsiGlpkSolverInterface::KEEPCACHED_NONE
@ KEEPCACHED_NONE
discard all cached data (default)
Definition: OsiGlpkSolverInterface.hpp:635
OsiGlpkSolverInterface::rhs_
double * rhs_
Pointer to dense vector of row right-hand side values.
Definition: OsiGlpkSolverInterface.hpp:877
OsiGlpkSolverInterface::getDblParam
bool getDblParam(OsiDblParam key, double &value) const
Get a double parameter.
OsiGlpkSolverInterface::rowsol_
double * rowsol_
Pointer to dual solution vector.
Definition: OsiGlpkSolverInterface.hpp:892
OsiGlpkSolverInterface::FREECACHED_ROW
@ FREECACHED_ROW
free only cached row and LP solution information
Definition: OsiGlpkSolverInterface.hpp:651
OsiGlpkSolverInterface::hotStartRVal_
double * hotStartRVal_
row slack values
Definition: OsiGlpkSolverInterface.hpp:825
OsiGlpkSolverInterface::getMatrixByCol
virtual const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of matrix.
OsiGlpkSolverInterface::isProvenDualInfeasible
virtual bool isProvenDualInfeasible() const
Is dual infeasiblity proven?
OsiGlpkSolverInterface::loadProblem
virtual void loadProblem(const CoinPackedMatrix &matrix, const double *collb, const double *colub, const double *obj, const char *rowsen, const double *rowrhs, const double *rowrng)
Load in an problem by copying the arguments (the constraints on the rows are given by sense/rhs/range...
OsiGlpkSolverInterface::OsiGlpkSolverInterface
OsiGlpkSolverInterface()
Default Constructor.
OsiGlpkSolverInterface::hotStartRStatSize_
int hotStartRStatSize_
size of row status and value arrays
Definition: OsiGlpkSolverInterface.hpp:821
OsiGlpkSolverInterface::keepCachedFlag
keepCachedFlag
Definition: OsiGlpkSolverInterface.hpp:633
OsiSolverInterface::addCol
virtual void addCol(const CoinPackedVectorBase &vec, const double collb, const double colub, const double obj)=0
Add a column (primal variable) to the problem.
OsiGlpkSolverInterface::getPrimalRays
virtual std::vector< double * > getPrimalRays(int maxNumRays) const
Get as many primal rays as the solver can provide.
OsiGlpkSolverInterface::ctype_
char * ctype_
Pointer to dense vector of variable types (continous, binary, integer)
Definition: OsiGlpkSolverInterface.hpp:871
OsiRowCut
Row Cut Class.
Definition: OsiRowCut.hpp:29
OsiGlpkSolverInterface::gutsOfConstructor
void gutsOfConstructor()
The real work of the constructor.
OsiGlpkSolverInterface::KEEPCACHED_RESULTS
@ KEEPCACHED_RESULTS
LP solution: primal and dual solution, reduced costs, row activities.
Definition: OsiGlpkSolverInterface.hpp:643
OsiGlpkSolverInterface::getRowActivity
virtual const double * getRowActivity() const
Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vecto...
OsiGlpkSolverInterface::FREECACHED_COLUMN
@ FREECACHED_COLUMN
free only cached column and LP solution information
Definition: OsiGlpkSolverInterface.hpp:649
OsiGlpkSolverInterface::setColUpper
virtual void setColUpper(int elementIndex, double elementValue)
Set a single column upper bound Use COIN_DBL_MAX for infinity.
OsiGlpkSolverInterface::applyRowCut
virtual void applyRowCut(const OsiRowCut &rc)
Apply a row cut. Return true if cut was applied.
OsiGlpkSolverInterface::redcost_
double * redcost_
Pointer to reduced cost vector.
Definition: OsiGlpkSolverInterface.hpp:895
OsiGlpkSolverInterface::collower_
double * collower_
Pointer to dense vector of variable lower bounds.
Definition: OsiGlpkSolverInterface.hpp:865
OsiGlpkSolverInterface::isContinuous
virtual bool isContinuous(int colNumber) const
Return true if column is continuous.
OsiIntParam
OsiIntParam
Definition: OsiSolverParameters.hpp:8
OsiGlpkSolverInterface::setObjName
void setObjName(std::string name)
Set the objective function name.
OsiGlpkSolverInterface::setRowSetBounds
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...
OsiGlpkSolverInterface::rowsense_
char * rowsense_
Pointer to dense vector of row sense indicators.
Definition: OsiGlpkSolverInterface.hpp:874
OsiGlpkSolverInterface::dualObjectiveLimit_
double dualObjectiveLimit_
dual objective limit (measure of badness; stop if we're worse)
Definition: OsiGlpkSolverInterface.hpp:792
OsiGlpkSolverInterface::gutsOfDestructor
void gutsOfDestructor()
The real work of the destructor.
OsiLastHintParam
@ OsiLastHintParam
Just a marker, so that OsiSolverInterface can allocate a static sized array to store parameters.
Definition: OsiSolverParameters.hpp:127
OsiGlpkSolverInterface::getRowUpper
virtual const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
OsiVectorInt
std::vector< int > OsiVectorInt
Vector of int.
Definition: OsiCollections.hpp:20
OsiGlpkSolverInterface::hotStartRDualVal_
double * hotStartRDualVal_
row dual values
Definition: OsiGlpkSolverInterface.hpp:827
OsiSolverInterface::ApplyCutsReturnCode
Internal class for obtaining status from the applyCuts method.
Definition: OsiSolverInterface.hpp:72
OsiGlpkSolverInterface::setColSolution
virtual void setColSolution(const double *colsol)
Set the primal solution column values.
OsiGlpkSolverInterface::KEEPCACHED_ROW
@ KEEPCACHED_ROW
row information: right hand sides, ranges and senses, lower and upper bounds for row
Definition: OsiGlpkSolverInterface.hpp:639
OsiGlpkSolverInterface::getRightHandSide
virtual const double * getRightHandSide() const
Get pointer to array[getNumRows()] of rows right-hand sides.
OsiGlpkSolverInterface::setHintParam
bool setHintParam(OsiHintParam key, bool sense=true, OsiHintStrength strength=OsiHintTry, void *info=0)
Set a hint parameter.
OsiGlpkSolverInterface::isAbandoned_
bool isAbandoned_
glpk abandoned the problem
Definition: OsiGlpkSolverInterface.hpp:835
OsiGlpkSolverInterface::getObjCoefficients
virtual const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
OsiGlpkSolverInterface::rowact_
double * rowact_
Pointer to row activity (slack) vector.
Definition: OsiGlpkSolverInterface.hpp:898
OsiGlpkSolverInterface::KEEPCACHED_ALL
@ KEEPCACHED_ALL
keep all cached data (similar to getMutableLpPtr())
Definition: OsiGlpkSolverInterface.hpp:647
OsiGlpkSolverInterface::getIntParam
bool getIntParam(OsiIntParam key, int &value) const
Get an integer parameter.
OsiGlpkSolverInterface::incrementInstanceCounter
static void incrementInstanceCounter()
GLPK has a context which must be freed after all GLPK LPs (or MIPs) are freed.
Definition: OsiGlpkSolverInterface.hpp:671
OsiGlpkSolverInterface::loadProblem
virtual void loadProblem(const int numcols, const int numrows, const CoinBigIndex *start, const int *index, const double *value, const double *collb, const double *colub, const double *obj, const char *rowsen, const double *rowrhs, const double *rowrng)
Just like the other loadProblem() methods except that the matrix is given in a standard column major ...
OsiDblParam
OsiDblParam
Definition: OsiSolverParameters.hpp:52
OsiGlpkSolverInterface::FREECACHED_RESULTS
@ FREECACHED_RESULTS
free only cached LP solution information
Definition: OsiGlpkSolverInterface.hpp:655
OsiGlpkSolverInterface::deleteRows
virtual void deleteRows(const int num, const int *rowIndices)
Delete a set of rows (constraints) from the problem.
OsiGlpkSolverInterface::OsiGlpkSolverInterface
OsiGlpkSolverInterface(const OsiGlpkSolverInterface &)
Copy constructor.
OsiSolverInterface.hpp
OsiGlpkSolverInterface::addCol
virtual void addCol(const CoinPackedVectorBase &vec, const double collb, const double colub, const double obj)
Add a column (primal variable) to the problem.
OsiGlpkSolverInterface::setDblParam
bool setDblParam(OsiDblParam key, double value)
Set a double parameter.
OsiGlpkSolverInterface::hotStartCDualVal_
double * hotStartCDualVal_
dual variable values
Definition: OsiGlpkSolverInterface.hpp:818
OsiGlpkSolverInterface::getNumElements
virtual CoinBigIndex getNumElements() const
Get number of nonzero elements.
OsiGlpkSolverInterface::isProvenOptimal
virtual bool isProvenOptimal() const
Is optimality proven?
OsiGlpkSolverInterface::colupper_
double * colupper_
Pointer to dense vector of variable lower bounds.
Definition: OsiGlpkSolverInterface.hpp:868
OsiGlpkSolverInterface::getNumRows
virtual int getNumRows() const
Get number of rows.
OsiGlpkSolverInterface::getReducedCost
virtual const double * getReducedCost() const
Get a pointer to array[getNumCols()] of reduced costs.
OsiGlpkSolverInterface::assignProblem
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...
OsiGlpkSolverInterface::clone
virtual OsiSolverInterface * clone(bool copyData=true) const
Clone.
OsiGlpkSolverInterface::freeAllMemory
void freeAllMemory()
free all allocated memory
OsiGlpkSolverInterface::isTimeLimitReached
virtual bool isTimeLimitReached() const
Time limit reached?
OsiGlpkSolverInterface::matrixByRow_
CoinPackedMatrix * matrixByRow_
Pointer to row-wise copy of problem matrix coefficients.
Definition: OsiGlpkSolverInterface.hpp:901
OsiGlpkSolverInterface::operator=
OsiGlpkSolverInterface & operator=(const OsiGlpkSolverInterface &rhs)
Assignment operator.
OsiGlpkSolverInterface::matrixByCol_
CoinPackedMatrix * matrixByCol_
Pointer to row-wise copy of problem matrix coefficients.
Definition: OsiGlpkSolverInterface.hpp:904
OsiGlpkSolverInterface::getColLower
virtual const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
OsiGlpkSolverInterface::setRowPrice
virtual void setRowPrice(const double *rowprice)
Set dual solution vector.
OsiHintStrength
OsiHintStrength
Definition: OsiSolverParameters.hpp:130
OsiGlpkSolverInterface::addCols
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.
OsiGlpkSolverInterface::fillColBounds
void fillColBounds() const
Fill cached collumn bounds.
OsiSolverInterface::addCols
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.
OsiGlpkSolverInterface::probName_
std::string probName_
Problem name.
Definition: OsiGlpkSolverInterface.hpp:804
OsiGlpkSolverInterface::setRowName
void setRowName(int ndx, std::string name)
Set a row name.
OsiGlpkSolverInterface::integer_params_
glp_iocp integer_params_
Parameters passed to the integer solver.
Definition: OsiGlpkSolverInterface.hpp:770
OsiGlpkSolverInterface::addRows
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.
OsiGlpkSolverInterface::setRowBounds
virtual void setRowBounds(int elementIndex, double lower, double upper)
Set a single row lower and upper bound The default implementation just invokes setRowLower() and set...
OsiGlpkSolverInterface::getInfinity
virtual double getInfinity() const
Get solver's value for infinity.
OsiGlpkSolverInterface::solveFromHotStart
virtual void solveFromHotStart()
Optimize starting from the hotstart.
OsiGlpkSolverInterface::simplex_params_
glp_smcp simplex_params_
Parameters passed to the simplex solver.
Definition: OsiGlpkSolverInterface.hpp:767
OsiGlpkSolverInterface::getRowPrice
virtual const double * getRowPrice() const
Get pointer to array[getNumRows()] of dual prices.
OsiGlpkSolverInterface::getRowSense
virtual const char * getRowSense() const
Get pointer to array[getNumRows()] of row constraint senses.
OsiGlpkSolverInterface::decrementInstanceCounter
static void decrementInstanceCounter()
GLPK has a context which must be freed after all GLPK LPs (or MIPs) are freed.
OsiGlpkSolverInterface::freeCachedResults
void freeCachedResults()
free cached result vectors
OsiGlpkSolverInterface::getColUpper
virtual const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
OsiSolverInterface::getFractionalIndices
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...
OsiSolverInterface::setColLower
virtual void setColLower(int elementIndex, double elementValue)=0
Set a single column lower bound.
OsiSolverInterface::applyCuts
virtual ApplyCutsReturnCode applyCuts(const OsiCuts &cs, double effectivenessLb=0.0)
Apply a collection of cuts.
OsiGlpkSolverInterface::scale_
int scale_
Definition: OsiGlpkSolverInterface.hpp:773
OsiGlpkSolverInterface::~OsiGlpkSolverInterface
virtual ~OsiGlpkSolverInterface()
Destructor.
OsiGlpkSolverInterface::hotStartRStat_
int * hotStartRStat_
row status array
Definition: OsiGlpkSolverInterface.hpp:823
OsiSolverInterface::addRow
virtual void addRow(const CoinPackedVectorBase &vec, const double rowlb, const double rowub)=0
Add a row (constraint) to the problem.
OsiGlpkSolverInterface
Definition: OsiGlpkSolverInterface.hpp:31
OsiGlpkSolverInterface::isTimeLimitReached_
bool isTimeLimitReached_
glpk stopped on time limit
Definition: OsiGlpkSolverInterface.hpp:833
OsiGlpkSolverInterface::addRows
virtual void addRows(const int numrows, const CoinPackedVectorBase *const *rows, const char *rowsen, const double *rowrhs, const double *rowrng)
Add a set of rows (constraints) to the problem.
OsiGlpkSolverInterface::setContinuous
virtual void setContinuous(int index)
Set the index-th variable to be a continuous variable.
OsiGlpkSolverInterface::setColBounds
virtual void setColBounds(int elementIndex, double lower, double upper)
Set a single column lower and upper bound The default implementation just invokes setColLower() and ...
OsiGlpkSolverInterface::isObjLowerLimitReached_
bool isObjLowerLimitReached_
glpk stopped on lower objective limit
Definition: OsiGlpkSolverInterface.hpp:841
OsiGlpkSolverInterface::initialSolve
virtual void initialSolve()
Solve initial LP relaxation.
OsiGlpkSolverInterface::reset
virtual void reset()
Resets as if default constructor.
OsiSolverInterface
Abstract Base Class for describing an interface to a solver.
Definition: OsiSolverInterface.hpp:61
OsiGlpkSolverInterface::setColSetBounds
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...
OsiGlpkSolverInterface::OsiGlpkSolverInterfaceUnitTest
friend void OsiGlpkSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir)
A function that tests the methods in the OsiGlpkSolverInterface class.
OsiGlpkSolverInterface::unmarkHotStart
virtual void unmarkHotStart()
Delete the snapshot.
OsiGlpkSolverInterface::info_
void * info_[OsiLastHintParam]
Array for info blocks associated with hints.
Definition: OsiGlpkSolverInterface.hpp:807
OsiGlpkSolverInterface::hotStartMaxIteration_
int hotStartMaxIteration_
simplex iteration limit (for hot start)
Definition: OsiGlpkSolverInterface.hpp:786
OsiStrParam
OsiStrParam
Definition: OsiSolverParameters.hpp:87
OsiGlpkSolverInterface::rowupper_
double * rowupper_
Pointer to dense vector of row upper bounds.
Definition: OsiGlpkSolverInterface.hpp:886