Cgl 0.60.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 2197 2019-01-06 23:00:34Z unxusr $
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 //---------------------------------------------------------------------------
36 virtual void initialSolve();
38
40 virtual void resolve();
41
43 virtual void branchAndBound();
45
46 //---------------------------------------------------------------------------
62 // Set an integer parameter
63 bool setIntParam(OsiIntParam key, int value);
64 // Set an double parameter
65 bool setDblParam(OsiDblParam key, double value);
66 // Set a string parameter
67 bool setStrParam(OsiStrParam key, const std::string &value);
68 // Set a hint parameter
69 bool setHintParam(OsiHintParam key, bool yesNo = true, OsiHintStrength strength = OsiHintTry, void * = NULL);
70 // Get an integer parameter
71 bool getIntParam(OsiIntParam key, int &value) const;
72 // Get an double parameter
73 bool getDblParam(OsiDblParam key, double &value) const;
74 // Get a string parameter
75 bool getStrParam(OsiStrParam key, std::string &value) const;
76 // Get a hint parameter
77 bool getHintParam(OsiHintParam key, bool &yesNo, OsiHintStrength &strength, void *&otherInformation) const;
78 // Get a hint parameter
79 bool getHintParam(OsiHintParam key, bool &yesNo, OsiHintStrength &strength) const;
80 // Get a hint parameter
81 bool getHintParam(OsiHintParam key, bool &yesNo) const;
82 // Set mipstart option (pass column solution to CPLEX before MIP start)
83 void setMipStart(bool value) { domipstart = value; }
84 // Get mipstart option value
85 bool getMipStart() const { return domipstart; }
87
88 //---------------------------------------------------------------------------
90
91 virtual bool isAbandoned() const;
94 virtual bool isProvenOptimal() const;
96 virtual bool isProvenPrimalInfeasible() const;
98 virtual bool isProvenDualInfeasible() const;
100 virtual bool isPrimalObjectiveLimitReached() const;
102 virtual bool isDualObjectiveLimitReached() const;
104 virtual bool isIterationLimitReached() const;
106
107 //---------------------------------------------------------------------------
110
117 CoinWarmStart *getEmptyWarmStart() const;
118
120 virtual CoinWarmStart *getWarmStart() const;
123 virtual bool setWarmStart(const CoinWarmStart *warmstart);
125
126 //---------------------------------------------------------------------------
133 virtual void markHotStart();
136 virtual void solveFromHotStart();
138 virtual void unmarkHotStart();
140
141 //---------------------------------------------------------------------------
156 virtual int getNumCols() const;
158
160 virtual int getNumRows() const;
161
163 virtual int getNumElements() const;
164
166 virtual const double *getColLower() const;
167
169 virtual const double *getColUpper() const;
170
180 virtual const char *getRowSense() const;
181
190 virtual const double *getRightHandSide() const;
191
200 virtual const double *getRowRange() const;
201
203 virtual const double *getRowLower() const;
204
206 virtual const double *getRowUpper() const;
207
209 virtual const double *getObjCoefficients() const;
210
212 virtual double getObjSense() const;
213
215 virtual bool isContinuous(int colNumber) const;
216
218 virtual const CoinPackedMatrix *getMatrixByRow() const;
219
221 virtual const CoinPackedMatrix *getMatrixByCol() const;
222
224 virtual double getInfinity() const;
226
229 virtual const double *getColSolution() const;
231
233 virtual const double *getRowPrice() const;
234
236 virtual const double *getReducedCost() const;
237
240 virtual const double *getRowActivity() const;
241
243 virtual double getObjValue() const;
244
247 virtual int getIterationCount() const;
248
266 virtual std::vector< double * > getDualRays(int maxNumRays,
267 bool fullRay = false) const;
279 virtual std::vector< double * > getPrimalRays(int maxNumRays) const;
281
282
283 //---------------------------------------------------------------------------
284
287 //-------------------------------------------------------------------------
291 virtual void setObjCoeff(int elementIndex, double elementValue);
292
294 virtual void setObjCoeffSet(const int *indexFirst, const int *indexLast,
295 const double *coeffList);
296
297 using OsiSolverInterface::setColLower;
300 virtual void setColLower(int elementIndex, double elementValue);
301
302 using OsiSolverInterface::setColUpper;
305 virtual void setColUpper(int elementIndex, double elementValue);
306
310 virtual void setColBounds(int elementIndex, double lower, double upper);
311
319 virtual void setColSetBounds(const int *indexFirst, const int *indexLast,
320 const double *boundList);
321
324 virtual void setRowLower(int elementIndex, double elementValue);
325
328 virtual void setRowUpper(int elementIndex, double elementValue);
329
333 virtual void setRowBounds(int elementIndex, double lower, double upper);
334
336 virtual void setRowType(int index, char sense, double rightHandSide,
337 double range);
338
346 virtual void setRowSetBounds(const int *indexFirst, const int *indexLast,
347 const double *boundList);
348
358 virtual void setRowSetTypes(const int *indexFirst, const int *indexLast,
359 const char *senseList, const double *rhsList, const double *rangeList);
361
362 //-------------------------------------------------------------------------
366 virtual void setContinuous(int index);
368 virtual void setInteger(int index);
371 virtual void setContinuous(const int *indices, int len);
374 virtual void setInteger(const int *indices, int len);
376
377 //-------------------------------------------------------------------------
381 virtual void setRowName(int ndx, std::string name);
382
384 virtual void setColName(int ndx, std::string name);
386
387 //-------------------------------------------------------------------------
389 virtual void setObjSense(double s);
390
401 virtual void setColSolution(const double *colsol);
402
413 virtual void setRowPrice(const double *rowprice);
414
415 //-------------------------------------------------------------------------
420 using OsiSolverInterface::addCol;
422 virtual void addCol(const CoinPackedVectorBase &vec, const double collb,
423 const double colub, const double obj);
424
425 using OsiSolverInterface::addCols;
427 virtual void addCols(const int numcols,
428 const CoinPackedVectorBase *const *cols, const double *collb,
429 const double *colub, const double *obj);
431 virtual void deleteCols(const int num, const int *colIndices);
432
433 using OsiSolverInterface::addRow;
435 virtual void addRow(const CoinPackedVectorBase &vec, const double rowlb,
436 const double rowub);
438 virtual void addRow(const CoinPackedVectorBase &vec, const char rowsen,
439 const double rowrhs, const double rowrng);
440
441 using OsiSolverInterface::addRows;
443 virtual void addRows(const int numrows,
444 const CoinPackedVectorBase *const *rows, const double *rowlb,
445 const double *rowub);
447 virtual void addRows(const int numrows,
448 const CoinPackedVectorBase *const *rows, const char *rowsen,
449 const double *rowrhs, const double *rowrng);
451 virtual void deleteRows(const int num, const int *rowIndices);
453
454
455 //---------------------------------------------------------------------------
456
470 virtual void loadProblem(const CoinPackedMatrix &matrix, const double *collb,
471 const double *colub, const double *obj, const double *rowlb,
472 const double *rowub);
473
481 virtual void assignProblem(CoinPackedMatrix *&matrix, double *&collb,
482 double *&colub, double *&obj, double *&rowlb, double *&rowub);
483
496 virtual void loadProblem(const CoinPackedMatrix &matrix, const double *collb,
497 const double *colub, const double *obj, const char *rowsen,
498 const double *rowrhs, const double *rowrng);
499
507 virtual void assignProblem(CoinPackedMatrix *&matrix, double *&collb,
508 double *&colub, double *&obj, char *&rowsen, double *&rowrhs,
509 double *&rowrng);
510
513 virtual void loadProblem(const int numcols, const int numrows,
514 const int *start, const int *index, const double *value,
515 const double *collb, const double *colub, const double *obj,
516 const double *rowlb, const double *rowub);
517
520 virtual void loadProblem(const int numcols, const int numrows,
521 const int *start, const int *index, const double *value,
522 const double *collb, const double *colub, const double *obj,
523 const char *rowsen, const double *rowrhs, const double *rowrng);
524
525 using OsiSolverInterface::readMps;
527 virtual int readMps(const char *filename, const char *extension = "mps");
528
533 virtual void writeMps(const char *filename, const char *extension = "mps",
534 double objSense = 0.0) const;
535
537
538 //---------------------------------------------------------------------------
539
545 enum keepCachedFlag {
547 KEEPCACHED_NONE = 0,
549 KEEPCACHED_COLUMN = 1,
551 KEEPCACHED_ROW = 2,
553 KEEPCACHED_MATRIX = 4,
555 KEEPCACHED_RESULTS = 8,
557 KEEPCACHED_PROBLEM = KEEPCACHED_COLUMN | KEEPCACHED_ROW | KEEPCACHED_MATRIX,
559 KEEPCACHED_ALL = KEEPCACHED_PROBLEM | KEEPCACHED_RESULTS,
561 FREECACHED_COLUMN = KEEPCACHED_PROBLEM & ~KEEPCACHED_COLUMN,
563 FREECACHED_ROW = KEEPCACHED_PROBLEM & ~KEEPCACHED_ROW,
565 FREECACHED_MATRIX = KEEPCACHED_PROBLEM & ~KEEPCACHED_MATRIX,
567 FREECACHED_RESULTS = KEEPCACHED_ALL & ~KEEPCACHED_RESULTS
568 };
569
570 GRBmodel *getLpPtr(int keepCached = KEEPCACHED_NONE);
571
573 GRBenv *getEnvironmentPtr() const;
575
577 bool isDemoLicense() const;
579
581 const char *getCtype() const;
582
592 static void incrementInstanceCounter();
593
602 static void decrementInstanceCounter();
603
605 static void setEnvironment(GRBenv *globalenv);
606
608 static unsigned int getNumInstances();
610
611
614 OsiGrbSolverInterface(bool use_local_env = false);
616
618 OsiGrbSolverInterface(GRBenv *localgrbenv);
619
621 virtual OsiSolverInterface *clone(bool copyData = true) const;
622
624 OsiGrbSolverInterface(const OsiGrbSolverInterface &);
625
627 OsiGrbSolverInterface &operator=(const OsiGrbSolverInterface &rhs);
628
630 virtual ~OsiGrbSolverInterface();
631
633 virtual void reset();
635
636 /***************************************************************************/
653
657 virtual int canDoSimplexInterface() const;
658
659 using OsiSolverInterface::enableSimplexInterface;
663 virtual void enableSimplexInterface(int doingPrimal) {};
664
668 virtual void disableSimplexInterface() {};
669
673 virtual void enableFactorization() const {};
674
678 virtual void disableFactorization() const {};
679
681 virtual bool basisIsAvailable() const;
682
686 virtual void getBasisStatus(int *cstat, int *rstat) const;
687
688 // ///Get a row of the tableau (slack part in slack if not NULL)
689 // virtual void getBInvARow(int row, double* z, double * slack=NULL) const;
690 //
691 // ///Get a row of the basis inverse
692 // virtual void getBInvRow(int row, double* z) const;
693 //
694 // ///Get a column of the tableau
695 // virtual void getBInvACol(int col, double* vec) const;
696 //
697 // ///Get a column of the basis inverse
698 // virtual void getBInvCol(int col, double* vec) const;
699 //
700 // /** Get indices of the pivot variable in each row
701 // (order of indices corresponds to the
702 // order of elements in a vector retured by getBInvACol() and
703 // getBInvCol()).
704 // */
705 // virtual void getBasics(int* index) const;
707 void switchToLP();
708
710 void switchToMIP();
711
713 /***************************************************************************/
714
715 /***************************************************************************/
716
739 virtual OsiSolverInterface::ApplyCutsReturnCode applyCuts(const OsiCuts &cs,
740 double effectivenessLb = 0.0);
741
742 protected:
745 virtual void applyRowCut(const OsiRowCut &rc);
747
751 virtual void applyColCut(const OsiColCut &cc);
753
754 private:
757 void resizeColSpace(int minsize);
759
761 void freeColSpace();
762
764 void resizeAuxColSpace(int minsize);
765
767 void resizeAuxColIndSpace();
769
772 static GRBenv *globalenv_;
775 static bool globalenv_is_ours;
777 static unsigned int numInstances_;
779
782
784 GRBmodel *getMutableLpPtr() const;
785
787 void gutsOfCopy(const OsiGrbSolverInterface &source);
788
790 void gutsOfConstructor();
791
793 void gutsOfDestructor();
794
796 void freeCachedColRim();
797
799 void freeCachedRowRim();
800
802 void freeCachedResults();
803
805 void freeCachedMatrix();
806
808 void freeCachedData(int keepCached = KEEPCACHED_NONE);
809
811 void freeAllMemory();
812
814 void convertToRangedRow(int rowidx, double rhs, double range);
815
817 void convertToNormalRow(int rowidx, char sense, double rhs);
819
822 mutable GRBenv *localenv_;
824
826 mutable GRBmodel *lp_;
827
829 int *hotStartCStat_;
830 int hotStartCStatSize_;
831 int *hotStartRStat_;
832 int hotStartRStatSize_;
833 int hotStartMaxIteration_;
834
836 int nameDisc_;
837
840 mutable double *obj_;
842
844 mutable double *collower_;
845
847 mutable double *colupper_;
848
850 mutable char *rowsense_;
851
853 mutable double *rhs_;
854
856 mutable double *rowrange_;
857
859 mutable double *rowlower_;
860
862 mutable double *rowupper_;
863
865 mutable double *colsol_;
866
868 mutable double *rowsol_;
869
871 mutable double *redcost_;
872
874 mutable double *rowact_;
875
877 mutable CoinPackedMatrix *matrixByRow_;
878
880 mutable CoinPackedMatrix *matrixByCol_;
882
885 mutable bool probtypemip_;
887
889 bool domipstart;
890
892 int colspace_;
893
895 char *coltype_;
896
898 int nauxcols;
899
901 int auxcolspace;
902
905 int *colmap_O2G;
906
911 int *colmap_G2O;
912
914 int auxcolindspace;
915
919 int *auxcolind;
921 };
922
923 //#############################################################################
925 void OsiGrbSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir);
926
927 #endif
928
929 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
930 */
OsiGrbSolverInterface::deleteRows
virtual void deleteRows(const int num, const int *rowIndices)
Delete a set of rows (constraints) from the problem.
OsiGrbSolverInterface::matrixByRow_
CoinPackedMatrix * matrixByRow_
Pointer to row-wise copy of problem matrix coefficients.
Definition: OsiGrbSolverInterface.hpp:877
OsiGrbSolverInterface::hotStartRStatSize_
int hotStartRStatSize_
Definition: OsiGrbSolverInterface.hpp:832
OsiGrbSolverInterface::getRightHandSide
virtual const double * getRightHandSide() const
Get pointer to array[getNumRows()] of rows right-hand sides.
OsiSolverInterface::readMps
virtual int readMps(const char *filename, const char *extension="mps")
Read a problem in MPS format from the given filename.
OsiGrbSolverInterface::getMipStart
bool getMipStart() const
Definition: OsiGrbSolverInterface.hpp:85
OsiGrbSolverInterface::auxcolspace
int auxcolspace
Size of allocated memory for colmap_G2O that exceeds colspace_.
Definition: OsiGrbSolverInterface.hpp:901
OsiGrbSolverInterface::hotStartMaxIteration_
int hotStartMaxIteration_
Definition: OsiGrbSolverInterface.hpp:833
OsiGrbSolverInterface::rowrange_
double * rowrange_
Pointer to dense vector of slack upper bounds for range constraints (undefined for non-range rows) ...
Definition: OsiGrbSolverInterface.hpp:856
OsiGrbSolverInterface::rowupper_
double * rowupper_
Pointer to dense vector of row upper bounds.
Definition: OsiGrbSolverInterface.hpp:862
OsiGrbSolverInterface::hotStartCStatSize_
int hotStartCStatSize_
Definition: OsiGrbSolverInterface.hpp:830
OsiGrbSolverInterface::FREECACHED_ROW
free only cached row and LP solution information
Definition: OsiGrbSolverInterface.hpp:563
OsiGrbSolverInterface::enableFactorization
virtual void enableFactorization() const
Useless function, defined only for compatibility with OsiSimplexInterface.
Definition: OsiGrbSolverInterface.hpp:673
OsiGrbSolverInterface::gutsOfDestructor
void gutsOfDestructor()
The real work of the destructor.
OsiGrbSolverInterface::setContinuous
virtual void setContinuous(int index)
Set the index-th variable to be a continuous variable.
OsiGrbSolverInterface::markHotStart
virtual void markHotStart()
Create a hotstart point of the optimization process.
OsiGrbSolverInterface::KEEPCACHED_MATRIX
problem matrix: matrix ordered by column and by row
Definition: OsiGrbSolverInterface.hpp:553
OsiGrbSolverInterface::setInteger
virtual void setInteger(int index)
Set the index-th variable to be an integer variable.
OsiGrbSolverInterface::nameDisc_
int nameDisc_
OSI name discipline.
Definition: OsiGrbSolverInterface.hpp:836
OsiGrbSolverInterface::colspace_
int colspace_
Size of allocated memory for coltype_, colmap_O2G, and (with offset auxcolspace) colmap_G2O.
Definition: OsiGrbSolverInterface.hpp:892
OsiGrbSolverInterface::getNumRows
virtual int getNumRows() const
Get number of rows.
OsiGrbSolverInterface::getReducedCost
virtual const double * getReducedCost() const
Get a pointer to array[getNumCols()] of reduced costs.
OsiSolverInterface::setColLower
virtual void setColLower(int elementIndex, double elementValue)=0
Set a single column lower bound.
OsiGrbSolverInterface::setRowUpper
virtual void setRowUpper(int elementIndex, double elementValue)
Set a single row upper bound Use COIN_DBL_MAX for infinity.
OsiGrbSolverInterface::matrixByCol_
CoinPackedMatrix * matrixByCol_
Pointer to row-wise copy of problem matrix coefficients.
Definition: OsiGrbSolverInterface.hpp:880
OsiGrbSolverInterface::applyRowCut
virtual void applyRowCut(const OsiRowCut &rc)
Apply a row cut. Return true if cut was applied.
OsiGrbSolverInterface::probtypemip_
bool probtypemip_
Stores whether we currently see the problem as a MIP.
Definition: OsiGrbSolverInterface.hpp:886
OsiGrbSolverInterface::clone
virtual OsiSolverInterface * clone(bool copyData=true) const
Clone.
OsiDblParam
OsiDblParam
Definition: OsiSolverParameters.hpp:52
OsiGrbSolverInterface::setStrParam
bool setStrParam(OsiStrParam key, const std::string &value)
Set a string parameter.
OsiGrbSolverInterface::hotStartCStat_
int * hotStartCStat_
Hotstart information.
Definition: OsiGrbSolverInterface.hpp:829
OsiGrbSolverInterface::rowact_
double * rowact_
Pointer to row activity (slack) vector.
Definition: OsiGrbSolverInterface.hpp:874
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...
OsiGrbSolverInterfaceUnitTest
void OsiGrbSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir)
A function that tests the methods in the OsiGrbSolverInterface class.
OsiGrbSolverInterface::gutsOfConstructor
void gutsOfConstructor()
The real work of the constructor.
OsiGrbSolverInterface::lp_
GRBmodel * lp_
Gurobi model represented by this class instance.
Definition: OsiGrbSolverInterface.hpp:826
OsiGrbSolverInterface::getStrParam
bool getStrParam(OsiStrParam key, std::string &value) const
Get a string parameter.
OsiCuts
Collections of row cuts and column cuts.
Definition: OsiCuts.hpp:19
OsiColCut
Column Cut Class.
Definition: OsiColCut.hpp:23
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::rowsol_
double * rowsol_
Pointer to dual solution vector.
Definition: OsiGrbSolverInterface.hpp:868
OsiGrbSolverInterface::getMutableLpPtr
GRBmodel * getMutableLpPtr() const
Get LP Pointer for const methods.
GRBenv
struct _GRBenv GRBenv
Definition: OsiGrbSolverInterface.hpp:22
OsiGrbSolverInterface::freeAllMemory
void freeAllMemory()
free all allocated memory
OsiGrbSolverInterface::rowsense_
char * rowsense_
Pointer to dense vector of row sense indicators.
Definition: OsiGrbSolverInterface.hpp:850
OsiGrbSolverInterface::getRowUpper
virtual const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
OsiGrbSolverInterface::readMps
virtual int readMps(const char *filename, const char *extension="mps")
Read an mps file from the given filename.
OsiGrbSolverInterface::localenv_
GRBenv * localenv_
Gurobi environment used only by this class instance.
Definition: OsiGrbSolverInterface.hpp:823
OsiGrbSolverInterface::setMipStart
void setMipStart(bool value)
Definition: OsiGrbSolverInterface.hpp:83
OsiGrbSolverInterface::setColName
virtual void setColName(int ndx, std::string name)
Set a column name.
OsiHintStrength
OsiHintStrength
Definition: OsiSolverParameters.hpp:130
OsiGrbSolverInterface::switchToLP
void switchToLP()
Get indices of the pivot variable in each row (order of indices corresponds to the order of e...
OsiGrbSolverInterface::getRowRange
virtual const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
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.
OsiGrbSolverInterface::colupper_
double * colupper_
Pointer to dense vector of variable lower bounds.
Definition: OsiGrbSolverInterface.hpp:847
OsiGrbSolverInterface::KEEPCACHED_ALL
keep all cached data (similar to getMutableLpPtr())
Definition: OsiGrbSolverInterface.hpp:559
OsiGrbSolverInterface::OsiGrbSolverInterfaceUnitTest
friend void OsiGrbSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir)
A function that tests the methods in the OsiGrbSolverInterface class.
OsiGrbSolverInterface::deleteCols
virtual void deleteCols(const int num, const int *colIndices)
Remove a set of columns (primal variables) from the problem.
OsiGrbSolverInterface::getIterationCount
virtual int getIterationCount() const
Get how many iterations it took to solve the problem (whatever &quot;iteration&quot; mean to the solver...
OsiGrbSolverInterface::freeColSpace
void freeColSpace()
frees colsize_ vector
OsiGrbSolverInterface::hotStartRStat_
int * hotStartRStat_
Definition: OsiGrbSolverInterface.hpp:831
OsiGrbSolverInterface::setEnvironment
static void setEnvironment(GRBenv *globalenv)
sets the global gurobi environment to a user given one
OsiGrbSolverInterface::getObjCoefficients
virtual const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
OsiGrbSolverInterface::KEEPCACHED_ROW
row information: right hand sides, ranges and senses, lower and upper bounds for row ...
Definition: OsiGrbSolverInterface.hpp:551
OsiGrbSolverInterface::rhs_
double * rhs_
Pointer to dense vector of row right-hand side values.
Definition: OsiGrbSolverInterface.hpp:853
OsiGrbSolverInterface::isProvenPrimalInfeasible
virtual bool isProvenPrimalInfeasible() const
Is primal infeasiblity proven?
OsiGrbSolverInterface::~OsiGrbSolverInterface
virtual ~OsiGrbSolverInterface()
Destructor.
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.
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.
OsiGrbSolverInterface::getMatrixByRow
virtual const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of matrix.
OsiGrbSolverInterface::collower_
double * collower_
Pointer to dense vector of variable lower bounds.
Definition: OsiGrbSolverInterface.hpp:844
OsiGrbSolverInterface::getNumElements
virtual int getNumElements() const
Get number of nonzero elements.
OsiSolverInterface
Abstract Base Class for describing an interface to a solver.
Definition: OsiSolverInterface.hpp:61
OsiGrbSolverInterface::resolve
virtual void resolve()
Resolve an LP relaxation after problem modification.
OsiGrbSolverInterface::setHintParam
bool setHintParam(OsiHintParam key, bool yesNo=true, OsiHintStrength strength=OsiHintTry, void *=NULL)
Set a hint parameter.
OsiGrbSolverInterface::FREECACHED_MATRIX
free only cached matrix and LP solution information
Definition: OsiGrbSolverInterface.hpp:565
OsiGrbSolverInterface::resizeAuxColIndSpace
void resizeAuxColIndSpace()
resizes auxcolind vector to current number of rows and inits values to -1
CoinPackedVectorBase
Abstract base class for various sparse vectors.
Definition: CoinPackedVectorBase.hpp:23
OsiGrbSolverInterface::isPrimalObjectiveLimitReached
virtual bool isPrimalObjectiveLimitReached() const
Is the given primal objective limit reached?
OsiGrbSolverInterface::convertToRangedRow
void convertToRangedRow(int rowidx, double rhs, double range)
converts a normal row into a ranged row by adding an auxiliary variable
OsiGrbSolverInterface::setRowPrice
virtual void setRowPrice(const double *rowprice)
Set dual solution vector.
OsiGrbSolverInterface::freeCachedMatrix
void freeCachedMatrix()
free cached matrices
OsiGrbSolverInterface::basisIsAvailable
virtual bool basisIsAvailable() const
Returns true if a basis is available.
OsiGrbSolverInterface::nauxcols
int nauxcols
Number of auxiliary columns in Gurobi model for handling of ranged rows.
Definition: OsiGrbSolverInterface.hpp:898
OsiGrbSolverInterface::getWarmStart
virtual CoinWarmStart * getWarmStart() const
Get warmstarting information.
OsiGrbSolverInterface::getNumInstances
static unsigned int getNumInstances()
Return the number of instances of instantiated objects using Gurobi services.
OsiGrbSolverInterface::freeCachedRowRim
void freeCachedRowRim()
free cached row rim vectors
OsiGrbSolverInterface::setDblParam
bool setDblParam(OsiDblParam key, double value)
Set a double parameter.
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.
OsiGrbSolverInterface::setRowName
virtual void setRowName(int ndx, std::string name)
Set a row name.
OsiGrbSolverInterface::getRowLower
virtual const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
OsiGrbSolverInterface::setRowLower
virtual void setRowLower(int elementIndex, double elementValue)
Set a single row lower bound Use -COIN_DBL_MAX for -infinity.
OsiGrbSolverInterface::isContinuous
virtual bool isContinuous(int colNumber) const
Return true if column is continuous.
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.
OsiGrbSolverInterface::auxcolind
int * auxcolind
Gives for each row the index of the corresponding auxiliary variable, if it is a ranged row...
Definition: OsiGrbSolverInterface.hpp:919
OsiGrbSolverInterface::getColSolution
virtual const double * getColSolution() const
Get pointer to array[getNumCols()] of primal solution vector.
OsiGrbSolverInterface::isDualObjectiveLimitReached
virtual bool isDualObjectiveLimitReached() const
Is the given dual objective limit reached?
OsiGrbSolverInterface::solveFromHotStart
virtual void solveFromHotStart()
Optimize starting from the hotstart.
OsiStrParam
OsiStrParam
Definition: OsiSolverParameters.hpp:87
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()...
OsiGrbSolverInterface::isProvenDualInfeasible
virtual bool isProvenDualInfeasible() const
Is dual infeasiblity proven?
OsiGrbSolverInterface::globalenv_is_ours
static bool globalenv_is_ours
whether OsiGrb has created the global environment (and thus should free it)
Definition: OsiGrbSolverInterface.hpp:775
OsiGrbSolverInterface::redcost_
double * redcost_
Pointer to reduced cost vector.
Definition: OsiGrbSolverInterface.hpp:871
OsiGrbSolverInterface::resizeAuxColSpace
void resizeAuxColSpace(int minsize)
resizes colmap_G2O vector to be able to store at least minsize (auxiliary) elements ...
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::setColUpper
virtual void setColUpper(int elementIndex, double elementValue)
Set a single column upper bound Use COIN_DBL_MAX for infinity.
OsiGrbSolverInterface::setWarmStart
virtual bool setWarmStart(const CoinWarmStart *warmstart)
Set warmstarting information.
OsiGrbSolverInterface::colsol_
double * colsol_
Pointer to primal solution vector.
Definition: OsiGrbSolverInterface.hpp:865
OsiGrbSolverInterface::KEEPCACHED_NONE
discard all cached data (default)
Definition: OsiGrbSolverInterface.hpp:547
OsiGrbSolverInterface::getDualRays
virtual std::vector< double * > getDualRays(int maxNumRays, bool fullRay=false) const
Get as many dual rays as the solver can provide.
OsiGrbSolverInterface::getObjValue
virtual double getObjValue() const
Get objective function value.
OsiGrbSolverInterface::convertToNormalRow
void convertToNormalRow(int rowidx, char sense, double rhs)
converts a ranged row into a normal row by removing its auxiliary variable
OsiGrbSolverInterface::isDemoLicense
bool isDemoLicense() const
Return whether the current Gurobi environment runs in demo mode.
OsiGrbSolverInterface::rowlower_
double * rowlower_
Pointer to dense vector of row lower bounds.
Definition: OsiGrbSolverInterface.hpp:859
OsiGrbSolverInterface::domipstart
bool domipstart
Whether to pass a column solution to CPLEX before starting MIP solve (copymipstart) ...
Definition: OsiGrbSolverInterface.hpp:889
OsiGrbSolverInterface::getColUpper
virtual const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
OsiGrbSolverInterface::incrementInstanceCounter
static void incrementInstanceCounter()
Gurobi has a context which must be created prior to all other Gurobi calls.
OsiRowCut
Row Cut Class.
Definition: OsiRowCut.hpp:29
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::reset
virtual void reset()
Resets as if default constructor.
OsiGrbSolverInterface::auxcolindspace
int auxcolindspace
Current length of auxcolind array.
Definition: OsiGrbSolverInterface.hpp:914
OsiGrbSolverInterface::setObjCoeff
virtual void setObjCoeff(int elementIndex, double elementValue)
Set an objective function coefficient.
OsiGrbSolverInterface::getRowPrice
virtual const double * getRowPrice() const
Get pointer to array[getNumRows()] of dual prices.
OsiGrbSolverInterface::obj_
double * obj_
Pointer to objective vector.
Definition: OsiGrbSolverInterface.hpp:841
CoinPackedMatrix
Sparse Matrix Base Class.
Definition: CoinPackedMatrix.hpp:79
OsiGrbSolverInterface::isProvenOptimal
virtual bool isProvenOptimal() const
Is optimality proven?
OsiGrbSolverInterface::getEnvironmentPtr
GRBenv * getEnvironmentPtr() const
Method to access Gurobi environment pointer.
OsiGrbSolverInterface::isIterationLimitReached
virtual bool isIterationLimitReached() const
Iteration limit reached?
OsiGrbSolverInterface::setIntParam
bool setIntParam(OsiIntParam key, int value)
Set an integer parameter.
OsiGrbSolverInterface::KEEPCACHED_PROBLEM
only discard cached LP solution
Definition: OsiGrbSolverInterface.hpp:557
OsiGrbSolverInterface::resizeColSpace
void resizeColSpace(int minsize)
resizes coltype_, colmap_O2G, colmap_G2O vectors to be able to store at least minsize elements ...
OsiGrbSolverInterface::getObjSense
virtual double getObjSense() const
Get objective function sense (1 for min (default), -1 for max)
OsiGrbSolverInterface::disableFactorization
virtual void disableFactorization() const
Useless function, defined only for compatibility with OsiSimplexInterface.
Definition: OsiGrbSolverInterface.hpp:678
OsiHintTry
This means it is only a hint.
Definition: OsiSolverParameters.hpp:134
OsiGrbSolverInterface::getEmptyWarmStart
CoinWarmStart * getEmptyWarmStart() const
Get an empty warm start object.
OsiSolverInterface.hpp
OsiGrbSolverInterface::getRowSense
virtual const char * getRowSense() const
Get pointer to array[getNumRows()] of row constraint senses.
OsiGrbSolverInterface::getMatrixByCol
virtual const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of matrix.
OsiGrbSolverInterface::getRowActivity
virtual const double * getRowActivity() const
Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vecto...
OsiGrbSolverInterface::getColLower
virtual const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
OsiHintParam
OsiHintParam
Definition: OsiSolverParameters.hpp:106
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::freeCachedColRim
void freeCachedColRim()
free cached column rim vectors
OsiGrbSolverInterface::getInfinity
virtual double getInfinity() const
Get solver&#39;s value for infinity.
OsiGrbSolverInterface::isAbandoned
virtual bool isAbandoned() const
Are there a numerical difficulties?
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...
OsiGrbSolverInterface::setColSolution
virtual void setColSolution(const double *colsol)
Set the primal solution column values.
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::getCtype
const char * getCtype() const
return a vector of variable types (continous, binary, integer)
OsiGrbSolverInterface::switchToMIP
void switchToMIP()
switches Gurobi to prob type MIP
OsiGrbSolverInterface::getDblParam
bool getDblParam(OsiDblParam key, double &value) const
Get a double 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:911
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::OsiGrbSolverInterface
OsiGrbSolverInterface(bool use_local_env=false)
Default Constructor.
OsiGrbSolverInterface::initialSolve
virtual void initialSolve()
Solve initial LP relaxation.
OsiGrbSolverInterface::coltype_
char * coltype_
Pointer to dense vector of variable types (continous, binary, integer)
Definition: OsiGrbSolverInterface.hpp:895
GRBmodel
struct _GRBmodel GRBmodel
Definition: OsiGrbSolverInterface.hpp:21
OsiGrbSolverInterface::KEEPCACHED_COLUMN
column information: objective values, lower and upper bounds, variable types
Definition: OsiGrbSolverInterface.hpp:549
OsiGrbSolverInterface::getNumCols
virtual int getNumCols() const
Get number of columns.
OsiGrbSolverInterface::addRow
virtual void addRow(const CoinPackedVectorBase &vec, const double rowlb, const double rowub)
Add a row (constraint) to the problem.
OsiGrbSolverInterface::decrementInstanceCounter
static void decrementInstanceCounter()
Gurobi has a context which should be deleted after Gurobi calls.
OsiGrbSolverInterface::getPrimalRays
virtual std::vector< double * > getPrimalRays(int maxNumRays) const
Get as many primal rays as the solver can provide.
OsiIntParam
OsiIntParam
Definition: OsiSolverParameters.hpp:8
OsiGrbSolverInterface::FREECACHED_COLUMN
free only cached column and LP solution information
Definition: OsiGrbSolverInterface.hpp:561
OsiSolverInterface::addRow
virtual void addRow(const CoinPackedVectorBase &vec, const double rowlb, const double rowub)=0
Add a row (constraint) to the problem.
OsiGrbSolverInterface::KEEPCACHED_RESULTS
LP solution: primal and dual solution, reduced costs, row activities.
Definition: OsiGrbSolverInterface.hpp:555
OsiGrbSolverInterface::setColLower
virtual void setColLower(int elementIndex, double elementValue)
Set a single column lower bound Use -COIN_DBL_MAX for -infinity.
OsiGrbSolverInterface::setObjCoeffSet
virtual void setObjCoeffSet(const int *indexFirst, const int *indexLast, const double *coeffList)
Set a a set of objective function coefficients.
OsiSolverInterface::ApplyCutsReturnCode
Internal class for obtaining status from the applyCuts method.
Definition: OsiSolverInterface.hpp:72
OsiGrbSolverInterface::setObjSense
virtual void setObjSense(double s)
Set objective function sense (1 for min (default), -1 for max,)
OsiGrbSolverInterface::getHintParam
bool getHintParam(OsiHintParam key, bool &yesNo, OsiHintStrength &strength, void *&otherInformation) const
Get a hint parameter (all information)
OsiGrbSolverInterface::applyCuts
virtual OsiSolverInterface::ApplyCutsReturnCode applyCuts(const OsiCuts &cs, double effectivenessLb=0.0)
Apply a collection of cuts.
OsiGrbSolverInterface::gutsOfCopy
void gutsOfCopy(const OsiGrbSolverInterface &source)
The real work of a copy constructor (used by copy and assignment)
OsiGrbSolverInterface::freeCachedData
void freeCachedData(int keepCached=KEEPCACHED_NONE)
free all cached data (except specified entries, see getLpPtr())
OsiGrbSolverInterface::keepCachedFlag
keepCachedFlag
Get pointer to Gurobi model and free all specified cached data entries (combined with logical or-oper...
Definition: OsiGrbSolverInterface.hpp:545
OsiGrbSolverInterface::getIntParam
bool getIntParam(OsiIntParam key, int &value) const
Get an integer parameter.
OsiGrbSolverInterface::globalenv_
static GRBenv * globalenv_
Gurobi environment pointer.
Definition: OsiGrbSolverInterface.hpp:773
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::unmarkHotStart
virtual void unmarkHotStart()
Delete the snapshot.
OsiGrbSolverInterface::getLpPtr
GRBmodel * getLpPtr(int keepCached=KEEPCACHED_NONE)
OsiGrbSolverInterface::applyColCut
virtual void applyColCut(const OsiColCut &cc)
Apply a column cut (bound adjustment).
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::numInstances_
static unsigned int numInstances_
Number of instances using the global Gurobi environment.
Definition: OsiGrbSolverInterface.hpp:777
OsiGrbSolverInterface::operator=
OsiGrbSolverInterface & operator=(const OsiGrbSolverInterface &rhs)
Assignment operator.
OsiGrbSolverInterface::disableSimplexInterface
virtual void disableSimplexInterface()
Useless function, defined only for compatibility with OsiSimplexInterface.
Definition: OsiGrbSolverInterface.hpp:668
CoinWarmStart
Abstract base class for warm start information.
Definition: CoinWarmStart.hpp:21
OsiGrbSolverInterface::FREECACHED_RESULTS
free only cached LP solution information
Definition: OsiGrbSolverInterface.hpp:567
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:905
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
Gurobi Solver Interface.
Definition: OsiGrbSolverInterface.hpp:29
OsiGrbSolverInterface::branchAndBound
virtual void branchAndBound()
Invoke solver&#39;s built-in enumeration algorithm.
OsiGrbSolverInterface::setRowType
virtual void setRowType(int index, char sense, double rightHandSide, double range)
Set the type of a single row
OsiGrbSolverInterface::freeCachedResults
void freeCachedResults()
free cached result vectors
OsiGrbSolverInterface::enableSimplexInterface
virtual void enableSimplexInterface(int doingPrimal)
Useless function, defined only for compatibility with OsiSimplexInterface.
Definition: OsiGrbSolverInterface.hpp:663