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 SolutionType _solve(); |
---|
74 | ///\e |
---|
75 | |
---|
76 | ///\bug Unimplemented |
---|
77 | /// |
---|
78 | virtual Value _getSolution(int i); |
---|
79 | |
---|
80 | }; |
---|
81 | } //END OF NAMESPACE LEMON |
---|
82 | |
---|
83 | #endif //LEMON_LP_GLPK_H |
---|
84 | |
---|