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 {
|
alpar@1321
|
35 |
protected:
|
alpar@1321
|
36 |
LPX* lp;
|
alpar@1321
|
37 |
|
athos@1261
|
38 |
public:
|
alpar@1321
|
39 |
|
athos@1261
|
40 |
typedef LpSolverBase Parent;
|
athos@1261
|
41 |
|
alpar@1321
|
42 |
LpGlpk();
|
alpar@1321
|
43 |
~LpGlpk();
|
alpar@1321
|
44 |
|
athos@1261
|
45 |
protected:
|
athos@1261
|
46 |
virtual int _addCol();
|
athos@1261
|
47 |
virtual int _addRow();
|
athos@1261
|
48 |
virtual void _setRowCoeffs(int i,
|
athos@1261
|
49 |
int length,
|
alpar@1263
|
50 |
const int * indices,
|
alpar@1263
|
51 |
const Value * values );
|
athos@1261
|
52 |
virtual void _setColCoeffs(int i,
|
athos@1261
|
53 |
int length,
|
alpar@1263
|
54 |
const int * indices,
|
alpar@1263
|
55 |
const Value * values);
|
athos@1261
|
56 |
virtual void _setColLowerBound(int i, Value value);
|
athos@1261
|
57 |
virtual void _setColUpperBound(int i, Value value);
|
athos@1261
|
58 |
virtual void _setRowLowerBound(int i, Value value);
|
athos@1261
|
59 |
virtual void _setRowUpperBound(int i, Value value);
|
athos@1261
|
60 |
virtual void _setObjCoeff(int i, Value obj_coef);
|
alpar@1263
|
61 |
///\e
|
alpar@1263
|
62 |
|
alpar@1321
|
63 |
///\todo It should be clarified
|
alpar@1263
|
64 |
///
|
alpar@1303
|
65 |
virtual SolveExitStatus _solve();
|
alpar@1293
|
66 |
virtual Value _getPrimal(int i);
|
alpar@1312
|
67 |
virtual Value _getPrimalValue();
|
alpar@1312
|
68 |
///\e
|
alpar@1312
|
69 |
|
alpar@1321
|
70 |
///\todo It should be clarified
|
alpar@1312
|
71 |
///
|
alpar@1312
|
72 |
virtual SolutionStatus _getPrimalStatus();
|
alpar@1321
|
73 |
virtual void _setMax();
|
alpar@1321
|
74 |
virtual void _setMin();
|
athos@1261
|
75 |
|
alpar@1321
|
76 |
public:
|
alpar@1321
|
77 |
///Set the verbosity of the messages
|
alpar@1321
|
78 |
|
alpar@1321
|
79 |
///\param m is the level of the messages output by the solver routines.
|
alpar@1321
|
80 |
///The possible values are:
|
alpar@1321
|
81 |
///- 0 --- no output (default value)
|
alpar@1321
|
82 |
///- 1 --- error messages only
|
alpar@1321
|
83 |
///- 2 --- normal output
|
alpar@1321
|
84 |
///- 3 --- full output (includes informational messages)
|
alpar@1321
|
85 |
void messageLevel(int m);
|
alpar@1312
|
86 |
|
athos@1261
|
87 |
};
|
athos@1261
|
88 |
} //END OF NAMESPACE LEMON
|
athos@1261
|
89 |
|
athos@1261
|
90 |
#endif //LEMON_LP_GLPK_H
|
athos@1261
|
91 |
|