athos@1261: /* -*- C++ -*-
ladanyi@1435:  * lemon/lp_glpk.h - Part of LEMON, a generic C++ optimization library
athos@1261:  *
athos@1261:  * Copyright (C) 2005 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 <lemon/lp_base.h>
athos@1261: extern "C" {
alpar@1326: #include <glpk.h>
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@1261:   class LpGlpk : 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@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);
athos@1432: 
athos@1261:     virtual void _setRowCoeffs(int i, 
athos@1261: 			       int length,
alpar@1263:                                const int   * indices, 
alpar@1263:                                const Value   * values );
athos@1261:     virtual void _setColCoeffs(int i, 
athos@1261: 			       int length,
alpar@1263:                                const int   * indices, 
alpar@1263:                                const Value   * values);
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);
alpar@1312:     virtual Value _getPrimalValue();
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@1312:     
athos@1261:   };
athos@1261: } //END OF NAMESPACE LEMON
athos@1261: 
athos@1261: #endif //LEMON_LP_GLPK_H
athos@1261: