src/work/athos/lp/lp_glpk.h
author alpar
Thu, 31 Mar 2005 14:04:13 +0000
changeset 1284 b941d044f87b
parent 1261 9d0deeea8c08
child 1293 8ede2a6b2594
permissions -rw-r--r--
SmartGraph can also split() a node!
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@1263
    73
    virtual SolutionType _solve();
alpar@1263
    74
    ///\e
alpar@1263
    75
    
alpar@1263
    76
    ///\bug Unimplemented
alpar@1263
    77
    ///
alpar@1263
    78
    virtual Value _getSolution(int i);
athos@1261
    79
athos@1261
    80
  };
athos@1261
    81
} //END OF NAMESPACE LEMON
athos@1261
    82
athos@1261
    83
#endif //LEMON_LP_GLPK_H
athos@1261
    84