Osi 0.108.6
Loading...
Searching...
No Matches
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>
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:
30typedef struct {
31 double _opaque_prob[100];
32} glp_prob;
33// Glpk 4.48: typedef struct glp_prob glp_prob;
34#endif
35
37 friend void OsiGlpkSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir);
38
39public:
40 //---------------------------------------------------------------------------
43
44 virtual void initialSolve();
45
47 virtual void resolve();
48
50 virtual void branchAndBound();
52
53 //---------------------------------------------------------------------------
69 // Set an integer parameter
70 bool setIntParam(OsiIntParam key, int value);
71 // Set an double parameter
72 bool setDblParam(OsiDblParam key, double value);
73 // Set a string parameter
74 bool setStrParam(OsiStrParam key, const std::string &value);
75 // Set a hint parameter
76 bool setHintParam(OsiHintParam key, bool sense = true,
77 OsiHintStrength strength = OsiHintTry, void *info = 0);
78 // Get an integer parameter
79 bool getIntParam(OsiIntParam key, int &value) const;
80 // Get an double parameter
81 bool getDblParam(OsiDblParam key, double &value) const;
82 // Get a string parameter
83 bool getStrParam(OsiStrParam key, std::string &value) const;
85
86 //---------------------------------------------------------------------------
88
89
90 virtual bool isAbandoned() const;
92 virtual bool isProvenOptimal() const;
94 virtual bool isProvenPrimalInfeasible() const;
96 virtual bool isProvenDualInfeasible() const;
98 virtual bool isPrimalObjectiveLimitReached() const;
100 virtual bool isDualObjectiveLimitReached() const;
102 virtual bool isIterationLimitReached() const;
104 virtual bool isTimeLimitReached() const;
106 virtual bool isFeasible() const;
108
109 //---------------------------------------------------------------------------
118 inline CoinWarmStart *getEmptyWarmStart() const
119 {
120 return (dynamic_cast< CoinWarmStart * >(new CoinWarmStartBasis()));
121 }
123 virtual CoinWarmStart *getWarmStart() const;
126 virtual bool setWarmStart(const CoinWarmStart *warmstart);
128
129 //---------------------------------------------------------------------------
136
137 virtual void markHotStart();
139 virtual void solveFromHotStart();
141 virtual void unmarkHotStart();
143
144 //---------------------------------------------------------------------------
159
160 virtual int getNumCols() const;
161
163 virtual int getNumRows() const;
164
166 virtual CoinBigIndex getNumElements() const;
167
169 virtual const double *getColLower() const;
170
172 virtual const double *getColUpper() const;
173
183 virtual const char *getRowSense() const;
184
193 virtual const double *getRightHandSide() const;
194
203 virtual const double *getRowRange() const;
204
206 virtual const double *getRowLower() const;
207
209 virtual const double *getRowUpper() const;
210
212 virtual const double *getObjCoefficients() const;
213
215 virtual double getObjSense() const;
216
218 virtual bool isContinuous(int colNumber) const;
219
220#if 0
222 virtual bool isBinary(int columnNumber) const;
223
228 virtual bool isInteger(int columnNumber) const;
229
231 virtual bool isIntegerNonBinary(int columnNumber) const;
232
234 virtual bool isFreeBinary(int columnNumber) const;
235#endif
236
238 virtual const CoinPackedMatrix *getMatrixByRow() const;
239
241 virtual const CoinPackedMatrix *getMatrixByCol() const;
242
244 virtual double getInfinity() const;
246
250 virtual const double *getColSolution() const;
251
253 virtual const double *getRowPrice() const;
254
256 virtual const double *getReducedCost() const;
257
260 virtual const double *getRowActivity() const;
261
263 virtual double getObjValue() const;
264
267 virtual int getIterationCount() const;
268
280 virtual std::vector< double * > getDualRays(int maxNumRays,
281 bool fullRay = false) const;
299 virtual std::vector< double * > getPrimalRays(int maxNumRays) const;
300
301#if 0
304 virtual OsiVectorInt getFractionalIndices(const double etol=1.e-05)
305 const;
306#endif
308
309
310 //---------------------------------------------------------------------------
311
314 //-------------------------------------------------------------------------
318 virtual void setObjCoeff(int elementIndex, double elementValue);
319
323 virtual void setColLower(int elementIndex, double elementValue);
324
328 virtual void setColUpper(int elementIndex, double elementValue);
329
333 virtual void setColBounds(int elementIndex,
334 double lower, double upper);
335
344 virtual void setColSetBounds(const int *indexFirst,
345 const int *indexLast,
346 const double *boundList);
347
350 virtual void setRowLower(int elementIndex, double elementValue);
351
354 virtual void setRowUpper(int elementIndex, double elementValue);
355
359 virtual void setRowBounds(int elementIndex,
360 double lower, double upper);
361
363 virtual void setRowType(int index, char sense, double rightHandSide,
364 double range);
365
374 virtual void setRowSetBounds(const int *indexFirst,
375 const int *indexLast,
376 const double *boundList);
377
388 virtual void setRowSetTypes(const int *indexFirst,
389 const int *indexLast,
390 const char *senseList,
391 const double *rhsList,
392 const double *rangeList);
394
395 //-------------------------------------------------------------------------
399 virtual void setContinuous(int index);
401 virtual void setInteger(int index);
404 virtual void setContinuous(const int *indices, int len);
407 virtual void setInteger(const int *indices, int len);
409
410 //-------------------------------------------------------------------------
412 virtual void setObjSense(double s);
413
424 virtual void setColSolution(const double *colsol);
425
436 virtual void setRowPrice(const double *rowprice);
437
438 //-------------------------------------------------------------------------
443
446 virtual void addCol(const CoinPackedVectorBase &vec,
447 const double collb, const double colub,
448 const double obj);
449
452 virtual void addCols(const int numcols,
453 const CoinPackedVectorBase *const *cols,
454 const double *collb, const double *colub,
455 const double *obj);
457 virtual void deleteCols(const int num, const int *colIndices);
458
461 virtual void addRow(const CoinPackedVectorBase &vec,
462 const double rowlb, const double rowub);
464 virtual void addRow(const CoinPackedVectorBase &vec,
465 const char rowsen, const double rowrhs,
466 const double rowrng);
467
470 virtual void addRows(const int numrows,
471 const CoinPackedVectorBase *const *rows,
472 const double *rowlb, const double *rowub);
474 virtual void addRows(const int numrows,
475 const CoinPackedVectorBase *const *rows,
476 const char *rowsen, const double *rowrhs,
477 const double *rowrng);
479 virtual void deleteRows(const int num, const int *rowIndices);
480
481#if 0
482 // ??? implemented in OsiSolverInterface
483 //-----------------------------------------------------------------------
505 virtual ApplyCutsReturnCode applyCuts(const OsiCuts & cs,
506 double effectivenessLb = 0.0);
507#endif
509
510
511 //---------------------------------------------------------------------------
512
526 virtual void loadProblem(const CoinPackedMatrix &matrix,
527 const double *collb, const double *colub,
528 const double *obj,
529 const double *rowlb, const double *rowub);
530
538 virtual void assignProblem(CoinPackedMatrix *&matrix,
539 double *&collb, double *&colub, double *&obj,
540 double *&rowlb, double *&rowub);
541
554 virtual void loadProblem(const CoinPackedMatrix &matrix,
555 const double *collb, const double *colub,
556 const double *obj,
557 const char *rowsen, const double *rowrhs,
558 const double *rowrng);
559
567 virtual void assignProblem(CoinPackedMatrix *&matrix,
568 double *&collb, double *&colub, double *&obj,
569 char *&rowsen, double *&rowrhs,
570 double *&rowrng);
571
574 virtual void loadProblem(const int numcols, const int numrows,
575 const CoinBigIndex *start, const int *index,
576 const double *value,
577 const double *collb, const double *colub,
578 const double *obj,
579 const double *rowlb, const double *rowub);
580
583 virtual void loadProblem(const int numcols, const int numrows,
584 const CoinBigIndex *start, const int *index,
585 const double *value,
586 const double *collb, const double *colub,
587 const double *obj,
588 const char *rowsen, const double *rowrhs,
589 const double *rowrng);
590
593 virtual int readMps(const char *filename,
594 const char *extension = "mps");
595
600 virtual void writeMps(const char *filename,
601 const char *extension = "mps",
602 double objSense = 0.0) const;
604
605 //---------------------------------------------------------------------------
606
613
616 void setObjName(std::string name);
617
623 void setRowName(int ndx, std::string name);
624
630 void setColName(int ndx, std::string name);
631
633
634 //---------------------------------------------------------------------------
635
654 FREECACHED_COLUMN = KEEPCACHED_PROBLEM & ~KEEPCACHED_COLUMN,
658 FREECACHED_MATRIX = KEEPCACHED_PROBLEM & ~KEEPCACHED_MATRIX,
660 FREECACHED_RESULTS = KEEPCACHED_ALL & ~KEEPCACHED_RESULTS
661 };
662
665
667
677
686
688 static unsigned int getNumInstances() { return numInstances_; }
690
695
697 virtual OsiSolverInterface *clone(bool copyData = true) const;
698
701
704
707
709 virtual void reset();
711
712protected:
716 virtual void applyRowCut(const OsiRowCut &rc);
717
721 virtual void applyColCut(const OsiColCut &cc);
722
725
727
728private:
731
734
737
740
743
746
749
752
754 void freeCachedData(int keepCached = KEEPCACHED_NONE);
755
758
761
763 void fillColBounds() const;
765
769 mutable LPX *lp_;
770
772 static unsigned int numInstances_;
773
774 // Remember whether simplex or b&b was most recently done
775 // 0 = simplex; 1 = b&b
777
778 // Int parameters.
785
786 // Double parameters.
797
798 // String parameters
800 std::string probName_;
801
803 mutable void *info_[OsiLastHintParam];
804
806
815
824
825 // Status information
850
853
855 mutable int iter_used_;
856
858 mutable double *obj_;
859
861 mutable double *collower_;
862
864 mutable double *colupper_;
865
867 mutable char *ctype_;
868
870 mutable char *rowsense_;
871
873 mutable double *rhs_;
874
876 mutable double *rowrange_;
877
879 mutable double *rowlower_;
880
882 mutable double *rowupper_;
883
885 mutable double *colsol_;
886
888 mutable double *rowsol_;
889
891 mutable double *redcost_;
892
894 mutable double *rowact_;
895
897 mutable CoinPackedMatrix *matrixByRow_;
898
900 mutable CoinPackedMatrix *matrixByCol_;
902
903};
904
905//#############################################################################
907void OsiGlpkSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir);
908
909#endif // OsiGlpkSolverInterface_H
910
911/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
912*/
std::vector< int > OsiVectorInt
Vector of int.
#define LPX
GPLK Solver Interface.
void OsiGlpkSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir)
A function that tests the methods in the OsiGlpkSolverInterface class.
@ OsiHintTry
This means it is only a hint.
@ OsiLastHintParam
Just a marker, so that OsiSolverInterface can allocate a static sized array to store parameters.
Column Cut Class.
Definition OsiColCut.hpp:23
Collections of row cuts and column cuts.
Definition OsiCuts.hpp:19
virtual const double * getRowActivity() const
Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vecto...
double * rowsol_
Pointer to dual solution vector.
virtual const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
void freeCachedResults()
free cached result vectors
static void decrementInstanceCounter()
GLPK has a context which must be freed after all GLPK LPs (or MIPs) are freed.
virtual void applyColCut(const OsiColCut &cc)
Apply a column cut (bound adjustment).
double * hotStartRDualVal_
row dual values
bool isTimeLimitReached_
glpk stopped on time limit
virtual void applyRowCut(const OsiRowCut &rc)
Apply a row cut. Return true if cut was applied.
virtual void setObjCoeff(int elementIndex, double elementValue)
Set an objective function coefficient.
virtual bool setWarmStart(const CoinWarmStart *warmstart)
Set warmstarting information.
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()...
virtual const char * getRowSense() const
Get pointer to array[getNumRows()] of row constraint senses.
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.
bool setStrParam(OsiStrParam key, const std::string &value)
Set a string parameter.
void printBounds()
Just for testing purposes.
bool isObjLowerLimitReached_
glpk stopped on lower objective limit
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...
static void incrementInstanceCounter()
GLPK has a context which must be freed after all GLPK LPs (or MIPs) are freed.
double * colupper_
Pointer to dense vector of variable lower bounds.
int hotStartMaxIteration_
simplex iteration limit (for hot start)
virtual void setInteger(const int *indices, int len)
Set the variables listed in indices (which is of length len) to be integer variables.
virtual OsiSolverInterface * clone(bool copyData=true) const
Clone.
virtual bool isAbandoned() const
Are there a numerical difficulties?
virtual void writeMps(const char *filename, const char *extension="mps", double objSense=0.0) const
Write the problem into an mps file of the given filename.
virtual const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
virtual void setRowType(int index, char sense, double rightHandSide, double range)
Set the type of a single row
virtual bool isFeasible() const
(Integer) Feasible solution found?
virtual void solveFromHotStart()
Optimize starting from the hotstart.
void freeCachedData(int keepCached=KEEPCACHED_NONE)
free all cached data (except specified entries, see getLpPtr())
virtual bool isContinuous(int colNumber) const
Return true if column is continuous.
virtual const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
virtual const double * getRightHandSide() const
Get pointer to array[getNumRows()] of rows right-hand sides.
double * hotStartRVal_
row slack values
virtual void setColSolution(const double *colsol)
Set the primal solution column values.
int * hotStartRStat_
row status array
virtual ~OsiGlpkSolverInterface()
Destructor.
virtual void setContinuous(const int *indices, int len)
Set the variables listed in indices (which is of length len) to be continuous variables.
static unsigned int getNumInstances()
Return the number of LP/MIP instances of instantiated objects using the GLPK environment.
bool isDualInfeasible_
glpk declared the problem dual infeasible
virtual const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
double * rowrange_
Pointer to dense vector of slack upper bounds for range constraints (undefined for non-range rows)
double * rowupper_
Pointer to dense vector of row upper bounds.
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...
static unsigned int numInstances_
number of GLPK instances currently in use (counts only those created by OsiGlpk)
virtual double getObjValue() const
Get objective function value.
virtual int getNumCols() const
Get number of columns.
virtual void resolve()
Resolve an LP relaxation after problem modification.
virtual void reset()
Resets as if default constructor.
CoinPackedMatrix * matrixByCol_
Pointer to row-wise copy of problem matrix coefficients.
std::string probName_
Problem name.
bool isAbandoned_
glpk abandoned the problem
virtual const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
virtual bool isIterationLimitReached() const
Iteration limit reached?
virtual const double * getRowPrice() const
Get pointer to array[getNumRows()] of dual prices.
virtual void deleteCols(const int num, const int *colIndices)
Remove a set of columns (primal variables) from the problem.
virtual const double * getColSolution() const
Get pointer to array[getNumCols()] of primal solution vector.
double * obj_
Pointer to objective vector.
double objOffset_
constant offset for objective function
virtual std::vector< double * > getDualRays(int maxNumRays, bool fullRay=false) const
Get as many dual rays as the solver can provide.
OsiGlpkSolverInterface & operator=(const OsiGlpkSolverInterface &rhs)
Assignment operator.
OsiGlpkSolverInterface(const OsiGlpkSolverInterface &)
Copy constructor.
void setColName(int ndx, std::string name)
Set a column name.
virtual void loadProblem(const CoinPackedMatrix &matrix, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub)
Load in an problem by copying the arguments (the constraints on the rows are given by lower and upper...
virtual void addRows(const int numrows, const CoinPackedVectorBase *const *rows, const double *rowlb, const double *rowub)
Add a set of rows (constraints) to the problem.
LPX * lp_
GPLK model represented by this class instance.
virtual void branchAndBound()
Invoke solver's built-in enumeration algorithm.
virtual const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of matrix.
virtual bool isDualObjectiveLimitReached() const
Is the given dual objective limit reached?
void freeCachedRowRim()
free cached row rim vectors
int maxIteration_
simplex iteration limit (per call to solver)
bool setDblParam(OsiDblParam key, double value)
Set a double parameter.
int * hotStartCStat_
column status array
virtual CoinBigIndex getNumElements() const
Get number of nonzero elements.
virtual void setRowPrice(const double *rowprice)
Set dual solution vector.
virtual bool isPrimalObjectiveLimitReached() const
Is the given primal objective limit reached?
virtual void addCol(const CoinPackedVectorBase &vec, const double collb, const double colub, const double obj)
Add a column (primal variable) to the problem.
virtual void addRow(const CoinPackedVectorBase &vec, const char rowsen, const double rowrhs, const double rowrng)
Add a row (constraint) to the problem.
int nameDisc_
OSI name discipline.
virtual void setInteger(int index)
Set the index-th variable to be an integer variable.
double primalTolerance_
primal feasibility tolerance
virtual const double * getReducedCost() const
Get a pointer to array[getNumCols()] of reduced costs.
void setObjName(std::string name)
Set the objective function name.
virtual void setRowLower(int elementIndex, double elementValue)
Set a single row lower bound Use -COIN_DBL_MAX for -infinity.
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...
bool isPrimInfeasible_
glpk declared the problem primal infeasible
virtual const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
virtual void setColUpper(int elementIndex, double elementValue)
Set a single column upper bound Use COIN_DBL_MAX for infinity.
bool setHintParam(OsiHintParam key, bool sense=true, OsiHintStrength strength=OsiHintTry, void *info=0)
Set a hint parameter.
CoinPackedMatrix * matrixByRow_
Pointer to row-wise copy of problem matrix coefficients.
virtual void loadProblem(const int numcols, const int numrows, const CoinBigIndex *start, const int *index, const double *value, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub)
Just like the other loadProblem() methods except that the matrix is given in a standard column major ...
virtual void setColBounds(int elementIndex, double lower, double upper)
Set a single column lower and upper bound The default implementation just invokes setColLower() and ...
virtual bool isProvenDualInfeasible() const
Is dual infeasiblity proven?
virtual std::vector< double * > getPrimalRays(int maxNumRays) const
Get as many primal rays as the solver can provide.
virtual void unmarkHotStart()
Delete the snapshot.
void setRowName(int ndx, std::string name)
Set a row name.
bool getIntParam(OsiIntParam key, int &value) const
Get an integer parameter.
double * redcost_
Pointer to reduced cost vector.
double * hotStartCVal_
primal variable values
LPX * getMutableModelPtr() const
Pointer to the model.
void * info_[OsiLastHintParam]
Array for info blocks associated with hints.
virtual void initialSolve()
Solve initial LP relaxation.
virtual int readMps(const char *filename, const char *extension="mps")
Read an mps file from the given filename.
int hotStartCStatSize_
Hotstart information.
void gutsOfConstructor()
The real work of the constructor.
double * rowlower_
Pointer to dense vector of row lower bounds.
OsiGlpkSolverInterface()
Default Constructor.
int hotStartRStatSize_
size of row status and value arrays
void freeAllMemory()
free all allocated memory
void gutsOfDestructor()
The real work of the destructor.
friend void OsiGlpkSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netlibDir)
A function that tests the methods in the OsiGlpkSolverInterface class.
virtual bool isProvenPrimalInfeasible() const
Is primal infeasiblity proven?
bool getDblParam(OsiDblParam key, double &value) const
Get a double parameter.
bool getStrParam(OsiStrParam key, std::string &value) const
Get a string parameter.
char * rowsense_
Pointer to dense vector of row sense indicators.
virtual CoinWarmStart * getWarmStart() const
Get warmstarting information.
bool isIterationLimitReached_
glpk stopped on iteration limit
double * collower_
Pointer to dense vector of variable lower bounds.
virtual bool isProvenOptimal() const
Is optimality proven?
@ KEEPCACHED_NONE
discard all cached data (default)
@ KEEPCACHED_PROBLEM
only discard cached LP solution
@ FREECACHED_COLUMN
free only cached column and LP solution information
@ KEEPCACHED_ROW
row information: right hand sides, ranges and senses, lower and upper bounds for row
@ FREECACHED_RESULTS
free only cached LP solution information
@ KEEPCACHED_RESULTS
LP solution: primal and dual solution, reduced costs, row activities.
@ KEEPCACHED_ALL
keep all cached data (similar to getMutableLpPtr())
@ FREECACHED_ROW
free only cached row and LP solution information
@ KEEPCACHED_MATRIX
problem matrix: matrix ordered by column and by row
@ FREECACHED_MATRIX
free only cached matrix and LP solution information
@ KEEPCACHED_COLUMN
column information: objective values, lower and upper bounds, variable types
virtual double getInfinity() const
Get solver's value for infinity.
virtual void markHotStart()
Create a hotstart point of the optimization process.
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.
void fillColBounds() const
Fill cached collumn bounds.
virtual bool isTimeLimitReached() const
Time limit reached?
void gutsOfCopy(const OsiGlpkSolverInterface &source)
The real work of a copy constructor (used by copy and assignment)
double dualObjectiveLimit_
dual objective limit (measure of badness; stop if we're worse)
CoinWarmStart * getEmptyWarmStart() const
Get an empty warm start object.
bool isFeasible_
glpk declared the problem feasible
virtual int getNumRows() const
Get number of rows.
virtual void setObjSense(double s)
Set objective function sense (1 for min (default), -1 for max,)
LPX * getModelPtr()
Get pointer to GLPK model.
char * ctype_
Pointer to dense vector of variable types (continous, binary, integer)
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...
virtual void addRow(const CoinPackedVectorBase &vec, const double rowlb, const double rowub)
Add a row (constraint) to the problem.
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...
double * rhs_
Pointer to dense vector of row right-hand side values.
double * colsol_
Pointer to primal solution vector.
virtual const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of matrix.
bool setIntParam(OsiIntParam key, int value)
Set an integer parameter.
double * hotStartCDualVal_
dual variable values
virtual void setContinuous(int index)
Set the index-th variable to be a continuous variable.
double dualTolerance_
dual feasibility tolerance
virtual void loadProblem(const int numcols, const int numrows, const CoinBigIndex *start, const int *index, const double *value, const double *collb, const double *colub, const double *obj, const char *rowsen, const double *rowrhs, const double *rowrng)
Just like the other loadProblem() methods except that the matrix is given in a standard column major ...
double primalObjectiveLimit_
primal objective limit (measure of goodness; stop if we're better)
virtual void setColLower(int elementIndex, double elementValue)
Set a single column lower bound Use -COIN_DBL_MAX for -infinity.
void freeCachedColRim()
free cached column rim vectors
int iter_used_
Number of iterations.
double * rowact_
Pointer to row activity (slack) vector.
virtual void setRowUpper(int elementIndex, double elementValue)
Set a single row upper bound Use COIN_DBL_MAX for infinity.
bool isObjUpperLimitReached_
glpk stopped on upper objective limit
virtual double getObjSense() const
Get objective function sense (1 for min (default), -1 for max)
virtual int getIterationCount() const
Get how many iterations it took to solve the problem (whatever "iteration" mean to the solver.
virtual void deleteRows(const int num, const int *rowIndices)
Delete a set of rows (constraints) from the problem.
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...
void freeCachedMatrix()
free cached matrices
Row Cut Class.
Definition OsiRowCut.hpp:29
Internal class for obtaining status from the applyCuts method.
Abstract Base Class for describing an interface to a solver.
virtual void addCol(const CoinPackedVectorBase &vec, const double collb, const double colub, const double obj)=0
Add a column (primal variable) to the problem.
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...
virtual void addRow(const CoinPackedVectorBase &vec, const double rowlb, const double rowub)=0
Add a row (constraint) to the problem.
virtual bool isFreeBinary(int colIndex) const
Return true if the variable is binary and not fixed.
virtual bool isIntegerNonBinary(int colIndex) const
Return true if the variable is general integer.
virtual void addRows(const int numrows, const CoinPackedVectorBase *const *rows, const double *rowlb, const double *rowub)
Add a set of rows (constraints) to the problem.
virtual ApplyCutsReturnCode applyCuts(const OsiCuts &cs, double effectivenessLb=0.0)
Apply a collection of cuts.
virtual bool isBinary(int colIndex) const
Return true if the variable is binary.
virtual void setColLower(int elementIndex, double elementValue)=0
Set a single column lower bound.
virtual void setColUpper(int elementIndex, double elementValue)=0
Set a single column upper bound.
virtual void addCols(const int numcols, const CoinPackedVectorBase *const *cols, const double *collb, const double *colub, const double *obj)
Add a set of columns (primal variables) to the problem.
virtual int readMps(const char *filename, const char *extension="mps")
Read a problem in MPS format from the given filename.
virtual bool isInteger(int colIndex) const
Return true if the variable is integer.