src/work/athos/lp/lp_glpk.h
author alpar
Tue, 05 Apr 2005 06:41:21 +0000
changeset 1303 9bcc455da4f5
parent 1294 2dec219d9ca2
permissions -rw-r--r--
SolutionStatus -> SolveExitStatus
SolutionType -> SolutionStatus
athos@1261
     1
/* -*- C++ -*-
athos@1261
     2
 * src/lemon/lp_glpk.h - Part of LEMON, a generic C++ optimization library
athos@1261
     3
 *
athos@1261
     4
 * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
athos@1261
     5
 * (Egervary Combinatorial Optimization Research Group, EGRES).
athos@1261
     6
 *
athos@1261
     7
 * Permission to use, modify and distribute this software is granted
athos@1261
     8
 * provided that this copyright notice appears in all copies. For
athos@1261
     9
 * precise terms see the accompanying LICENSE file.
athos@1261
    10
 *
athos@1261
    11
 * This software is provided "AS IS" with no warranty of any kind,
athos@1261
    12
 * express or implied, and with no claim as to its suitability for any
athos@1261
    13
 * purpose.
athos@1261
    14
 *
athos@1261
    15
 */
athos@1261
    16
athos@1261
    17
#ifndef LEMON_LP_GLPK_H
athos@1261
    18
#define LEMON_LP_GLPK_H
athos@1261
    19
athos@1261
    20
///\file
athos@1261
    21
///\brief Header of the LEMON-GLPK lp solver interface.
athos@1261
    22
athos@1261
    23
#include "lp_base.h"
athos@1261
    24
extern "C" {
athos@1261
    25
#include "glpk.h"
athos@1261
    26
}
athos@1261
    27
athos@1261
    28
namespace lemon {
athos@1261
    29
athos@1261
    30
athos@1261
    31
  /// \brief Wrapper for GLPK solver
athos@1261
    32
  /// 
athos@1261
    33
  /// This class implements a lemon wrapper for GLPK.
athos@1261
    34
  class LpGlpk : public LpSolverBase {
athos@1261
    35
athos@1261
    36
  public:
athos@1261
    37
athos@1261
    38
    typedef LpSolverBase Parent;
athos@1261
    39
    
athos@1261
    40
    /// \e
athos@1261
    41
    LPX* lp;
athos@1261
    42
athos@1261
    43
    /// \e
athos@1261
    44
    LpGlpk() : Parent(), 
athos@1261
    45
			lp(lpx_create_prob()) {
athos@1261
    46
      lpx_set_int_parm(lp, LPX_K_DUAL, 1);
athos@1261
    47
    }
athos@1261
    48
    /// \e
athos@1261
    49
    ~LpGlpk() {
athos@1261
    50
      lpx_delete_prob(lp);
athos@1261
    51
    }
athos@1261
    52
athos@1261
    53
  protected:
athos@1261
    54
    virtual int _addCol();
athos@1261
    55
    virtual int _addRow();
athos@1261
    56
    virtual void _setRowCoeffs(int i, 
athos@1261
    57
			       int length,
alpar@1263
    58
                               const int   * indices, 
alpar@1263
    59
                               const Value   * values );
athos@1261
    60
    virtual void _setColCoeffs(int i, 
athos@1261
    61
			       int length,
alpar@1263
    62
                               const int   * indices, 
alpar@1263
    63
                               const Value   * values);
athos@1261
    64
    virtual void _setColLowerBound(int i, Value value);
athos@1261
    65
    virtual void _setColUpperBound(int i, Value value);
athos@1261
    66
    virtual void _setRowLowerBound(int i, Value value);
athos@1261
    67
    virtual void _setRowUpperBound(int i, Value value);
athos@1261
    68
    virtual void _setObjCoeff(int i, Value obj_coef);
alpar@1263
    69
    ///\e
alpar@1263
    70
    
alpar@1263
    71
    ///\bug Unimplemented
alpar@1263
    72
    ///
alpar@1303
    73
    virtual SolveExitStatus _solve();
alpar@1263
    74
    ///\e
alpar@1263
    75
    
alpar@1263
    76
    ///\bug Unimplemented
alpar@1263
    77
    ///
alpar@1293
    78
    virtual Value _getPrimal(int i);
alpar@1294
    79
    ///\e
alpar@1294
    80
    
alpar@1294
    81
    ///\bug Unimplemented
alpar@1294
    82
    ///
alpar@1303
    83
    virtual SolutionStatus _getPrimalType();
athos@1261
    84
athos@1261
    85
  };
athos@1261
    86
} //END OF NAMESPACE LEMON
athos@1261
    87
athos@1261
    88
#endif //LEMON_LP_GLPK_H
athos@1261
    89