[1261] | 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 { |
---|
[1321] | 35 | protected: |
---|
| 36 | LPX* lp; |
---|
| 37 | |
---|
[1261] | 38 | public: |
---|
[1321] | 39 | |
---|
[1261] | 40 | typedef LpSolverBase Parent; |
---|
| 41 | |
---|
[1321] | 42 | LpGlpk(); |
---|
| 43 | ~LpGlpk(); |
---|
| 44 | |
---|
[1261] | 45 | protected: |
---|
| 46 | virtual int _addCol(); |
---|
| 47 | virtual int _addRow(); |
---|
| 48 | virtual void _setRowCoeffs(int i, |
---|
| 49 | int length, |
---|
[1263] | 50 | const int * indices, |
---|
| 51 | const Value * values ); |
---|
[1261] | 52 | virtual void _setColCoeffs(int i, |
---|
| 53 | int length, |
---|
[1263] | 54 | const int * indices, |
---|
| 55 | const Value * values); |
---|
[1261] | 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); |
---|
[1263] | 61 | ///\e |
---|
| 62 | |
---|
[1321] | 63 | ///\todo It should be clarified |
---|
[1263] | 64 | /// |
---|
[1303] | 65 | virtual SolveExitStatus _solve(); |
---|
[1293] | 66 | virtual Value _getPrimal(int i); |
---|
[1312] | 67 | virtual Value _getPrimalValue(); |
---|
| 68 | ///\e |
---|
| 69 | |
---|
[1321] | 70 | ///\todo It should be clarified |
---|
[1312] | 71 | /// |
---|
| 72 | virtual SolutionStatus _getPrimalStatus(); |
---|
[1321] | 73 | virtual void _setMax(); |
---|
| 74 | virtual void _setMin(); |
---|
[1261] | 75 | |
---|
[1321] | 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); |
---|
[1312] | 86 | |
---|
[1261] | 87 | }; |
---|
| 88 | } //END OF NAMESPACE LEMON |
---|
| 89 | |
---|
| 90 | #endif //LEMON_LP_GLPK_H |
---|
| 91 | |
---|