athos@1261: /* -*- C++ -*- athos@1261: * alpar@1956: * This file is a part of LEMON, a generic C++ optimization library alpar@1956: * alpar@1956: * Copyright (C) 2003-2006 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. alpar@1328: ///\ingroup gen_opt_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. alpar@1328: ///\ingroup gen_opt_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); alpar@1895: virtual void _getColName(int col, std::string & name); alpar@1895: virtual void _setColName(int col, const std::string & name); deba@2312: virtual void _setRowCoeffs(int i, LpRowIterator b, LpRowIterator e); deba@2312: virtual void _setColCoeffs(int i, LpColIterator b, LpColIterator e); athos@1431: virtual void _setCoeff(int row, int col, Value value); athos@1261: virtual void _setColLowerBound(int i, Value value); athos@1261: virtual void _setColUpperBound(int i, Value value); athos@1405: // virtual void _setRowLowerBound(int i, Value value); athos@1405: // virtual void _setRowUpperBound(int i, Value value); athos@1379: virtual void _setRowBounds(int i, Value lower, Value upper); athos@1261: virtual void _setObjCoeff(int i, Value obj_coef); athos@1377: virtual void _clearObj(); athos@1377: // virtual void _setObj(int length, athos@1377: // int const * indices, athos@1377: // Value const * values ) = 0; athos@1376: alpar@1263: ///\e alpar@1263: alpar@1321: ///\todo It should be clarified alpar@1263: /// alpar@1303: virtual SolveExitStatus _solve(); alpar@1293: virtual Value _getPrimal(int i); marci@1787: virtual Value _getDual(int i); alpar@1312: virtual Value _getPrimalValue(); marci@1840: virtual bool _isBasicCol(int i); alpar@1312: ///\e alpar@1312: alpar@1321: ///\todo It should be clarified alpar@1312: /// alpar@1312: virtual SolutionStatus _getPrimalStatus(); athos@1460: virtual SolutionStatus _getDualStatus(); athos@1460: virtual ProblemTypes _getProblemType(); athos@1460: alpar@1321: virtual void _setMax(); alpar@1321: virtual void _setMin(); athos@1261: 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: