src/work/athos/lp/lp_glpk.h
changeset 1262 61f989e3e525
child 1263 a490938ad0aa
equal deleted inserted replaced
-1:000000000000 0:f3cbca0c0725
       
     1 /* -*- C++ -*-
       
     2  * src/lemon/lp_glpk.h - Part of LEMON, a generic C++ optimization library
       
     3  *
       
     4  * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
       
     5  * (Egervary Combinatorial Optimization Research Group, EGRES).
       
     6  *
       
     7  * Permission to use, modify and distribute this software is granted
       
     8  * provided that this copyright notice appears in all copies. For
       
     9  * precise terms see the accompanying LICENSE file.
       
    10  *
       
    11  * This software is provided "AS IS" with no warranty of any kind,
       
    12  * express or implied, and with no claim as to its suitability for any
       
    13  * purpose.
       
    14  *
       
    15  */
       
    16 
       
    17 #ifndef LEMON_LP_GLPK_H
       
    18 #define LEMON_LP_GLPK_H
       
    19 
       
    20 ///\file
       
    21 ///\brief Header of the LEMON-GLPK lp solver interface.
       
    22 
       
    23 #include "lp_base.h"
       
    24 extern "C" {
       
    25 #include "glpk.h"
       
    26 }
       
    27 
       
    28 namespace lemon {
       
    29 
       
    30 
       
    31   /// \brief Wrapper for GLPK solver
       
    32   /// 
       
    33   /// This class implements a lemon wrapper for GLPK.
       
    34   class LpGlpk : public LpSolverBase {
       
    35 
       
    36   public:
       
    37 
       
    38     typedef LpSolverBase Parent;
       
    39     
       
    40     /// \e
       
    41     LPX* lp;
       
    42 
       
    43     /// \e
       
    44     LpGlpk() : Parent(), 
       
    45 			lp(lpx_create_prob()) {
       
    46       lpx_set_int_parm(lp, LPX_K_DUAL, 1);
       
    47     }
       
    48     /// \e
       
    49     ~LpGlpk() {
       
    50       lpx_delete_prob(lp);
       
    51     }
       
    52 
       
    53   protected:
       
    54     virtual int _addCol();
       
    55     virtual int _addRow();
       
    56     virtual void _setRowCoeffs(int i, 
       
    57 			       int length,
       
    58                                int   * indices, 
       
    59                                Value   * values );
       
    60     virtual void _setColCoeffs(int i, 
       
    61 			       int length,
       
    62                                int   * indices, 
       
    63                                Value   * values);
       
    64     virtual void _setColLowerBound(int i, Value value);
       
    65     virtual void _setColUpperBound(int i, Value value);
       
    66     virtual void _setRowLowerBound(int i, Value value);
       
    67     virtual void _setRowUpperBound(int i, Value value);
       
    68     virtual void _setObjCoeff(int i, Value obj_coef);
       
    69 
       
    70   };
       
    71 } //END OF NAMESPACE LEMON
       
    72 
       
    73 #endif //LEMON_LP_GLPK_H
       
    74