1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/work/athos/lp/lp_glpk.h Fri Mar 25 15:24:18 2005 +0000
1.3 @@ -0,0 +1,74 @@
1.4 +/* -*- C++ -*-
1.5 + * src/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 Combinatorial Optimization Research Group, 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 +
1.26 +#include "lp_base.h"
1.27 +extern "C" {
1.28 +#include "glpk.h"
1.29 +}
1.30 +
1.31 +namespace lemon {
1.32 +
1.33 +
1.34 + /// \brief Wrapper for GLPK solver
1.35 + ///
1.36 + /// This class implements a lemon wrapper for GLPK.
1.37 + class LpGlpk : public LpSolverBase {
1.38 +
1.39 + public:
1.40 +
1.41 + typedef LpSolverBase Parent;
1.42 +
1.43 + /// \e
1.44 + LPX* lp;
1.45 +
1.46 + /// \e
1.47 + LpGlpk() : Parent(),
1.48 + lp(lpx_create_prob()) {
1.49 + lpx_set_int_parm(lp, LPX_K_DUAL, 1);
1.50 + }
1.51 + /// \e
1.52 + ~LpGlpk() {
1.53 + lpx_delete_prob(lp);
1.54 + }
1.55 +
1.56 + protected:
1.57 + virtual int _addCol();
1.58 + virtual int _addRow();
1.59 + virtual void _setRowCoeffs(int i,
1.60 + int length,
1.61 + int * indices,
1.62 + Value * values );
1.63 + virtual void _setColCoeffs(int i,
1.64 + int length,
1.65 + int * indices,
1.66 + Value * values);
1.67 + virtual void _setColLowerBound(int i, Value value);
1.68 + virtual void _setColUpperBound(int i, Value value);
1.69 + virtual void _setRowLowerBound(int i, Value value);
1.70 + virtual void _setRowUpperBound(int i, Value value);
1.71 + virtual void _setObjCoeff(int i, Value obj_coef);
1.72 +
1.73 + };
1.74 +} //END OF NAMESPACE LEMON
1.75 +
1.76 +#endif //LEMON_LP_GLPK_H
1.77 +