24 #ifndef __MINLCA_LEMON_GRB_H
25 #define __MINLCA_LEMON_GRB_H
30 #include <lemon/lp_base.h>
31 #include "gurobi_c++.h"
96 std::vector<bool> _exprCopiedToConstr;
110 GrbBase(
const GRBEnv &env = _defEnv);
112 inline void _updateModel(
bool what);
114 inline void _copyExprToConstr(
int row);
116 inline void _copyExprToConstr();
125 virtual int _addRow(Value l, ExprIterator b, ExprIterator e, Value u);
134 virtual void _getColName(
int col, std::string &name)
const;
137 virtual void _setColName(
int col,
const std::string &name);
140 virtual int _colByName(
const std::string &name)
const;
143 virtual void _getRowName(
int row, std::string &name)
const;
146 virtual void _setRowName(
int row,
const std::string &name);
149 virtual int _rowByName(
const std::string &name)
const;
152 virtual void _setRowCoeffs(
int row, ExprIterator b, ExprIterator e);
158 virtual void _setColCoeffs(
int col, ExprIterator b, ExprIterator e);
164 virtual void _setCoeff(
int row,
int col, Value value);
167 virtual Value
_getCoeff(
int row,
int col)
const;
238 virtual void _write(std::string file, std::string format)
const;
264 virtual SolveExitStatus
_solve();
270 virtual Value
_getDual(
int i)
const;
327 virtual SolveExitStatus
_solve();
330 virtual Value
_getSol(
int i)
const;
336 virtual ProblemType
_getType()
const;
338 virtual ColTypes _getColType(
int col)
const;
340 virtual void _setColType(
int col, ColTypes col_type);
std::map< std::string, int > _constrNameToId
Map constraint names to id.
std::vector< GRBVar > _constrAux
Needed because LEMON allows constraints with both upper and lower bounds.
Base interface for the Gurobi LP and MIP solver.
bool _dirtyVars
Dirty bit for variables.
virtual void _setRowLowerBound(int i, Value value)
static GRBEnv _defEnv
Default Gurobi environment.
virtual Value _getRowUpperBound(int i) const
virtual GrbLp * cloneSolver() const
virtual const char * _solverName() const
virtual void _setColLowerBound(int i, Value value)
static GRBEnv getDefaultEnv()
Get default Gurobi environment.
virtual SolveExitStatus _solve()
virtual SolveExitStatus _solve()
virtual ProblemType _getType() const
virtual Value _getPrimalRay(int i) const
Interface for the Gurobi LP solver.
std::vector< bool > _deletedConstrs
List of deleted variables.
GRBModel _model
Underlying Gurobi model.
virtual Value _getSolValue() const
void writeCompressed(std::string filename, std::string format="")
Output model in compressed format.
std::vector< std::string > _idToVarName
Map variable id to names.
std::vector< GRBConstr > _idToConstr
Map id to constraints.
virtual int _rowByName(const std::string &name) const
virtual Value _getDual(int i) const
std::map< std::string, int > _varNameToId
Map variable names to id.
virtual void _getRowName(int row, std::string &name) const
virtual void _eraseCol(int i)
virtual void _setColCoeffs(int col, ExprIterator b, ExprIterator e)
virtual void _setObjCoeffs(ExprIterator b, ExprIterator e)
virtual void _write(std::string file, std::string format) const
Write model to file (disabled)
bool _dirtyConstrs
Dirty bit for constraints.
virtual int _colByName(const std::string &name) const
virtual ProblemType _getPrimalType() const
virtual void _getObjCoeffs(InsertIterator b) const
virtual Value _getSol(int i) const
virtual void _setColName(int col, const std::string &name)
virtual void _setRowCoeffs(int row, ExprIterator b, ExprIterator e)
void forceModelUpdate()
Force model update.
virtual Value _getCoeff(int row, int col) const
Get one element of the coefficient matrix.
virtual void _setRowUpperBound(int i, Value value)
virtual Value _getColLowerBound(int i) const
virtual Sense _getSense() const
GRBEnv getEnv() const
Get the environment of the underlying Gurobi model.
virtual GrbLp * newSolver() const
virtual void _setObjCoeff(int i, Value obj_coef)
virtual void _setCoeff(int row, int col, Value value)
Set one element of the coefficient matrix.
std::vector< bool > _deletedVars
List of deleted variables.
virtual GrbMip * newSolver() const
std::vector< GRBVar > _idToVar
Map id to variables.
GrbLp(const GRBEnv &env=_defEnv)
virtual void _setSense(Sense)
virtual Value _getObjCoeff(int i) const
std::vector< GRBLinExpr > _idToExpr
Linear expression of each constraint.
virtual void _getColName(int col, std::string &name) const
virtual void _eraseRow(int i)
virtual Value _getPrimal(int i) const
Interface for the Gurobi MIP solver.
virtual VarStatus _getRowStatus(int i) const
virtual void _messageLevel(MessageLevel)
virtual VarStatus _getColStatus(int i) const
virtual const char * _solverName() const
GRBEnv _env
Gurobi environment for the model.
virtual void _getColCoeffs(int col, InsertIterator b) const
virtual Value _getPrimalValue() const
GrbBase(const GRBEnv &env=_defEnv)
Default constructor.
virtual void _setColUpperBound(int i, Value value)
GRBModel & getModel()
Get the underlying Gurobi model.
std::vector< std::string > _idToConstrName
Map constraint id to names.
void initialMipValue(LpBase::Col col, Value val)
Set initial value.
virtual Value _getRowLowerBound(int i) const
GrbMip(const GRBEnv &env=_defEnv)
virtual Value _getColUpperBound(int i) const
virtual GrbMip * cloneSolver() const
Clone solver. Disabled do not use.
virtual void _setRowName(int row, const std::string &name)
virtual Value _getDualRay(int i) const
virtual void _getRowCoeffs(int row, InsertIterator b) const
virtual ProblemType _getDualType() const