src/lemon/lp_glpk.h
author athos
Thu, 07 Apr 2005 15:22:03 +0000
changeset 1319 6e277ba3fc76
parent 1305 c3dc75d4af24
child 1321 bc3a4c498eb2
permissions -rw-r--r--
Cplex interface has improved a lot.
     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                                const int   * indices, 
    59                                const Value   * values );
    60     virtual void _setColCoeffs(int i, 
    61 			       int length,
    62                                const int   * indices, 
    63                                const 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     ///\e
    70     
    71     ///\bug Unimplemented
    72     ///
    73     virtual SolveExitStatus _solve();
    74     ///\e
    75     
    76     ///\bug Unimplemented
    77     ///
    78     virtual Value _getPrimal(int i);
    79     ///\e
    80     
    81     ///\bug Unimplemented
    82     ///
    83     virtual Value _getPrimalValue();
    84     ///\e
    85     
    86     ///\bug Unimplemented
    87     ///
    88     virtual SolutionStatus _getPrimalStatus();
    89 
    90     ///\e
    91     
    92     ///\bug Unimplemented
    93     ///
    94     virtual void _setMax();
    95     ///\e
    96     
    97     ///\bug Unimplemented
    98     ///
    99     virtual void _setMin();
   100   
   101   };
   102 } //END OF NAMESPACE LEMON
   103 
   104 #endif //LEMON_LP_GLPK_H
   105