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 | ///Set the verbosity of the messages |
---|
80 | /// |
---|
81 | ///\param m is the level of the messages output by the solver routines. |
---|
82 | ///The possible values are: |
---|
83 | ///- 0 --- no output (default value) |
---|
84 | ///- 1 --- error messages only |
---|
85 | ///- 2 --- normal output |
---|
86 | ///- 3 --- full output (includes informational messages) |
---|
87 | void messageLevel(int m); |
---|
88 | ///Turns on or off the presolver |
---|
89 | |
---|
90 | ///Turns on (\c b is \c true) or off (\c b is \c false) the presolver |
---|
91 | /// |
---|
92 | ///The presolver is off by default. |
---|
93 | void presolver(bool b); |
---|
94 | |
---|
95 | }; |
---|
96 | } //END OF NAMESPACE LEMON |
---|
97 | |
---|
98 | #endif //LEMON_LP_GLPK_H |
---|
99 | |
---|