src/lemon/lp_glpk.h
author ladanyi
Tue, 05 Apr 2005 22:37:19 +0000
changeset 1308 0274efa2222f
parent 1303 9bcc455da4f5
child 1312 48f9299b390d
permissions -rw-r--r--
Applied the changes which somehow vanished during my last merge. Thanks goes
to Marci for noticing this. In detail:
- added amsmath and amssymb latex packages for latex documentation
- src/demo is also scanned for doxygen input files
     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 SolutionStatus _getPrimalType();
    84 
    85   };
    86 } //END OF NAMESPACE LEMON
    87 
    88 #endif //LEMON_LP_GLPK_H
    89