src/lemon/lp_glpk.h
changeset 1305 c3dc75d4af24
parent 1303 9bcc455da4f5
child 1312 48f9299b390d
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/lemon/lp_glpk.h	Tue Apr 05 09:08:23 2005 +0000
     1.3 @@ -0,0 +1,89 @@
     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 +                               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 _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 +    ///\e
    1.73 +    
    1.74 +    ///\bug Unimplemented
    1.75 +    ///
    1.76 +    virtual SolveExitStatus _solve();
    1.77 +    ///\e
    1.78 +    
    1.79 +    ///\bug Unimplemented
    1.80 +    ///
    1.81 +    virtual Value _getPrimal(int i);
    1.82 +    ///\e
    1.83 +    
    1.84 +    ///\bug Unimplemented
    1.85 +    ///
    1.86 +    virtual SolutionStatus _getPrimalType();
    1.87 +
    1.88 +  };
    1.89 +} //END OF NAMESPACE LEMON
    1.90 +
    1.91 +#endif //LEMON_LP_GLPK_H
    1.92 +