src/lemon/lp_glpk.h
author alpar
Fri, 08 Apr 2005 06:33:11 +0000
changeset 1321 bc3a4c498eb2
parent 1312 48f9299b390d
child 1326 85f1c483279e
permissions -rw-r--r--
No output messages by default
     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   protected:
    36     LPX* lp;
    37     
    38   public:
    39     
    40     typedef LpSolverBase Parent;
    41     
    42     LpGlpk();
    43     ~LpGlpk();
    44     
    45   protected:
    46     virtual int _addCol();
    47     virtual int _addRow();
    48     virtual void _setRowCoeffs(int i, 
    49 			       int length,
    50                                const int   * indices, 
    51                                const Value   * values );
    52     virtual void _setColCoeffs(int i, 
    53 			       int length,
    54                                const int   * indices, 
    55                                const Value   * values);
    56     virtual void _setColLowerBound(int i, Value value);
    57     virtual void _setColUpperBound(int i, Value value);
    58     virtual void _setRowLowerBound(int i, Value value);
    59     virtual void _setRowUpperBound(int i, Value value);
    60     virtual void _setObjCoeff(int i, Value obj_coef);
    61     ///\e
    62     
    63     ///\todo It should be clarified
    64     ///
    65     virtual SolveExitStatus _solve();
    66     virtual Value _getPrimal(int i);
    67     virtual Value _getPrimalValue();
    68     ///\e
    69     
    70     ///\todo It should be clarified
    71     ///
    72     virtual SolutionStatus _getPrimalStatus();
    73     virtual void _setMax();
    74     virtual void _setMin();
    75 
    76   public:
    77     ///Set the verbosity of the messages
    78 
    79     ///\param m is the level of the messages output by the solver routines.
    80     ///The possible values are:
    81     ///- 0 --- no output (default value)
    82     ///- 1 --- error messages only
    83     ///- 2 --- normal output
    84     ///- 3 --- full output (includes informational messages)
    85     void messageLevel(int m);
    86     
    87   };
    88 } //END OF NAMESPACE LEMON
    89 
    90 #endif //LEMON_LP_GLPK_H
    91