00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef LEMON_LP_GLPK_H
00020 #define LEMON_LP_GLPK_H
00021
00025
00026 #include <lemon/lp_base.h>
00027 extern "C" {
00028 #include <glpk.h>
00029 }
00030
00031 namespace lemon {
00032
00033
00038 class LpGlpk : public LpSolverBase {
00039 protected:
00040 LPX* lp;
00041
00042 public:
00043
00044 typedef LpSolverBase Parent;
00045
00046 LpGlpk();
00047 ~LpGlpk();
00048
00049 protected:
00050 virtual LpSolverBase &_newLp();
00051 virtual LpSolverBase &_copyLp();
00052
00053 virtual int _addCol();
00054 virtual int _addRow();
00055 virtual void _eraseCol(int i);
00056 virtual void _eraseRow(int i);
00057 virtual void _getColName(int col, std::string & name);
00058 virtual void _setColName(int col, const std::string & name);
00059 virtual void _setRowCoeffs(int i,
00060 int length,
00061 const int * indices,
00062 const Value * values );
00063 virtual void _setColCoeffs(int i,
00064 int length,
00065 const int * indices,
00066 const Value * values);
00067 virtual void _setCoeff(int row, int col, Value value);
00068 virtual void _setColLowerBound(int i, Value value);
00069 virtual void _setColUpperBound(int i, Value value);
00070
00071
00072 virtual void _setRowBounds(int i, Value lower, Value upper);
00073 virtual void _setObjCoeff(int i, Value obj_coef);
00074 virtual void _clearObj();
00075
00076
00077
00078
00080
00083 virtual SolveExitStatus _solve();
00084 virtual Value _getPrimal(int i);
00085 virtual Value _getDual(int i);
00086 virtual Value _getPrimalValue();
00087 virtual bool _isBasicCol(int i);
00089
00092 virtual SolutionStatus _getPrimalStatus();
00093 virtual SolutionStatus _getDualStatus();
00094 virtual ProblemTypes _getProblemType();
00095
00096 virtual void _setMax();
00097 virtual void _setMin();
00098
00099 public:
00101
00110 void messageLevel(int m);
00112
00116 void presolver(bool b);
00117
00118 };
00119 }
00120
00121 #endif //LEMON_LP_GLPK_H
00122