athos@1261: /* -*- C++ -*- athos@1261: * src/lemon/lp_glpk.h - Part of LEMON, a generic C++ optimization library athos@1261: * athos@1261: * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport athos@1261: * (Egervary Combinatorial Optimization Research Group, 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. athos@1261: athos@1261: #include "lp_base.h" athos@1261: extern "C" { athos@1261: #include "glpk.h" athos@1261: } athos@1261: athos@1261: namespace lemon { athos@1261: athos@1261: athos@1261: /// \brief Wrapper for GLPK solver athos@1261: /// athos@1261: /// This class implements a lemon wrapper for GLPK. athos@1261: class LpGlpk : public LpSolverBase { athos@1261: athos@1261: public: athos@1261: athos@1261: typedef LpSolverBase Parent; athos@1261: athos@1261: /// \e athos@1261: LPX* lp; athos@1261: athos@1261: /// \e athos@1261: LpGlpk() : Parent(), athos@1261: lp(lpx_create_prob()) { athos@1261: lpx_set_int_parm(lp, LPX_K_DUAL, 1); athos@1261: } athos@1261: /// \e athos@1261: ~LpGlpk() { athos@1261: lpx_delete_prob(lp); athos@1261: } athos@1261: athos@1261: protected: athos@1261: virtual int _addCol(); athos@1261: virtual int _addRow(); athos@1261: virtual void _setRowCoeffs(int i, athos@1261: int length, athos@1261: int * indices, athos@1261: Value * values ); athos@1261: virtual void _setColCoeffs(int i, athos@1261: int length, athos@1261: int * indices, athos@1261: Value * values); athos@1261: virtual void _setColLowerBound(int i, Value value); athos@1261: virtual void _setColUpperBound(int i, Value value); athos@1261: virtual void _setRowLowerBound(int i, Value value); athos@1261: virtual void _setRowUpperBound(int i, Value value); athos@1261: virtual void _setObjCoeff(int i, Value obj_coef); athos@1261: athos@1261: }; athos@1261: } //END OF NAMESPACE LEMON athos@1261: athos@1261: #endif //LEMON_LP_GLPK_H athos@1261: