Osi  0.107.9
OsiGrbSolverInterface.hpp
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // name: OSI Interface for Gurobi
3 // template: OSI Cplex Interface written by T. Achterberg
4 // author: Stefan Vigerske
5 // Humboldt University Berlin
6 // date: 09/02/2009
7 // license: this file may be freely distributed under the terms of EPL
8 // comments: please scan this file for '???' and read the comments
9 //-----------------------------------------------------------------------------
10 // Copyright (C) 2009 Humboldt University Berlin and others.
11 // All Rights Reserved.
12 
13 // $Id: OsiGrbSolverInterface.hpp 1830 2011-11-26 16:46:55Z stefan $
14 
15 #ifndef OsiGrbSolverInterface_H
16 #define OsiGrbSolverInterface_H
17 
18 #include <string>
19 #include "OsiSolverInterface.hpp"
20 
21 typedef struct _GRBmodel GRBmodel;
22 typedef struct _GRBenv GRBenv;
23 
29 class OsiGrbSolverInterface : virtual public OsiSolverInterface {
30  friend void OsiGrbSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir);
31 
32 public:
33 
34  //---------------------------------------------------------------------------
37  virtual void initialSolve();
39 
41  virtual void resolve();
42 
44  virtual void branchAndBound();
46 
47  //---------------------------------------------------------------------------
63  // Set an integer parameter
64  bool setIntParam(OsiIntParam key, int value);
65  // Set an double parameter
66  bool setDblParam(OsiDblParam key, double value);
67  // Set a string parameter
68  bool setStrParam(OsiStrParam key, const std::string & value);
69  // Set a hint parameter
70  bool setHintParam(OsiHintParam key, bool yesNo = true, OsiHintStrength strength = OsiHintTry, void* = NULL);
71  // Get an integer parameter
72  bool getIntParam(OsiIntParam key, int& value) const;
73  // Get an double parameter
74  bool getDblParam(OsiDblParam key, double& value) const;
75  // Get a string parameter
76  bool getStrParam(OsiStrParam key, std::string& value) const;
77  // Get a hint parameter
78  bool getHintParam(OsiHintParam key, bool& yesNo, OsiHintStrength& strength, void*& otherInformation) const;
79  // Get a hint parameter
80  bool getHintParam(OsiHintParam key, bool& yesNo, OsiHintStrength& strength) const;
81  // Get a hint parameter
82  bool getHintParam(OsiHintParam key, bool& yesNo) const;
83  // Set mipstart option (pass column solution to CPLEX before MIP start)
84  void setMipStart(bool value) { domipstart = value; }
85  // Get mipstart option value
86  bool getMipStart() const { return domipstart; }
88 
89  //---------------------------------------------------------------------------
91 
92  virtual bool isAbandoned() const;
95  virtual bool isProvenOptimal() const;
97  virtual bool isProvenPrimalInfeasible() const;
99  virtual bool isProvenDualInfeasible() const;
101  virtual bool isPrimalObjectiveLimitReached() const;
103  virtual bool isDualObjectiveLimitReached() const;
105  virtual bool isIterationLimitReached() const;
107 
108  //---------------------------------------------------------------------------
111 
118  CoinWarmStart* getEmptyWarmStart() const;
119 
121  virtual CoinWarmStart* getWarmStart() const;
124  virtual bool setWarmStart(const CoinWarmStart* warmstart);
126 
127  //---------------------------------------------------------------------------
134  virtual void markHotStart();
137  virtual void solveFromHotStart();
139  virtual void unmarkHotStart();
141 
142  //---------------------------------------------------------------------------
157  virtual int getNumCols() const;
159 
161  virtual int getNumRows() const;
162 
164  virtual int getNumElements() const;
165 
167  virtual const double * getColLower() const;
168 
170  virtual const double * getColUpper() const;
171 
181  virtual const char * getRowSense() const;
182 
191  virtual const double * getRightHandSide() const;
192 
201  virtual const double * getRowRange() const;
202 
204  virtual const double * getRowLower() const;
205 
207  virtual const double * getRowUpper() const;
208 
210  virtual const double * getObjCoefficients() const;
211 
213  virtual double getObjSense() const;
214 
216  virtual bool isContinuous(int colNumber) const;
217 
219  virtual const CoinPackedMatrix * getMatrixByRow() const;
220 
222  virtual const CoinPackedMatrix * getMatrixByCol() const;
223 
225  virtual double getInfinity() const;
227 
230  virtual const double * getColSolution() const;
232 
234  virtual const double * getRowPrice() const;
235 
237  virtual const double * getReducedCost() const;
238 
241  virtual const double * getRowActivity() const;
242 
244  virtual double getObjValue() const;
245 
248  virtual int getIterationCount() const;
249 
267  virtual std::vector<double*> getDualRays(int maxNumRays,
268  bool fullRay=false) const;
280  virtual std::vector<double*> getPrimalRays(int maxNumRays) const;
282 
283 
284  //---------------------------------------------------------------------------
285 
288  //-------------------------------------------------------------------------
292  virtual void setObjCoeff(int elementIndex, double elementValue);
293 
295  virtual void setObjCoeffSet(const int* indexFirst, const int* indexLast,
296  const double* coeffList);
297 
301  virtual void setColLower(int elementIndex, double elementValue);
302 
306  virtual void setColUpper(int elementIndex, double elementValue);
307 
311  virtual void setColBounds(int elementIndex, double lower, double upper);
312 
320  virtual void setColSetBounds(const int* indexFirst, const int* indexLast,
321  const double* boundList);
322 
325  virtual void setRowLower(int elementIndex, double elementValue);
326 
329  virtual void setRowUpper(int elementIndex, double elementValue);
330 
334  virtual void setRowBounds(int elementIndex, double lower, double upper);
335 
337  virtual void setRowType(int index, char sense, double rightHandSide,
338  double range);
339 
347  virtual void setRowSetBounds(const int* indexFirst, const int* indexLast,
348  const double* boundList);
349 
359  virtual void setRowSetTypes(const int* indexFirst, const int* indexLast,
360  const char* senseList, const double* rhsList, const double* rangeList);
362 
363  //-------------------------------------------------------------------------
367  virtual void setContinuous(int index);
369  virtual void setInteger(int index);
372  virtual void setContinuous(const int* indices, int len);
375  virtual void setInteger(const int* indices, int len);
377 
378  //-------------------------------------------------------------------------
382  virtual void setRowName(int ndx, std::string name) ;
383 
385  virtual void setColName(int ndx, std::string name) ;
387 
388  //-------------------------------------------------------------------------
390  virtual void setObjSense(double s);
391 
402  virtual void setColSolution(const double * colsol);
403 
414  virtual void setRowPrice(const double * rowprice);
415 
416  //-------------------------------------------------------------------------
423  virtual void addCol(const CoinPackedVectorBase& vec, const double collb,
424  const double colub, const double obj);
425 
428  virtual void addCols(const int numcols,
429  const CoinPackedVectorBase * const * cols, const double* collb,
430  const double* colub, const double* obj);
432  virtual void deleteCols(const int num, const int * colIndices);
433 
436  virtual void addRow(const CoinPackedVectorBase& vec, const double rowlb,
437  const double rowub);
439  virtual void addRow(const CoinPackedVectorBase& vec, const char rowsen,
440  const double rowrhs, const double rowrng);
441 
444  virtual void addRows(const int numrows,
445  const CoinPackedVectorBase * const * rows, const double* rowlb,
446  const double* rowub);
448  virtual void addRows(const int numrows,
449  const CoinPackedVectorBase * const * rows, const char* rowsen,
450  const double* rowrhs, const double* rowrng);
452  virtual void deleteRows(const int num, const int * rowIndices);
454 
455 
456  //---------------------------------------------------------------------------
457 
471  virtual void loadProblem(const CoinPackedMatrix& matrix, const double* collb,
472  const double* colub, const double* obj, const double* rowlb,
473  const double* rowub);
474 
482  virtual void assignProblem(CoinPackedMatrix*& matrix, double*& collb,
483  double*& colub, double*& obj, double*& rowlb, double*& rowub);
484 
497  virtual void loadProblem(const CoinPackedMatrix& matrix, const double* collb,
498  const double* colub, const double* obj, const char* rowsen,
499  const double* rowrhs, const double* rowrng);
500 
508  virtual void assignProblem(CoinPackedMatrix*& matrix, double*& collb,
509  double*& colub, double*& obj, char*& rowsen, double*& rowrhs,
510  double*& rowrng);
511 
514  virtual void loadProblem(const int numcols, const int numrows,
515  const int* start, const int* index, const double* value,
516  const double* collb, const double* colub, const double* obj,
517  const double* rowlb, const double* rowub);
518 
521  virtual void loadProblem(const int numcols, const int numrows,
522  const int* start, const int* index, const double* value,
523  const double* collb, const double* colub, const double* obj,
524  const char* rowsen, const double* rowrhs, const double* rowrng);
525 
528  virtual int readMps(const char *filename, const char *extension = "mps");
529 
534  virtual void writeMps(const char *filename, const char *extension = "mps",
535  double objSense=0.0) const;
536 
538 
539  //---------------------------------------------------------------------------
540 
547  {
570  };
571 
572  GRBmodel* getLpPtr(int keepCached = KEEPCACHED_NONE);
573 
575  GRBenv* getEnvironmentPtr() const;
577 
579  bool isDemoLicense() const;
581 
583  const char* getCtype() const;
584 
595 
605 
607  static void setEnvironment(GRBenv* globalenv);
608 
610  static unsigned int getNumInstances();
612 
613 
616  OsiGrbSolverInterface(bool use_local_env = false);
618 
621 
623  virtual OsiSolverInterface * clone(bool copyData = true) const;
624 
627 
630 
633 
635  virtual void reset();
637 
638  /***************************************************************************/
655 
659  virtual int canDoSimplexInterface() const;
660 
665  virtual void enableSimplexInterface(int doingPrimal) {
666  }
667  ;
668 
672  virtual void disableSimplexInterface() {
673  }
674  ;
675 
679  virtual void enableFactorization() const {
680  }
681  ;
682 
686  virtual void disableFactorization() const {
687  }
688  ;
689 
691  virtual bool basisIsAvailable() const;
692 
696  virtual void getBasisStatus(int* cstat, int* rstat) const;
697 
698  // ///Get a row of the tableau (slack part in slack if not NULL)
699  // virtual void getBInvARow(int row, double* z, double * slack=NULL) const;
700  //
701  // ///Get a row of the basis inverse
702  // virtual void getBInvRow(int row, double* z) const;
703  //
704  // ///Get a column of the tableau
705  // virtual void getBInvACol(int col, double* vec) const;
706  //
707  // ///Get a column of the basis inverse
708  // virtual void getBInvCol(int col, double* vec) const;
709  //
710  // /** Get indices of the pivot variable in each row
711  // (order of indices corresponds to the
712  // order of elements in a vector retured by getBInvACol() and
713  // getBInvCol()).
714  // */
715  // virtual void getBasics(int* index) const;
717  void switchToLP();
718 
720  void switchToMIP();
721 
723  /***************************************************************************/
724 
725  /***************************************************************************/
726 
750  double effectivenessLb = 0.0);
751 
752 protected:
753 
756  virtual void applyRowCut(const OsiRowCut & rc);
758 
762  virtual void applyColCut(const OsiColCut & cc);
764 
765 private:
768  void resizeColSpace(int minsize);
770 
772  void freeColSpace();
773 
775  void resizeAuxColSpace(int minsize);
776 
780 
783  static GRBenv* globalenv_;
786  static bool globalenv_is_ours;
788  static unsigned int numInstances_;
790 
793 
796 
798  void gutsOfCopy(const OsiGrbSolverInterface & source);
799 
802 
805 
808 
811 
814 
817 
819  void freeCachedData(int keepCached = KEEPCACHED_NONE);
820 
823 
825  void convertToRangedRow(int rowidx, double rhs, double range);
826 
828  void convertToNormalRow(int rowidx, char sense, double rhs);
830 
831 
834  mutable GRBenv* localenv_;
836 
838  mutable GRBmodel* lp_;
839 
846 
849 
852  mutable double *obj_;
854 
856  mutable double *collower_;
857 
859  mutable double *colupper_;
860 
862  mutable char *rowsense_;
863 
865  mutable double *rhs_;
866 
868  mutable double *rowrange_;
869 
871  mutable double *rowlower_;
872 
874  mutable double *rowupper_;
875 
877  mutable double *colsol_;
878 
880  mutable double *rowsol_;
881 
883  mutable double *redcost_;
884 
886  mutable double *rowact_;
887 
889  mutable CoinPackedMatrix *matrixByRow_;
890 
892  mutable CoinPackedMatrix *matrixByCol_;
894 
897  mutable bool probtypemip_;
899 
902 
905 
907  char *coltype_;
908 
910  int nauxcols;
911 
914 
918 
924 
927 
931  int* auxcolind;
933 };
934 
935 //#############################################################################
937 void OsiGrbSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir);
938 
939 #endif
OsiGrbSolverInterface::auxcolindspace
int auxcolindspace
Current length of auxcolind array.
Definition: OsiGrbSolverInterface.hpp:926
OsiGrbSolverInterface::getMatrixByRow
virtual const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of matrix.
OsiGrbSolverInterface::FREECACHED_ROW
@ FREECACHED_ROW
free only cached row and LP solution information
Definition: OsiGrbSolverInterface.hpp:565
OsiGrbSolverInterface::convertToRangedRow
void convertToRangedRow(int rowidx, double rhs, double range)
converts a normal row into a ranged row by adding an auxiliary variable
OsiGrbSolverInterface::setInteger
virtual void setInteger(int index)
Set the index-th variable to be an integer variable.
OsiGrbSolverInterface::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...
OsiGrbSolverInterface::globalenv_
static GRBenv * globalenv_
Gurobi environment pointer.
Definition: OsiGrbSolverInterface.hpp:784
OsiGrbSolverInterface::isAbandoned
virtual bool isAbandoned() const
Are there a numerical difficulties?
OsiGrbSolverInterface::FREECACHED_COLUMN
@ FREECACHED_COLUMN
free only cached column and LP solution information
Definition: OsiGrbSolverInterface.hpp:563
OsiSolverInterface::setColUpper
virtual void setColUpper(int elementIndex, double elementValue)=0
Set a single column upper bound.
OsiSolverInterface::enableSimplexInterface
virtual void enableSimplexInterface(bool doingPrimal)
Enables normal operation of subsequent functions.
OsiHintParam
OsiHintParam
Definition: OsiSolverParameters.hpp:107
OsiGrbSolverInterface::numInstances_
static unsigned int numInstances_
Number of instances using the global Gurobi environment.
Definition: OsiGrbSolverInterface.hpp:788
OsiGrbSolverInterface::obj_
double * obj_
Pointer to objective vector.
Definition: OsiGrbSolverInterface.hpp:853
OsiGrbSolverInterface::setObjSense
virtual void setObjSense(double s)
Set objective function sense (1 for min (default), -1 for max,)
OsiGrbSolverInterface::gutsOfDestructor
void gutsOfDestructor()
The real work of the destructor.
OsiGrbSolverInterface::OsiGrbSolverInterface
OsiGrbSolverInterface(GRBenv *localgrbenv)
Constructor that takes a gurobi environment and assumes membership.
OsiGrbSolverInterface::setObjCoeff
virtual void setObjCoeff(int elementIndex, double elementValue)
Set an objective function coefficient.
OsiGrbSolverInterface::setContinuous
virtual void setContinuous(int index)
Set the index-th variable to be a continuous variable.
OsiGrbSolverInterface::getLpPtr
GRBmodel * getLpPtr(int keepCached=KEEPCACHED_NONE)
OsiGrbSolverInterface::probtypemip_
bool probtypemip_
Stores whether we currently see the problem as a MIP.
Definition: OsiGrbSolverInterface.hpp:898
OsiGrbSolverInterface::rowupper_
double * rowupper_
Pointer to dense vector of row upper bounds.
Definition: OsiGrbSolverInterface.hpp:874
OsiGrbSolverInterface::enableFactorization
virtual void enableFactorization() const
Useless function, defined only for compatibility with OsiSimplexInterface.
Definition: OsiGrbSolverInterface.hpp:679
OsiGrbSolverInterface::isContinuous
virtual bool isContinuous(int colNumber) const
Return true if column is continuous.
OsiGrbSolverInterface::KEEPCACHED_PROBLEM
@ KEEPCACHED_PROBLEM
only discard cached LP solution
Definition: OsiGrbSolverInterface.hpp:559
OsiGrbSolverInterface::deleteCols
virtual void deleteCols(const int num, const int *colIndices)
Remove a set of columns (primal variables) from the problem.
OsiGrbSolverInterface::getHintParam
bool getHintParam(OsiHintParam key, bool &yesNo, OsiHintStrength &strength, void *&otherInformation) const
Get a hint parameter (all information)
OsiGrbSolverInterface::freeAllMemory
void freeAllMemory()
free all allocated memory
OsiGrbSolverInterface::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...
OsiGrbSolverInterface::getInfinity
virtual double getInfinity() const
Get solver's value for infinity.
OsiGrbSolverInterface::gutsOfCopy
void gutsOfCopy(const OsiGrbSolverInterface &source)
The real work of a copy constructor (used by copy and assignment)
OsiGrbSolverInterface::isDualObjectiveLimitReached
virtual bool isDualObjectiveLimitReached() const
Is the given dual objective limit reached?
OsiGrbSolverInterface::disableSimplexInterface
virtual void disableSimplexInterface()
Useless function, defined only for compatibility with OsiSimplexInterface.
Definition: OsiGrbSolverInterface.hpp:672
OsiGrbSolverInterface::setMipStart
void setMipStart(bool value)
Definition: OsiGrbSolverInterface.hpp:84
OsiGrbSolverInterface::colmap_O2G
int * colmap_O2G
Maps variable indices from Osi to Gurobi Is NULL if there are no ranged rows! (assume identity mappin...
Definition: OsiGrbSolverInterface.hpp:917
OsiGrbSolverInterface::applyRowCut
virtual void applyRowCut(const OsiRowCut &rc)
Apply a row cut. Return true if cut was applied.
OsiGrbSolverInterface::matrixByCol_
CoinPackedMatrix * matrixByCol_
Pointer to row-wise copy of problem matrix coefficients.
Definition: OsiGrbSolverInterface.hpp:892
OsiGrbSolverInterface::initialSolve
virtual void initialSolve()
Solve initial LP relaxation.
OsiGrbSolverInterface::branchAndBound
virtual void branchAndBound()
Invoke solver's built-in enumeration algorithm.
OsiGrbSolverInterface::rowsense_
char * rowsense_
Pointer to dense vector of row sense indicators.
Definition: OsiGrbSolverInterface.hpp:862
OsiGrbSolverInterface::getObjCoefficients
virtual const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
OsiGrbSolverInterface::setColName
virtual void setColName(int ndx, std::string name)
Set a column name.
OsiGrbSolverInterface::getNumInstances
static unsigned int getNumInstances()
Return the number of instances of instantiated objects using Gurobi services.
OsiGrbSolverInterface::deleteRows
virtual void deleteRows(const int num, const int *rowIndices)
Delete a set of rows (constraints) from the problem.
OsiGrbSolverInterface::solveFromHotStart
virtual void solveFromHotStart()
Optimize starting from the hotstart.
OsiGrbSolverInterface::isPrimalObjectiveLimitReached
virtual bool isPrimalObjectiveLimitReached() const
Is the given primal objective limit reached?
OsiSolverInterface::readMps
virtual int readMps(const char *filename, const char *extension="mps")
Read a problem in MPS format from the given filename.
OsiHintTry
@ OsiHintTry
This means it is only a hint.
Definition: OsiSolverParameters.hpp:135
OsiGrbSolverInterface::collower_
double * collower_
Pointer to dense vector of variable lower bounds.
Definition: OsiGrbSolverInterface.hpp:856
OsiGrbSolverInterface::getColSolution
virtual const double * getColSolution() const
Get pointer to array[getNumCols()] of primal solution vector.
OsiGrbSolverInterface::setObjCoeffSet
virtual void setObjCoeffSet(const int *indexFirst, const int *indexLast, const double *coeffList)
Set a a set of objective function coefficients.
OsiGrbSolverInterface::nameDisc_
int nameDisc_
OSI name discipline.
Definition: OsiGrbSolverInterface.hpp:848
OsiGrbSolverInterface::setEnvironment
static void setEnvironment(GRBenv *globalenv)
sets the global gurobi environment to a user given one
OsiGrbSolverInterface::lp_
GRBmodel * lp_
Gurobi model represented by this class instance.
Definition: OsiGrbSolverInterface.hpp:838
OsiGrbSolverInterface::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...
OsiGrbSolverInterface::setInteger
virtual void setInteger(const int *indices, int len)
Set the variables listed in indices (which is of length len) to be integer variables.
OsiGrbSolverInterface::reset
virtual void reset()
Resets as if default constructor.
OsiGrbSolverInterface::KEEPCACHED_NONE
@ KEEPCACHED_NONE
discard all cached data (default)
Definition: OsiGrbSolverInterface.hpp:549
OsiGrbSolverInterface::auxcolind
int * auxcolind
Gives for each row the index of the corresponding auxiliary variable, if it is a ranged row.
Definition: OsiGrbSolverInterface.hpp:931
OsiGrbSolverInterface::getMatrixByCol
virtual const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of matrix.
OsiGrbSolverInterface::getDualRays
virtual std::vector< double * > getDualRays(int maxNumRays, bool fullRay=false) const
Get as many dual rays as the solver can provide.
OsiGrbSolverInterface::gutsOfConstructor
void gutsOfConstructor()
The real work of the constructor.
OsiGrbSolverInterface::hotStartMaxIteration_
int hotStartMaxIteration_
Definition: OsiGrbSolverInterface.hpp:845
OsiGrbSolverInterface::getIterationCount
virtual int getIterationCount() const
Get how many iterations it took to solve the problem (whatever "iteration" mean to the solver.
OsiGrbSolverInterface::coltype_
char * coltype_
Pointer to dense vector of variable types (continous, binary, integer)
Definition: OsiGrbSolverInterface.hpp:907
OsiGrbSolverInterface::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...
OsiGrbSolverInterface::clone
virtual OsiSolverInterface * clone(bool copyData=true) const
Clone.
OsiCuts
Collections of row cuts and column cuts.
Definition: OsiCuts.hpp:19
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.
GRBenv
struct _GRBenv GRBenv
Definition: OsiGrbSolverInterface.hpp:22
OsiGrbSolverInterface::globalenv_is_ours
static bool globalenv_is_ours
whether OsiGrb has created the global environment (and thus should free it)
Definition: OsiGrbSolverInterface.hpp:786
OsiGrbSolverInterface::freeCachedData
void freeCachedData(int keepCached=KEEPCACHED_NONE)
free all cached data (except specified entries, see getLpPtr())
OsiGrbSolverInterface::setDblParam
bool setDblParam(OsiDblParam key, double value)
Set a double parameter.
OsiGrbSolverInterface::resizeAuxColSpace
void resizeAuxColSpace(int minsize)
resizes colmap_G2O vector to be able to store at least minsize (auxiliary) elements
OsiGrbSolverInterface::OsiGrbSolverInterfaceUnitTest
friend void OsiGrbSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir)
A function that tests the methods in the OsiGrbSolverInterface class.
OsiGrbSolverInterface::getWarmStart
virtual CoinWarmStart * getWarmStart() const
Get warmstarting information.
OsiGrbSolverInterface::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...
OsiGrbSolverInterface::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()...
OsiColCut
Column Cut Class.
Definition: OsiColCut.hpp:23
OsiGrbSolverInterface::isProvenDualInfeasible
virtual bool isProvenDualInfeasible() const
Is dual infeasiblity proven?
OsiGrbSolverInterface::setContinuous
virtual void setContinuous(const int *indices, int len)
Set the variables listed in indices (which is of length len) to be continuous variables.
OsiGrbSolverInterface::getIntParam
bool getIntParam(OsiIntParam key, int &value) const
Get an integer parameter.
OsiGrbSolverInterface::getNumCols
virtual int getNumCols() const
Get number of columns.
OsiGrbSolverInterface::getReducedCost
virtual const double * getReducedCost() const
Get a pointer to array[getNumCols()] of reduced costs.
OsiGrbSolverInterface::setIntParam
bool setIntParam(OsiIntParam key, int value)
Set an integer parameter.
OsiGrbSolverInterface::setHintParam
bool setHintParam(OsiHintParam key, bool yesNo=true, OsiHintStrength strength=OsiHintTry, void *=NULL)
Set a hint parameter.
OsiGrbSolverInterface::setStrParam
bool setStrParam(OsiStrParam key, const std::string &value)
Set a string parameter.
OsiGrbSolverInterface::colmap_G2O
int * colmap_G2O
Maps variable indices from Gurobi to Osi A negative value indicates that a variable is an auxiliary v...
Definition: OsiGrbSolverInterface.hpp:923
OsiGrbSolverInterface::getEmptyWarmStart
CoinWarmStart * getEmptyWarmStart() const
Get an empty warm start object.
OsiGrbSolverInterface::getRowRange
virtual const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
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.
OsiRowCut
Row Cut Class.
Definition: OsiRowCut.hpp:29
OsiGrbSolverInterface::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.
OsiGrbSolverInterface::getDblParam
bool getDblParam(OsiDblParam key, double &value) const
Get a double parameter.
OsiGrbSolverInterface::getNumElements
virtual int getNumElements() const
Get number of nonzero elements.
OsiGrbSolverInterface::setColSolution
virtual void setColSolution(const double *colsol)
Set the primal solution column values.
OsiGrbSolverInterface::getMipStart
bool getMipStart() const
Definition: OsiGrbSolverInterface.hpp:86
OsiGrbSolverInterface::loadProblem
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)
Just like the other loadProblem() methods except that the matrix is given in a standard column major ...
OsiIntParam
OsiIntParam
Definition: OsiSolverParameters.hpp:8
OsiGrbSolverInterface::colspace_
int colspace_
Size of allocated memory for coltype_, colmap_O2G, and (with offset auxcolspace) colmap_G2O.
Definition: OsiGrbSolverInterface.hpp:904
OsiGrbSolverInterface::freeCachedColRim
void freeCachedColRim()
free cached column rim vectors
OsiGrbSolverInterface::auxcolspace
int auxcolspace
Size of allocated memory for colmap_G2O that exceeds colspace_.
Definition: OsiGrbSolverInterface.hpp:913
OsiGrbSolverInterface::KEEPCACHED_ALL
@ KEEPCACHED_ALL
keep all cached data (similar to getMutableLpPtr())
Definition: OsiGrbSolverInterface.hpp:561
OsiGrbSolverInterface::rowrange_
double * rowrange_
Pointer to dense vector of slack upper bounds for range constraints (undefined for non-range rows)
Definition: OsiGrbSolverInterface.hpp:868
OsiGrbSolverInterface::getRowSense
virtual const char * getRowSense() const
Get pointer to array[getNumRows()] of row constraint senses.
OsiGrbSolverInterface::rowsol_
double * rowsol_
Pointer to dual solution vector.
Definition: OsiGrbSolverInterface.hpp:880
OsiGrbSolverInterface::loadProblem
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)
Just like the other loadProblem() methods except that the matrix is given in a standard column major ...
OsiGrbSolverInterface::hotStartCStat_
int * hotStartCStat_
Hotstart information.
Definition: OsiGrbSolverInterface.hpp:841
OsiGrbSolverInterface::markHotStart
virtual void markHotStart()
Create a hotstart point of the optimization process.
OsiGrbSolverInterface::keepCachedFlag
keepCachedFlag
Get pointer to Gurobi model and free all specified cached data entries (combined with logical or-oper...
Definition: OsiGrbSolverInterface.hpp:547
OsiGrbSolverInterface::OsiGrbSolverInterface
OsiGrbSolverInterface(const OsiGrbSolverInterface &)
Copy constructor.
OsiGrbSolverInterface::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...
OsiGrbSolverInterface::KEEPCACHED_ROW
@ KEEPCACHED_ROW
row information: right hand sides, ranges and senses, lower and upper bounds for row
Definition: OsiGrbSolverInterface.hpp:553
OsiGrbSolverInterface::setRowLower
virtual void setRowLower(int elementIndex, double elementValue)
Set a single row lower bound Use -COIN_DBL_MAX for -infinity.
OsiGrbSolverInterface::basisIsAvailable
virtual bool basisIsAvailable() const
Returns true if a basis is available.
OsiGrbSolverInterface::KEEPCACHED_MATRIX
@ KEEPCACHED_MATRIX
problem matrix: matrix ordered by column and by row
Definition: OsiGrbSolverInterface.hpp:555
OsiGrbSolverInterface::getRightHandSide
virtual const double * getRightHandSide() const
Get pointer to array[getNumRows()] of rows right-hand sides.
OsiSolverInterface::ApplyCutsReturnCode
Internal class for obtaining status from the applyCuts method.
Definition: OsiSolverInterface.hpp:74
OsiGrbSolverInterface::incrementInstanceCounter
static void incrementInstanceCounter()
Gurobi has a context which must be created prior to all other Gurobi calls.
OsiGrbSolverInterface::getColUpper
virtual const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
OsiGrbSolverInterface::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.
OsiGrbSolverInterface::resizeColSpace
void resizeColSpace(int minsize)
resizes coltype_, colmap_O2G, colmap_G2O vectors to be able to store at least minsize elements
OsiGrbSolverInterface::setRowName
virtual void setRowName(int ndx, std::string name)
Set a row name.
OsiGrbSolverInterface::redcost_
double * redcost_
Pointer to reduced cost vector.
Definition: OsiGrbSolverInterface.hpp:883
OsiGrbSolverInterface::colsol_
double * colsol_
Pointer to primal solution vector.
Definition: OsiGrbSolverInterface.hpp:877
OsiGrbSolverInterface::rowact_
double * rowact_
Pointer to row activity (slack) vector.
Definition: OsiGrbSolverInterface.hpp:886
OsiGrbSolverInterface::getHintParam
bool getHintParam(OsiHintParam key, bool &yesNo) const
Get a hint parameter (sense only)
OsiDblParam
OsiDblParam
Definition: OsiSolverParameters.hpp:52
OsiGrbSolverInterface::getObjSense
virtual double getObjSense() const
Get objective function sense (1 for min (default), -1 for max)
OsiGrbSolverInterface::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.
OsiSolverInterface.hpp
OsiGrbSolverInterface::getRowActivity
virtual const double * getRowActivity() const
Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vecto...
OsiGrbSolverInterface::getStrParam
bool getStrParam(OsiStrParam key, std::string &value) const
Get a string parameter.
OsiGrbSolverInterface::hotStartRStat_
int * hotStartRStat_
Definition: OsiGrbSolverInterface.hpp:843
OsiGrbSolverInterface::applyColCut
virtual void applyColCut(const OsiColCut &cc)
Apply a column cut (bound adjustment).
OsiGrbSolverInterface
Gurobi Solver Interface.
Definition: OsiGrbSolverInterface.hpp:29
OsiGrbSolverInterface::localenv_
GRBenv * localenv_
Gurobi environment used only by this class instance.
Definition: OsiGrbSolverInterface.hpp:835
OsiGrbSolverInterface::resolve
virtual void resolve()
Resolve an LP relaxation after problem modification.
OsiGrbSolverInterfaceUnitTest
void OsiGrbSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir)
A function that tests the methods in the OsiGrbSolverInterface class.
OsiGrbSolverInterface::addCol
virtual void addCol(const CoinPackedVectorBase &vec, const double collb, const double colub, const double obj)
Add a column (primal variable) to the problem.
OsiGrbSolverInterface::isIterationLimitReached
virtual bool isIterationLimitReached() const
Iteration limit reached?
OsiGrbSolverInterface::getPrimalRays
virtual std::vector< double * > getPrimalRays(int maxNumRays) const
Get as many primal rays as the solver can provide.
OsiGrbSolverInterface::setRowUpper
virtual void setRowUpper(int elementIndex, double elementValue)
Set a single row upper bound Use COIN_DBL_MAX for infinity.
OsiGrbSolverInterface::addRow
virtual void addRow(const CoinPackedVectorBase &vec, const double rowlb, const double rowub)
Add a row (constraint) to the problem.
OsiGrbSolverInterface::colupper_
double * colupper_
Pointer to dense vector of variable lower bounds.
Definition: OsiGrbSolverInterface.hpp:859
OsiGrbSolverInterface::unmarkHotStart
virtual void unmarkHotStart()
Delete the snapshot.
OsiGrbSolverInterface::getCtype
const char * getCtype() const
return a vector of variable types (continous, binary, integer)
OsiGrbSolverInterface::setColUpper
virtual void setColUpper(int elementIndex, double elementValue)
Set a single column upper bound Use COIN_DBL_MAX for infinity.
OsiGrbSolverInterface::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...
OsiGrbSolverInterface::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.
OsiGrbSolverInterface::getRowUpper
virtual const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
OsiGrbSolverInterface::enableSimplexInterface
virtual void enableSimplexInterface(int doingPrimal)
Useless function, defined only for compatibility with OsiSimplexInterface.
Definition: OsiGrbSolverInterface.hpp:665
OsiHintStrength
OsiHintStrength
Definition: OsiSolverParameters.hpp:131
OsiGrbSolverInterface::canDoSimplexInterface
virtual int canDoSimplexInterface() const
Returns 1 if can just do getBInv etc 2 if has all OsiSimplex methods and 0 if it has none.
OsiGrbSolverInterface::getRowLower
virtual const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower 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.
OsiGrbSolverInterface::convertToNormalRow
void convertToNormalRow(int rowidx, char sense, double rhs)
converts a ranged row into a normal row by removing its auxiliary variable
OsiGrbSolverInterface::switchToMIP
void switchToMIP()
switches Gurobi to prob type MIP
OsiGrbSolverInterface::freeCachedResults
void freeCachedResults()
free cached result vectors
OsiGrbSolverInterface::freeCachedRowRim
void freeCachedRowRim()
free cached row rim vectors
OsiGrbSolverInterface::setRowPrice
virtual void setRowPrice(const double *rowprice)
Set dual solution vector.
OsiGrbSolverInterface::matrixByRow_
CoinPackedMatrix * matrixByRow_
Pointer to row-wise copy of problem matrix coefficients.
Definition: OsiGrbSolverInterface.hpp:889
OsiGrbSolverInterface::isDemoLicense
bool isDemoLicense() const
Return whether the current Gurobi environment runs in demo mode.
OsiGrbSolverInterface::applyCuts
virtual OsiSolverInterface::ApplyCutsReturnCode applyCuts(const OsiCuts &cs, double effectivenessLb=0.0)
Apply a collection of cuts.
OsiGrbSolverInterface::getMutableLpPtr
GRBmodel * getMutableLpPtr() const
Get LP Pointer for const methods.
OsiGrbSolverInterface::addRow
virtual void addRow(const CoinPackedVectorBase &vec, const char rowsen, const double rowrhs, const double rowrng)
Add a row (constraint) to the problem.
OsiGrbSolverInterface::hotStartRStatSize_
int hotStartRStatSize_
Definition: OsiGrbSolverInterface.hpp:844
OsiGrbSolverInterface::rowlower_
double * rowlower_
Pointer to dense vector of row lower bounds.
Definition: OsiGrbSolverInterface.hpp:871
OsiGrbSolverInterface::disableFactorization
virtual void disableFactorization() const
Useless function, defined only for compatibility with OsiSimplexInterface.
Definition: OsiGrbSolverInterface.hpp:686
OsiGrbSolverInterface::FREECACHED_RESULTS
@ FREECACHED_RESULTS
free only cached LP solution information
Definition: OsiGrbSolverInterface.hpp:569
OsiGrbSolverInterface::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 ...
OsiGrbSolverInterface::OsiGrbSolverInterface
OsiGrbSolverInterface(bool use_local_env=false)
Default Constructor.
OsiGrbSolverInterface::operator=
OsiGrbSolverInterface & operator=(const OsiGrbSolverInterface &rhs)
Assignment operator.
OsiGrbSolverInterface::decrementInstanceCounter
static void decrementInstanceCounter()
Gurobi has a context which should be deleted after Gurobi calls.
OsiGrbSolverInterface::getHintParam
bool getHintParam(OsiHintParam key, bool &yesNo, OsiHintStrength &strength) const
Get a hint parameter (sense and strength only)
GRBmodel
struct _GRBmodel GRBmodel
Definition: OsiGrbSolverInterface.hpp:21
OsiGrbSolverInterface::FREECACHED_MATRIX
@ FREECACHED_MATRIX
free only cached matrix and LP solution information
Definition: OsiGrbSolverInterface.hpp:567
OsiGrbSolverInterface::freeColSpace
void freeColSpace()
frees colsize_ vector
OsiGrbSolverInterface::KEEPCACHED_COLUMN
@ KEEPCACHED_COLUMN
column information: objective values, lower and upper bounds, variable types
Definition: OsiGrbSolverInterface.hpp:551
OsiGrbSolverInterface::setColLower
virtual void setColLower(int elementIndex, double elementValue)
Set a single column lower bound Use -COIN_DBL_MAX for -infinity.
OsiGrbSolverInterface::getObjValue
virtual double getObjValue() const
Get objective function value.
OsiGrbSolverInterface::resizeAuxColIndSpace
void resizeAuxColIndSpace()
resizes auxcolind vector to current number of rows and inits values to -1
OsiGrbSolverInterface::switchToLP
void switchToLP()
switches Gurobi to prob type LP
OsiGrbSolverInterface::nauxcols
int nauxcols
Number of auxiliary columns in Gurobi model for handling of ranged rows.
Definition: OsiGrbSolverInterface.hpp:910
OsiGrbSolverInterface::freeCachedMatrix
void freeCachedMatrix()
free cached matrices
OsiGrbSolverInterface::KEEPCACHED_RESULTS
@ KEEPCACHED_RESULTS
LP solution: primal and dual solution, reduced costs, row activities.
Definition: OsiGrbSolverInterface.hpp:557
OsiSolverInterface::setColLower
virtual void setColLower(int elementIndex, double elementValue)=0
Set a single column lower bound.
OsiGrbSolverInterface::readMps
virtual int readMps(const char *filename, const char *extension="mps")
Read an mps file from the given filename.
OsiGrbSolverInterface::setRowType
virtual void setRowType(int index, char sense, double rightHandSide, double range)
Set the type of a single row
OsiGrbSolverInterface::getBasisStatus
virtual void getBasisStatus(int *cstat, int *rstat) const
Returns a basis status of the structural/artificial variables At present as warm start i....
OsiSolverInterface::addRow
virtual void addRow(const CoinPackedVectorBase &vec, const double rowlb, const double rowub)=0
Add a row (constraint) to the problem.
OsiGrbSolverInterface::setWarmStart
virtual bool setWarmStart(const CoinWarmStart *warmstart)
Set warmstarting information.
OsiGrbSolverInterface::rhs_
double * rhs_
Pointer to dense vector of row right-hand side values.
Definition: OsiGrbSolverInterface.hpp:865
OsiGrbSolverInterface::hotStartCStatSize_
int hotStartCStatSize_
Definition: OsiGrbSolverInterface.hpp:842
OsiGrbSolverInterface::getNumRows
virtual int getNumRows() const
Get number of rows.
OsiGrbSolverInterface::getRowPrice
virtual const double * getRowPrice() const
Get pointer to array[getNumRows()] of dual prices.
OsiGrbSolverInterface::getColLower
virtual const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
OsiGrbSolverInterface::getEnvironmentPtr
GRBenv * getEnvironmentPtr() const
Method to access Gurobi environment pointer.
OsiSolverInterface
Abstract Base Class for describing an interface to a solver.
Definition: OsiSolverInterface.hpp:62
OsiGrbSolverInterface::domipstart
bool domipstart
Whether to pass a column solution to CPLEX before starting MIP solve (copymipstart)
Definition: OsiGrbSolverInterface.hpp:901
OsiGrbSolverInterface::isProvenOptimal
virtual bool isProvenOptimal() const
Is optimality proven?
OsiGrbSolverInterface::isProvenPrimalInfeasible
virtual bool isProvenPrimalInfeasible() const
Is primal infeasiblity proven?
OsiGrbSolverInterface::~OsiGrbSolverInterface
virtual ~OsiGrbSolverInterface()
Destructor.
OsiStrParam
OsiStrParam
Definition: OsiSolverParameters.hpp:88