athos@1261: /* -*- C++ -*- athos@1261: * alpar@1956: * This file is a part of LEMON, a generic C++ optimization library alpar@1956: * alpar@2391: * Copyright (C) 2003-2007 alpar@1956: * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport alpar@1359: * (Egervary Research Group on Combinatorial Optimization, EGRES). athos@1261: * athos@1261: * Permission to use, modify and distribute this software is granted athos@1261: * provided that this copyright notice appears in all copies. For athos@1261: * precise terms see the accompanying LICENSE file. athos@1261: * athos@1261: * This software is provided "AS IS" with no warranty of any kind, athos@1261: * express or implied, and with no claim as to its suitability for any athos@1261: * purpose. athos@1261: * athos@1261: */ athos@1261: athos@1261: #ifndef LEMON_LP_GLPK_H athos@1261: #define LEMON_LP_GLPK_H athos@1261: athos@1261: ///\file athos@1261: ///\brief Header of the LEMON-GLPK lp solver interface. deba@2370: ///\ingroup lp_group athos@1261: ladanyi@1356: #include athos@1261: extern "C" { alpar@1326: #include athos@1261: } athos@1261: athos@1261: namespace lemon { athos@1261: athos@1261: alpar@1398: /// \brief Interface for the GLPK LP solver athos@1261: /// alpar@1398: /// This class implements an interface for the GLPK LP solver. deba@2370: ///\ingroup lp_group athos@2144: class LpGlpk : virtual public LpSolverBase { alpar@1321: protected: alpar@1321: LPX* lp; alpar@1321: athos@1261: public: alpar@1321: athos@1261: typedef LpSolverBase Parent; athos@1261: alpar@1321: LpGlpk(); alpar@2321: LpGlpk(const LpGlpk &); alpar@1321: ~LpGlpk(); alpar@1321: athos@1261: protected: alpar@1364: virtual LpSolverBase &_newLp(); alpar@1364: virtual LpSolverBase &_copyLp(); alpar@1364: athos@1261: virtual int _addCol(); athos@1261: virtual int _addRow(); athos@1432: virtual void _eraseCol(int i); athos@1432: virtual void _eraseRow(int i); deba@2366: virtual void _getColName(int col, std::string & name) const; alpar@1895: virtual void _setColName(int col, const std::string & name); deba@2366: virtual int _colByName(const std::string& name) const; deba@2364: virtual void _setRowCoeffs(int i, ConstRowIterator b, ConstRowIterator e); deba@2366: virtual void _getRowCoeffs(int i, RowIterator b) const; deba@2364: virtual void _setColCoeffs(int i, ConstColIterator b, ConstColIterator e); deba@2366: virtual void _getColCoeffs(int i, ColIterator b) const; athos@1431: virtual void _setCoeff(int row, int col, Value value); deba@2366: virtual Value _getCoeff(int row, int col) const; athos@2324: athos@1261: virtual void _setColLowerBound(int i, Value value); deba@2366: virtual Value _getColLowerBound(int i) const; athos@1261: virtual void _setColUpperBound(int i, Value value); deba@2366: virtual Value _getColUpperBound(int i) const; athos@2328: athos@1379: virtual void _setRowBounds(int i, Value lower, Value upper); deba@2366: virtual void _getRowBounds(int i, Value &lb, Value &ub) const; athos@1261: virtual void _setObjCoeff(int i, Value obj_coef); deba@2366: virtual Value _getObjCoeff(int i) const; athos@1377: virtual void _clearObj(); athos@1376: alpar@1263: ///\e alpar@1263: alpar@1321: ///\todo It should be clarified alpar@1263: /// alpar@1303: virtual SolveExitStatus _solve(); deba@2366: virtual Value _getPrimal(int i) const; deba@2366: virtual Value _getDual(int i) const; deba@2366: virtual Value _getPrimalValue() const; deba@2366: virtual bool _isBasicCol(int i) const; alpar@1312: ///\e alpar@1312: alpar@1321: ///\todo It should be clarified alpar@1312: /// deba@2366: virtual SolutionStatus _getPrimalStatus() const; deba@2366: virtual SolutionStatus _getDualStatus() const; deba@2366: virtual ProblemTypes _getProblemType() const; athos@1460: alpar@1321: virtual void _setMax(); alpar@1321: virtual void _setMin(); athos@1261: deba@2366: virtual bool _isMax() const; athos@2324: alpar@1321: public: alpar@1321: ///Set the verbosity of the messages alpar@1321: alpar@1326: ///Set the verbosity of the messages alpar@1326: /// alpar@1321: ///\param m is the level of the messages output by the solver routines. alpar@1321: ///The possible values are: alpar@1321: ///- 0 --- no output (default value) alpar@1321: ///- 1 --- error messages only alpar@1321: ///- 2 --- normal output alpar@1321: ///- 3 --- full output (includes informational messages) alpar@1321: void messageLevel(int m); alpar@1326: ///Turns on or off the presolver alpar@1326: alpar@1326: ///Turns on (\c b is \c true) or off (\c b is \c false) the presolver alpar@1326: /// alpar@1326: ///The presolver is off by default. alpar@1326: void presolver(bool b); alpar@2321: alpar@2321: LPX *lpx() {return lp;} athos@1261: }; athos@1261: } //END OF NAMESPACE LEMON athos@1261: athos@1261: #endif //LEMON_LP_GLPK_H athos@1261: