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

- File List
- File Members

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
23 #ifndef LPX
24 #define LPX glp_prob
25 #endif
26
27 #ifndef GLP_PROB_DEFINED
28 #define GLP_PROB_DEFINED
29 // Glpk < 4.48:
30 typedef struct { double _opaque_prob[100]; } glp_prob;
31 // Glpk 4.48: typedef struct glp_prob glp_prob;
32 #endif
33
34 class OsiGlpkSolverInterface : virtual public OsiSolverInterface {
35 friend void OsiGlpkSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir);
36
37 public:
38
39 //---------------------------------------------------------------------------
42 virtual void initialSolve();
44
46 virtual void resolve();
47
49 virtual void branchAndBound();
51
52 //---------------------------------------------------------------------------
68 // Set an integer parameter
69 bool setIntParam(OsiIntParam key, int value);
70 // Set an double parameter
71 bool setDblParam(OsiDblParam key, double value);
72 // Set a string parameter
73 bool setStrParam(OsiStrParam key, const std::string & value);
74 // Set a hint parameter
75 bool setHintParam(OsiHintParam key, bool sense = true,
76 OsiHintStrength strength = OsiHintTry, void *info = 0) ;
77 // Get an integer parameter
78 bool getIntParam(OsiIntParam key, int& value) const;
79 // Get an double parameter
80 bool getDblParam(OsiDblParam key, double& value) const;
81 // Get a string parameter
82 bool getStrParam(OsiStrParam key, std::string& value) const;
84
85 //---------------------------------------------------------------------------
87
88 virtual bool isAbandoned() const;
91 virtual bool isProvenOptimal() const;
93 virtual bool isProvenPrimalInfeasible() const;
95 virtual bool isProvenDualInfeasible() const;
97 virtual bool isPrimalObjectiveLimitReached() const;
99 virtual bool isDualObjectiveLimitReached() const;
101 virtual bool isIterationLimitReached() const;
103 virtual bool isTimeLimitReached() const;
105 virtual bool isFeasible() const;
107
108 //---------------------------------------------------------------------------
117 inline CoinWarmStart *getEmptyWarmStart () const
118 { return (dynamic_cast<CoinWarmStart *>(new CoinWarmStartBasis())) ; }
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
217 #if 0
218 virtual bool isBinary(int columnNumber) const;
220
225 virtual bool isInteger(int columnNumber) const;
226
228 virtual bool isIntegerNonBinary(int columnNumber) const;
229
231 virtual bool isFreeBinary(int columnNumber) const;
232 #endif
233
235 virtual const CoinPackedMatrix * getMatrixByRow() const;
236
238 virtual const CoinPackedMatrix * getMatrixByCol() const;
239
241 virtual double getInfinity() const;
243
246 virtual const double * getColSolution() const;
248
250 virtual const double * getRowPrice() const;
251
253 virtual const double * getReducedCost() const;
254
257 virtual const double * getRowActivity() const;
258
260 virtual double getObjValue() const;
261
264 virtual int getIterationCount() const;
265
277 virtual std::vector<double*> getDualRays(int maxNumRays,
278 bool fullRay=false) const;
296 virtual std::vector<double*> getPrimalRays(int maxNumRays) const;
297
298 #if 0
299
301 virtual OsiVectorInt getFractionalIndices(const double etol=1.e-05)
302 const;
303 #endif
304
305
306
307 //---------------------------------------------------------------------------
308
311 //-------------------------------------------------------------------------
315 virtual void setObjCoeff( int elementIndex, double elementValue );
316
317 using OsiSolverInterface::setColLower ;
320 virtual void setColLower( int elementIndex, double elementValue );
321
322 using OsiSolverInterface::setColUpper ;
325 virtual void setColUpper( int elementIndex, double elementValue );
326
330 virtual void setColBounds( int elementIndex,
331 double lower, double upper );
332
341 virtual void setColSetBounds(const int* indexFirst,
342 const int* indexLast,
343 const double* boundList);
344
347 virtual void setRowLower( int elementIndex, double elementValue );
348
351 virtual void setRowUpper( int elementIndex, double elementValue );
352
356 virtual void setRowBounds( int elementIndex,
357 double lower, double upper );
358
360 virtual void setRowType(int index, char sense, double rightHandSide,
361 double range);
362
371 virtual void setRowSetBounds(const int* indexFirst,
372 const int* indexLast,
373 const double* boundList);
374
385 virtual void setRowSetTypes(const int* indexFirst,
386 const int* indexLast,
387 const char* senseList,
388 const double* rhsList,
389 const double* rangeList);
391
392 //-------------------------------------------------------------------------
396 virtual void setContinuous(int index);
398 virtual void setInteger(int index);
401 virtual void setContinuous(const int* indices, int len);
404 virtual void setInteger(const int* indices, int len);
406
407 //-------------------------------------------------------------------------
409 virtual void setObjSense(double s);
410
421 virtual void setColSolution(const double * colsol);
422
433 virtual void setRowPrice(const double * rowprice);
434
435 //-------------------------------------------------------------------------
440
441 using OsiSolverInterface::addCol ;
443 virtual void addCol(const CoinPackedVectorBase& vec,
444 const double collb, const double colub,
445 const double obj);
446
447 using OsiSolverInterface::addCols ;
449 virtual void addCols(const int numcols,
450 const CoinPackedVectorBase * const * cols,
451 const double* collb, const double* colub,
452 const double* obj);
454 virtual void deleteCols(const int num, const int * colIndices);
455
456 using OsiSolverInterface::addRow ;
458 virtual void addRow(const CoinPackedVectorBase& vec,
459 const double rowlb, const double rowub);
461 virtual void addRow(const CoinPackedVectorBase& vec,
462 const char rowsen, const double rowrhs,
463 const double rowrng);
464
465 using OsiSolverInterface::addRows ;
467 virtual void addRows(const int numrows,
468 const CoinPackedVectorBase * const * rows,
469 const double* rowlb, const double* rowub);
471 virtual void addRows(const int numrows,
472 const CoinPackedVectorBase * const * rows,
473 const char* rowsen, const double* rowrhs,
474 const double* rowrng);
476 virtual void deleteRows(const int num, const int * rowIndices);
477
478 #if 0
479 // ??? implemented in OsiSolverInterface
480 //-----------------------------------------------------------------------
502 virtual ApplyCutsReturnCode applyCuts(const OsiCuts & cs,
503 double effectivenessLb = 0.0);
504 #endif
505
506
507
508 //---------------------------------------------------------------------------
509
523 virtual void loadProblem(const CoinPackedMatrix& matrix,
524 const double* collb, const double* colub,
525 const double* obj,
526 const double* rowlb, const double* rowub);
527
535 virtual void assignProblem(CoinPackedMatrix*& matrix,
536 double*& collb, double*& colub, double*& obj,
537 double*& rowlb, double*& rowub);
538
551 virtual void loadProblem(const CoinPackedMatrix& matrix,
552 const double* collb, const double* colub,
553 const double* obj,
554 const char* rowsen, const double* rowrhs,
555 const double* rowrng);
556
564 virtual void assignProblem(CoinPackedMatrix*& matrix,
565 double*& collb, double*& colub, double*& obj,
566 char*& rowsen, double*& rowrhs,
567 double*& rowrng);
568
571 virtual void loadProblem(const int numcols, const int numrows,
572 const int* start, const int* index,
573 const double* value,
574 const double* collb, const double* colub,
575 const double* obj,
576 const double* rowlb, const double* rowub);
577
580 virtual void loadProblem(const int numcols, const int numrows,
581 const int* start, const int* index,
582 const double* value,
583 const double* collb, const double* colub,
584 const double* obj,
585 const char* rowsen, const double* rowrhs,
586 const double* rowrng);
587
588 using OsiSolverInterface::readMps ;
590 virtual int readMps(const char *filename,
591 const char *extension = "mps");
592
597 virtual void writeMps(const char *filename,
598 const char *extension = "mps",
599 double objSense=0.0) const;
601
602 //---------------------------------------------------------------------------
603
610
613 void setObjName (std::string name) ;
614
620 void setRowName(int ndx, std::string name) ;
621
627 void setColName(int ndx, std::string name) ;
628
630
631 //---------------------------------------------------------------------------
632
635 enum keepCachedFlag
636 {
638 KEEPCACHED_NONE = 0,
640 KEEPCACHED_COLUMN = 1,
642 KEEPCACHED_ROW = 2,
644 KEEPCACHED_MATRIX = 4,
646 KEEPCACHED_RESULTS = 8,
648 KEEPCACHED_PROBLEM = KEEPCACHED_COLUMN | KEEPCACHED_ROW | KEEPCACHED_MATRIX,
650 KEEPCACHED_ALL = KEEPCACHED_PROBLEM | KEEPCACHED_RESULTS,
652 FREECACHED_COLUMN = KEEPCACHED_PROBLEM & ~KEEPCACHED_COLUMN,
654 FREECACHED_ROW = KEEPCACHED_PROBLEM & ~KEEPCACHED_ROW,
656 FREECACHED_MATRIX = KEEPCACHED_PROBLEM & ~KEEPCACHED_MATRIX,
658 FREECACHED_RESULTS = KEEPCACHED_ALL & ~KEEPCACHED_RESULTS
659 };
660
662 LPX * getModelPtr();
663
665
674 static void incrementInstanceCounter() { ++numInstances_; }
675
683 static void decrementInstanceCounter();
684
686 static unsigned int getNumInstances() { return numInstances_; }
688
689
692 OsiGlpkSolverInterface();
694
696 virtual OsiSolverInterface * clone(bool copyData = true) const;
697
699 OsiGlpkSolverInterface( const OsiGlpkSolverInterface& );
700
702 OsiGlpkSolverInterface& operator=( const OsiGlpkSolverInterface& rhs );
703
705 virtual ~OsiGlpkSolverInterface();
706
708 virtual void reset();
710
711 protected:
712
715 virtual void applyRowCut( const OsiRowCut & rc );
717
721 virtual void applyColCut( const OsiColCut & cc );
722
724 LPX * getMutableModelPtr() const;
725
727
728 private:
731
733 void gutsOfCopy( const OsiGlpkSolverInterface & source );
734
736 void gutsOfConstructor();
737
739 void gutsOfDestructor();
740
742 void freeCachedColRim();
743
745 void freeCachedRowRim();
746
748 void freeCachedResults();
749
751 void freeCachedMatrix();
752
754 void freeCachedData( int keepCached = KEEPCACHED_NONE );
755
757 void freeAllMemory();
758
760 void printBounds();
761
763 void fillColBounds() const;
765
766
769 mutable LPX* lp_;
771
773 static unsigned int numInstances_;
774
775
776 // Remember whether simplex or b&b was most recently done
777 // 0 = simplex; 1 = b&b
778 int bbWasLast_;
779
780 // Int parameters.
782 int maxIteration_;
784 int hotStartMaxIteration_;
786 int nameDisc_;
787
788 // Double parameters.
790 double dualObjectiveLimit_;
792 double primalObjectiveLimit_;
794 double dualTolerance_;
796 double primalTolerance_;
798 double objOffset_;
799
800 // String parameters
802 std::string probName_;
803
805 mutable void *info_[OsiLastHintParam] ;
806
807
809
811 int hotStartCStatSize_;
813 int *hotStartCStat_;
815 double *hotStartCVal_;
817 double *hotStartCDualVal_;
818
820 int hotStartRStatSize_;
822 int *hotStartRStat_;
824 double *hotStartRVal_;
826 double *hotStartRDualVal_;
827
828 // Status information
830 bool isIterationLimitReached_;
832 bool isTimeLimitReached_;
834 bool isAbandoned_;
840 bool isObjLowerLimitReached_;
846 bool isObjUpperLimitReached_;
848 bool isPrimInfeasible_;
850 bool isDualInfeasible_;
852 bool isFeasible_;
853
856
858 mutable int iter_used_;
859
861 mutable double *obj_;
862
864 mutable double *collower_;
865
867 mutable double *colupper_;
868
870 mutable char *ctype_;
871
873 mutable char *rowsense_;
874
876 mutable double *rhs_;
877
879 mutable double *rowrange_;
880
882 mutable double *rowlower_;
883
885 mutable double *rowupper_;
886
888 mutable double *colsol_;
889
891 mutable double *rowsol_;
892
894 mutable double *redcost_;
895
897 mutable double *rowact_;
898
900 mutable CoinPackedMatrix *matrixByRow_;
901
903 mutable CoinPackedMatrix *matrixByCol_;
905
906 };
907
908 //#############################################################################
910 void OsiGlpkSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir);
911
912 #endif // OsiGlpkSolverInterface_H
OsiGlpkSolverInterface::markHotStart
virtual void markHotStart()
Create a hotstart point of the optimization process.
OsiGlpkSolverInterface::freeCachedRowRim
void freeCachedRowRim()
free cached row rim vectors
OsiHintStrength
OsiHintStrength
Definition: OsiSolverParameters.hpp:131
OsiGlpkSolverInterface::primalObjectiveLimit_
double primalObjectiveLimit_
primal objective limit (measure of goodness; stop if we&#39;re better)
Definition: OsiGlpkSolverInterface.hpp:792
OsiGlpkSolverInterface::getRowLower
virtual const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
OsiGlpkSolverInterface::getMatrixByCol
virtual const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of matrix.
OsiSolverInterface::setColLower
virtual void setColLower(int elementIndex, double elementValue)=0
Set a single column lower bound.
CoinPackedMatrix.hpp
OsiGlpkSolverInterface::FREECACHED_MATRIX
free only cached matrix and LP solution information
Definition: OsiGlpkSolverInterface.hpp:656
OsiGlpkSolverInterface::KEEPCACHED_ALL
keep all cached data (similar to getMutableLpPtr())
Definition: OsiGlpkSolverInterface.hpp:650
OsiGlpkSolverInterface::getNumCols
virtual int getNumCols() const
Get number of columns.
OsiGlpkSolverInterface::setIntParam
bool setIntParam(OsiIntParam key, int value)
Set an integer parameter.
OsiGlpkSolverInterface::isIterationLimitReached_
bool isIterationLimitReached_
glpk stopped on iteration limit
Definition: OsiGlpkSolverInterface.hpp:830
OsiIntParam
OsiIntParam
Definition: OsiSolverParameters.hpp:8
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::keepCachedFlag
keepCachedFlag
Get pointer to GLPK model.
Definition: OsiGlpkSolverInterface.hpp:635
OsiGlpkSolverInterface::isPrimalObjectiveLimitReached
virtual bool isPrimalObjectiveLimitReached() const
Is the given primal objective limit reached?
OsiGlpkSolverInterface::hotStartRStatSize_
int hotStartRStatSize_
size of row status and value arrays
Definition: OsiGlpkSolverInterface.hpp:820
OsiGlpkSolverInterface::isPrimInfeasible_
bool isPrimInfeasible_
glpk declared the problem primal infeasible
Definition: OsiGlpkSolverInterface.hpp:848
OsiGlpkSolverInterface::colupper_
double * colupper_
Pointer to dense vector of variable lower bounds.
Definition: OsiGlpkSolverInterface.hpp:867
OsiColCut
Column Cut Class.
Definition: OsiColCut.hpp:23
OsiGlpkSolverInterface::hotStartRDualVal_
double * hotStartRDualVal_
row dual values
Definition: OsiGlpkSolverInterface.hpp:826
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::maxIteration_
int maxIteration_
simplex iteration limit (per call to solver)
Definition: OsiGlpkSolverInterface.hpp:782
OsiGlpkSolverInterface::getWarmStart
virtual CoinWarmStart * getWarmStart() const
Get warmstarting information.
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.
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
OsiGlpkSolverInterface::getRightHandSide
virtual const double * getRightHandSide() const
Get pointer to array[getNumRows()] of rows right-hand sides.
OsiGlpkSolverInterface::probName_
std::string probName_
Problem name.
Definition: OsiGlpkSolverInterface.hpp:802
OsiGlpkSolverInterface::isContinuous
virtual bool isContinuous(int colNumber) const
Return true if column is continuous.
OsiGlpkSolverInterface::gutsOfConstructor
void gutsOfConstructor()
The real work of the constructor.
OsiGlpkSolverInterface::deleteRows
virtual void deleteRows(const int num, const int *rowIndices)
Delete a set of rows (constraints) from the problem.
OsiGlpkSolverInterface::rowlower_
double * rowlower_
Pointer to dense vector of row lower bounds.
Definition: OsiGlpkSolverInterface.hpp:882
OsiGlpkSolverInterface::getNumElements
virtual int getNumElements() const
Get number of nonzero elements.
OsiGlpkSolverInterface::getNumInstances
static unsigned int getNumInstances()
Return the number of LP/MIP instances of instantiated objects using the GLPK environment.
Definition: OsiGlpkSolverInterface.hpp:686
OsiGlpkSolverInterface::getRowActivity
virtual const double * getRowActivity() const
Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vecto...
OsiGlpkSolverInterface::setRowPrice
virtual void setRowPrice(const double *rowprice)
Set dual solution vector.
OsiGlpkSolverInterface::getObjValue
virtual double getObjValue() const
Get objective function value.
OsiGlpkSolverInterface::setRowUpper
virtual void setRowUpper(int elementIndex, double elementValue)
Set a single row upper bound Use COIN_DBL_MAX for infinity.
OsiGlpkSolverInterface::rowsol_
double * rowsol_
Pointer to dual solution vector.
Definition: OsiGlpkSolverInterface.hpp:891
OsiGlpkSolverInterface::setColLower
virtual void setColLower(int elementIndex, double elementValue)
Set a single column lower bound Use -COIN_DBL_MAX for -infinity.
OsiGlpkSolverInterface::gutsOfCopy
void gutsOfCopy(const OsiGlpkSolverInterface &source)
The real work of a copy constructor (used by copy and assignment)
OsiGlpkSolverInterface::gutsOfDestructor
void gutsOfDestructor()
The real work of the destructor.
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::getNumRows
virtual int getNumRows() const
Get number of rows.
OsiGlpkSolverInterface::hotStartRVal_
double * hotStartRVal_
row slack values
Definition: OsiGlpkSolverInterface.hpp:824
OsiGlpkSolverInterface::incrementInstanceCounter
static void incrementInstanceCounter()
GLPK has a context which must be freed after all GLPK LPs (or MIPs) are freed.
Definition: OsiGlpkSolverInterface.hpp:674
OsiGlpkSolverInterface::getMutableModelPtr
LPX * getMutableModelPtr() const
Pointer to the model.
OsiGlpkSolverInterface::FREECACHED_ROW
free only cached row and LP solution information
Definition: OsiGlpkSolverInterface.hpp:654
OsiGlpkSolverInterface::getColUpper
virtual const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
OsiGlpkSolverInterface::OsiGlpkSolverInterface
OsiGlpkSolverInterface()
Default Constructor.
OsiGlpkSolverInterface::nameDisc_
int nameDisc_
OSI name discipline.
Definition: OsiGlpkSolverInterface.hpp:786
OsiGlpkSolverInterface::isAbandoned
virtual bool isAbandoned() const
Are there a numerical difficulties?
OsiGlpkSolverInterface::printBounds
void printBounds()
Just for testing purposes.
OsiGlpkSolverInterface::initialSolve
virtual void initialSolve()
Solve initial LP relaxation.
OsiGlpkSolverInterface::getRowSense
virtual const char * getRowSense() const
Get pointer to array[getNumRows()] of row constraint senses.
OsiGlpkSolverInterface::freeAllMemory
void freeAllMemory()
free all allocated memory
CoinPackedMatrix
Sparse Matrix Base Class.
Definition: CoinPackedMatrix.hpp:79
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::addRows
virtual void addRows(const int numrows, const CoinPackedVectorBase *const *rows, const double *rowlb, const double *rowub)
OsiGlpkSolverInterface::setColSolution
virtual void setColSolution(const double *colsol)
Set the primal solution column values.
OsiGlpkSolverInterface::hotStartCVal_
double * hotStartCVal_
primal variable values
Definition: OsiGlpkSolverInterface.hpp:815
OsiGlpkSolverInterface::hotStartCDualVal_
double * hotStartCDualVal_
dual variable values
Definition: OsiGlpkSolverInterface.hpp:817
OsiGlpkSolverInterface::lp_
LPX * lp_
GPLK model represented by this class instance.
Definition: OsiGlpkSolverInterface.hpp:770
OsiGlpkSolverInterface::collower_
double * collower_
Pointer to dense vector of variable lower bounds.
Definition: OsiGlpkSolverInterface.hpp:864
OsiGlpkSolverInterface::getRowRange
virtual const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
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::primalTolerance_
double primalTolerance_
primal feasibility tolerance
Definition: OsiGlpkSolverInterface.hpp:796
LPX
#define LPX
GPLK Solver Interface.
Definition: OsiGlpkSolverInterface.hpp:24
OsiCuts
Collections of row cuts and column cuts.
Definition: OsiCuts.hpp:19
OsiGlpkSolverInterface::addRow
virtual void addRow(const CoinPackedVectorBase &vec, const double rowlb, const double rowub)
Add a row (constraint) to the problem.
OsiGlpkSolverInterface::KEEPCACHED_MATRIX
problem matrix: matrix ordered by column and by row
Definition: OsiGlpkSolverInterface.hpp:644
OsiSolverInterface::readMps
virtual int readMps(const char *filename, const char *extension="mps")
Read a problem in MPS format from the given filename.
OsiGlpkSolverInterface::isIterationLimitReached
virtual bool isIterationLimitReached() const
Iteration limit reached?
OsiGlpkSolverInterface::setInteger
virtual void setInteger(int index)
Set the index-th variable to be an integer variable.
OsiSolverInterface::setColUpper
virtual void setColUpper(int elementIndex, double elementValue)=0
Set a single column upper bound.
OsiGlpkSolverInterface::branchAndBound
virtual void branchAndBound()
Invoke solver&#39;s built-in enumeration algorithm.
OsiGlpkSolverInterface::setWarmStart
virtual bool setWarmStart(const CoinWarmStart *warmstart)
Set warmstarting information.
OsiGlpkSolverInterface::getColLower
virtual const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
OsiGlpkSolverInterface::isDualObjectiveLimitReached
virtual bool isDualObjectiveLimitReached() const
Is the given dual objective limit reached?
OsiLastHintParam
Just a marker, so that OsiSolverInterface can allocate a static sized array to store parameters...
Definition: OsiSolverParameters.hpp:128
CoinPackedVectorBase
Abstract base class for various sparse vectors.
Definition: CoinPackedVectorBase.hpp:23
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::KEEPCACHED_NONE
discard all cached data (default)
Definition: OsiGlpkSolverInterface.hpp:638
OsiGlpkSolverInterface::decrementInstanceCounter
static void decrementInstanceCounter()
GLPK has a context which must be freed after all GLPK LPs (or MIPs) are freed.
OsiVectorInt
std::vector< int > OsiVectorInt
Vector of int.
Definition: OsiCollections.hpp:22
OsiGlpkSolverInterface::info_
void * info_[OsiLastHintParam]
Array for info blocks associated with hints.
Definition: OsiGlpkSolverInterface.hpp:805
OsiGlpkSolverInterface::applyRowCut
virtual void applyRowCut(const OsiRowCut &rc)
Apply a row cut. Return true if cut was applied.
OsiGlpkSolverInterface::setObjName
void setObjName(std::string name)
Set the objective function name.
OsiGlpkSolverInterface::isFeasible_
bool isFeasible_
glpk declared the problem feasible
Definition: OsiGlpkSolverInterface.hpp:852
OsiGlpkSolverInterface::obj_
double * obj_
Pointer to objective vector.
Definition: OsiGlpkSolverInterface.hpp:861
OsiGlpkSolverInterface::isFeasible
virtual bool isFeasible() const
(Integer) Feasible solution found?
OsiGlpkSolverInterface::setContinuous
virtual void setContinuous(int index)
Set the index-th variable to be a continuous variable.
OsiGlpkSolverInterface::getObjSense
virtual double getObjSense() const
Get objective function sense (1 for min (default), -1 for max)
OsiGlpkSolverInterface::redcost_
double * redcost_
Pointer to reduced cost vector.
Definition: OsiGlpkSolverInterface.hpp:894
OsiGlpkSolverInterface::hotStartCStatSize_
int hotStartCStatSize_
Hotstart information.
Definition: OsiGlpkSolverInterface.hpp:811
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...
OsiGlpkSolverInterface::setRowName
void setRowName(int ndx, std::string name)
Set a row name.
OsiGlpkSolverInterface::readMps
virtual int readMps(const char *filename, const char *extension="mps")
Read an mps file from the given filename.
OsiGlpkSolverInterface::getIntParam
bool getIntParam(OsiIntParam key, int &value) const
Get an integer parameter.
OsiGlpkSolverInterface::setRowLower
virtual void setRowLower(int elementIndex, double elementValue)
Set a single row lower bound Use -COIN_DBL_MAX for -infinity.
OsiGlpkSolverInterface::matrixByCol_
CoinPackedMatrix * matrixByCol_
Pointer to row-wise copy of problem matrix coefficients.
Definition: OsiGlpkSolverInterface.hpp:903
OsiStrParam
OsiStrParam
Definition: OsiSolverParameters.hpp:88
OsiGlpkSolverInterface::isProvenOptimal
virtual bool isProvenOptimal() const
Is optimality proven?
OsiGlpkSolverInterface::getMatrixByRow
virtual const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of matrix.
OsiGlpkSolverInterface::KEEPCACHED_ROW
row information: right hand sides, ranges and senses, lower and upper bounds for row ...
Definition: OsiGlpkSolverInterface.hpp:642
OsiGlpkSolverInterface::KEEPCACHED_RESULTS
LP solution: primal and dual solution, reduced costs, row activities.
Definition: OsiGlpkSolverInterface.hpp:646
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::rowupper_
double * rowupper_
Pointer to dense vector of row upper bounds.
Definition: OsiGlpkSolverInterface.hpp:885
OsiGlpkSolverInterface::FREECACHED_RESULTS
free only cached LP solution information
Definition: OsiGlpkSolverInterface.hpp:658
OsiGlpkSolverInterface::dualObjectiveLimit_
double dualObjectiveLimit_
dual objective limit (measure of badness; stop if we&#39;re worse)
Definition: OsiGlpkSolverInterface.hpp:790
OsiGlpkSolverInterface::reset
virtual void reset()
Resets as if default constructor.
OsiGlpkSolverInterface::ctype_
char * ctype_
Pointer to dense vector of variable types (continous, binary, integer)
Definition: OsiGlpkSolverInterface.hpp:870
OsiGlpkSolverInterface::KEEPCACHED_COLUMN
column information: objective values, lower and upper bounds, variable types
Definition: OsiGlpkSolverInterface.hpp:640
OsiGlpkSolverInterface::iter_used_
int iter_used_
Number of iterations.
Definition: OsiGlpkSolverInterface.hpp:858
OsiSolverInterface::isBinary
virtual bool isBinary(int colIndex) const
Return true if the variable is binary.
OsiGlpkSolverInterface::getDualRays
virtual std::vector< double * > getDualRays(int maxNumRays, bool fullRay=false) const
Get as many dual rays as the solver can provide.
OsiGlpkSolverInterface::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)
OsiGlpkSolverInterface::isDualInfeasible_
bool isDualInfeasible_
glpk declared the problem dual infeasible
Definition: OsiGlpkSolverInterface.hpp:850
OsiGlpkSolverInterface::setColName
void setColName(int ndx, std::string name)
Set a column name.
OsiGlpkSolverInterface::FREECACHED_COLUMN
free only cached column and LP solution information
Definition: OsiGlpkSolverInterface.hpp:652
OsiSolverInterface.hpp
OsiSolverInterface
Abstract Base Class for describing an interface to a solver.
Definition: OsiSolverInterface.hpp:62
CoinWarmStartBasis.hpp
OsiGlpkSolverInterface::deleteCols
virtual void deleteCols(const int num, const int *colIndices)
Remove a set of columns (primal variables) from the problem.
OsiGlpkSolverInterface::rhs_
double * rhs_
Pointer to dense vector of row right-hand side values.
Definition: OsiGlpkSolverInterface.hpp:876
OsiGlpkSolverInterface::solveFromHotStart
virtual void solveFromHotStart()
Optimize starting from the hotstart.
OsiGlpkSolverInterfaceUnitTest
void OsiGlpkSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir)
A function that tests the methods in the OsiGlpkSolverInterface class.
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::rowact_
double * rowact_
Pointer to row activity (slack) vector.
Definition: OsiGlpkSolverInterface.hpp:897
OsiGlpkSolverInterface::isObjLowerLimitReached_
bool isObjLowerLimitReached_
glpk stopped on lower objective limit
Definition: OsiGlpkSolverInterface.hpp:840
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::setHintParam
bool setHintParam(OsiHintParam key, bool sense=true, OsiHintStrength strength=OsiHintTry, void *info=0)
Set a hint parameter.
OsiGlpkSolverInterface::getRowUpper
virtual const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
OsiGlpkSolverInterface::resolve
virtual void resolve()
Resolve an LP relaxation after problem modification.
OsiGlpkSolverInterface::hotStartCStat_
int * hotStartCStat_
column status array
Definition: OsiGlpkSolverInterface.hpp:813
OsiGlpkSolverInterface::applyColCut
virtual void applyColCut(const OsiColCut &cc)
Apply a column cut (bound adjustment).
OsiGlpkSolverInterface::freeCachedResults
void freeCachedResults()
free cached result vectors
OsiGlpkSolverInterface::setObjCoeff
virtual void setObjCoeff(int elementIndex, double elementValue)
Set an objective function coefficient.
OsiGlpkSolverInterface::KEEPCACHED_PROBLEM
only discard cached LP solution
Definition: OsiGlpkSolverInterface.hpp:648
OsiGlpkSolverInterface::matrixByRow_
CoinPackedMatrix * matrixByRow_
Pointer to row-wise copy of problem matrix coefficients.
Definition: OsiGlpkSolverInterface.hpp:900
OsiSolverInterface::addRow
virtual void addRow(const CoinPackedVectorBase &vec, const double rowlb, const double rowub)=0
Add a row (constraint) to the problem.
CoinWarmStart
Abstract base class for warm start information.
Definition: CoinWarmStart.hpp:21
OsiGlpkSolverInterface::setStrParam
bool setStrParam(OsiStrParam key, const std::string &value)
Set a string parameter.
OsiGlpkSolverInterface::unmarkHotStart
virtual void unmarkHotStart()
Delete the snapshot.
OsiGlpkSolverInterface::isObjUpperLimitReached_
bool isObjUpperLimitReached_
glpk stopped on upper objective limit
Definition: OsiGlpkSolverInterface.hpp:846
OsiGlpkSolverInterface::getIterationCount
virtual int getIterationCount() const
Get how many iterations it took to solve the problem (whatever &quot;iteration&quot; mean to the solver...
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::setObjSense
virtual void setObjSense(double s)
Set objective function sense (1 for min (default), -1 for max,)
OsiGlpkSolverInterface
Definition: OsiGlpkSolverInterface.hpp:34
OsiGlpkSolverInterface::isTimeLimitReached
virtual bool isTimeLimitReached() const
Time limit reached?
OsiGlpkSolverInterface::clone
virtual OsiSolverInterface * clone(bool copyData=true) const
Clone.
OsiGlpkSolverInterface::operator=
OsiGlpkSolverInterface & operator=(const OsiGlpkSolverInterface &rhs)
Assignment operator.
OsiGlpkSolverInterface::rowsense_
char * rowsense_
Pointer to dense vector of row sense indicators.
Definition: OsiGlpkSolverInterface.hpp:873
OsiHintParam
OsiHintParam
Definition: OsiSolverParameters.hpp:107
OsiGlpkSolverInterface::getRowPrice
virtual const double * getRowPrice() const
Get pointer to array[getNumRows()] of dual prices.
OsiGlpkSolverInterface::isAbandoned_
bool isAbandoned_
glpk abandoned the problem
Definition: OsiGlpkSolverInterface.hpp:834
OsiGlpkSolverInterface::isProvenDualInfeasible
virtual bool isProvenDualInfeasible() const
Is dual infeasiblity proven?
OsiGlpkSolverInterface::hotStartMaxIteration_
int hotStartMaxIteration_
simplex iteration limit (for hot start)
Definition: OsiGlpkSolverInterface.hpp:784
OsiSolverInterface::isInteger
virtual bool isInteger(int colIndex) const
Return true if the variable is integer.
OsiGlpkSolverInterface::bbWasLast_
int bbWasLast_
GPLK model represented by this class instance.
Definition: OsiGlpkSolverInterface.hpp:778
OsiDblParam
OsiDblParam
Definition: OsiSolverParameters.hpp:52
OsiGlpkSolverInterface::numInstances_
static unsigned int numInstances_
number of GLPK instances currently in use (counts only those created by OsiGlpk)
Definition: OsiGlpkSolverInterface.hpp:773
OsiGlpkSolverInterface::rowrange_
double * rowrange_
Pointer to dense vector of slack upper bounds for range constraints (undefined for non-range rows) ...
Definition: OsiGlpkSolverInterface.hpp:879
OsiSolverInterface::isFreeBinary
virtual bool isFreeBinary(int colIndex) const
Return true if the variable is binary and not fixed.
OsiGlpkSolverInterface::OsiGlpkSolverInterfaceUnitTest
friend void OsiGlpkSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir)
A function that tests the methods in the OsiGlpkSolverInterface class.
OsiGlpkSolverInterface::getDblParam
bool getDblParam(OsiDblParam key, double &value) const
Get a double parameter.
OsiGlpkSolverInterface::setColUpper
virtual void setColUpper(int elementIndex, double elementValue)
Set a single column upper bound Use COIN_DBL_MAX for infinity.
OsiGlpkSolverInterface::objOffset_
double objOffset_
constant offset for objective function
Definition: OsiGlpkSolverInterface.hpp:798
OsiGlpkSolverInterface::getReducedCost
virtual const double * getReducedCost() const
Get a pointer to array[getNumCols()] of reduced costs.
OsiGlpkSolverInterface::getModelPtr
LPX * getModelPtr()
Get pointer to GLPK model.
OsiHintTry
This means it is only a hint.
Definition: OsiSolverParameters.hpp:135
OsiGlpkSolverInterface::getObjCoefficients
virtual const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
OsiGlpkSolverInterface::colsol_
double * colsol_
Pointer to primal solution vector.
Definition: OsiGlpkSolverInterface.hpp:888
OsiGlpkSolverInterface::isProvenPrimalInfeasible
virtual bool isProvenPrimalInfeasible() const
Is primal infeasiblity proven?
OsiGlpkSolverInterface::freeCachedColRim
void freeCachedColRim()
free cached column rim vectors
OsiSolverInterface::applyCuts
virtual ApplyCutsReturnCode applyCuts(const OsiCuts &cs, double effectivenessLb=0.0)
Apply a collection of cuts.
OsiGlpkSolverInterface::getEmptyWarmStart
CoinWarmStart * getEmptyWarmStart() const
Get an empty warm start object.
Definition: OsiGlpkSolverInterface.hpp:117
OsiGlpkSolverInterface::dualTolerance_
double dualTolerance_
dual feasibility tolerance
Definition: OsiGlpkSolverInterface.hpp:794
OsiGlpkSolverInterface::setRowType
virtual void setRowType(int index, char sense, double rightHandSide, double range)
Set the type of a single row
OsiGlpkSolverInterface::getPrimalRays
virtual std::vector< double * > getPrimalRays(int maxNumRays) const
Get as many primal rays as the solver can provide.
OsiGlpkSolverInterface::fillColBounds
void fillColBounds() const
Fill cached collumn bounds.
OsiGlpkSolverInterface::getInfinity
virtual double getInfinity() const
Get solver&#39;s value for infinity.
OsiGlpkSolverInterface::hotStartRStat_
int * hotStartRStat_
row status array
Definition: OsiGlpkSolverInterface.hpp:822
OsiGlpkSolverInterface::~OsiGlpkSolverInterface
virtual ~OsiGlpkSolverInterface()
Destructor.
OsiSolverInterface::isIntegerNonBinary
virtual bool isIntegerNonBinary(int colIndex) const
Return true if the variable is general integer.
OsiGlpkSolverInterface::freeCachedData
void freeCachedData(int keepCached=KEEPCACHED_NONE)
free all cached data (except specified entries, see getLpPtr())
CoinWarmStartBasis
The default COIN simplex (basis-oriented) warm start class.
Definition: CoinWarmStartBasis.hpp:40
OsiGlpkSolverInterface::freeCachedMatrix
void freeCachedMatrix()
free cached matrices
glp_prob
Definition: OsiGlpkSolverInterface.hpp:30
OsiGlpkSolverInterface::getColSolution
virtual const double * getColSolution() const
Get pointer to array[getNumCols()] of primal solution vector.
OsiGlpkSolverInterface::getStrParam
bool getStrParam(OsiStrParam key, std::string &value) const
Get a string parameter.
OsiGlpkSolverInterface::isTimeLimitReached_
bool isTimeLimitReached_
glpk stopped on time limit
Definition: OsiGlpkSolverInterface.hpp:832