1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/lemon/lp_glpk.h Mon May 23 04:48:14 2005 +0000
1.3 @@ -0,0 +1,114 @@
1.4 +/* -*- C++ -*-
1.5 + * lemon/lp_glpk.h - Part of LEMON, a generic C++ optimization library
1.6 + *
1.7 + * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
1.8 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
1.9 + *
1.10 + * Permission to use, modify and distribute this software is granted
1.11 + * provided that this copyright notice appears in all copies. For
1.12 + * precise terms see the accompanying LICENSE file.
1.13 + *
1.14 + * This software is provided "AS IS" with no warranty of any kind,
1.15 + * express or implied, and with no claim as to its suitability for any
1.16 + * purpose.
1.17 + *
1.18 + */
1.19 +
1.20 +#ifndef LEMON_LP_GLPK_H
1.21 +#define LEMON_LP_GLPK_H
1.22 +
1.23 +///\file
1.24 +///\brief Header of the LEMON-GLPK lp solver interface.
1.25 +///\ingroup gen_opt_group
1.26 +
1.27 +#include <lemon/lp_base.h>
1.28 +extern "C" {
1.29 +#include <glpk.h>
1.30 +}
1.31 +
1.32 +namespace lemon {
1.33 +
1.34 +
1.35 + /// \brief Interface for the GLPK LP solver
1.36 + ///
1.37 + /// This class implements an interface for the GLPK LP solver.
1.38 + ///\ingroup gen_opt_group
1.39 + class LpGlpk : public LpSolverBase {
1.40 + protected:
1.41 + LPX* lp;
1.42 +
1.43 + public:
1.44 +
1.45 + typedef LpSolverBase Parent;
1.46 +
1.47 + LpGlpk();
1.48 + ~LpGlpk();
1.49 +
1.50 + protected:
1.51 + virtual LpSolverBase &_newLp();
1.52 + virtual LpSolverBase &_copyLp();
1.53 +
1.54 + virtual int _addCol();
1.55 + virtual int _addRow();
1.56 + virtual void _eraseCol(int i);
1.57 + virtual void _eraseRow(int i);
1.58 +
1.59 + virtual void _setRowCoeffs(int i,
1.60 + int length,
1.61 + const int * indices,
1.62 + const Value * values );
1.63 + virtual void _setColCoeffs(int i,
1.64 + int length,
1.65 + const int * indices,
1.66 + const Value * values);
1.67 + virtual void _setCoeff(int row, int col, Value value);
1.68 + virtual void _setColLowerBound(int i, Value value);
1.69 + virtual void _setColUpperBound(int i, Value value);
1.70 +// virtual void _setRowLowerBound(int i, Value value);
1.71 +// virtual void _setRowUpperBound(int i, Value value);
1.72 + virtual void _setRowBounds(int i, Value lower, Value upper);
1.73 + virtual void _setObjCoeff(int i, Value obj_coef);
1.74 + virtual void _clearObj();
1.75 +// virtual void _setObj(int length,
1.76 +// int const * indices,
1.77 +// Value const * values ) = 0;
1.78 +
1.79 + ///\e
1.80 +
1.81 + ///\todo It should be clarified
1.82 + ///
1.83 + virtual SolveExitStatus _solve();
1.84 + virtual Value _getPrimal(int i);
1.85 + virtual Value _getPrimalValue();
1.86 + ///\e
1.87 +
1.88 + ///\todo It should be clarified
1.89 + ///
1.90 + virtual SolutionStatus _getPrimalStatus();
1.91 + virtual void _setMax();
1.92 + virtual void _setMin();
1.93 +
1.94 + public:
1.95 + ///Set the verbosity of the messages
1.96 +
1.97 + ///Set the verbosity of the messages
1.98 + ///
1.99 + ///\param m is the level of the messages output by the solver routines.
1.100 + ///The possible values are:
1.101 + ///- 0 --- no output (default value)
1.102 + ///- 1 --- error messages only
1.103 + ///- 2 --- normal output
1.104 + ///- 3 --- full output (includes informational messages)
1.105 + void messageLevel(int m);
1.106 + ///Turns on or off the presolver
1.107 +
1.108 + ///Turns on (\c b is \c true) or off (\c b is \c false) the presolver
1.109 + ///
1.110 + ///The presolver is off by default.
1.111 + void presolver(bool b);
1.112 +
1.113 + };
1.114 +} //END OF NAMESPACE LEMON
1.115 +
1.116 +#endif //LEMON_LP_GLPK_H
1.117 +