1 | /* -*- C++ -*- |
---|
2 | * |
---|
3 | * This file is a part of LEMON, a generic C++ optimization library |
---|
4 | * |
---|
5 | * Copyright (C) 2003-2006 |
---|
6 | * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
---|
7 | * (Egervary Research Group on Combinatorial Optimization, EGRES). |
---|
8 | * |
---|
9 | * Permission to use, modify and distribute this software is granted |
---|
10 | * provided that this copyright notice appears in all copies. For |
---|
11 | * precise terms see the accompanying LICENSE file. |
---|
12 | * |
---|
13 | * This software is provided "AS IS" with no warranty of any kind, |
---|
14 | * express or implied, and with no claim as to its suitability for any |
---|
15 | * purpose. |
---|
16 | * |
---|
17 | */ |
---|
18 | |
---|
19 | #ifndef LEMON_LP_SKELETON |
---|
20 | #define LEMON_LP_SKELETON |
---|
21 | |
---|
22 | #include <lemon/lp_base.h> |
---|
23 | |
---|
24 | ///\file |
---|
25 | ///\brief A skeleton file to implement LP solver interfaces |
---|
26 | namespace lemon { |
---|
27 | |
---|
28 | ///A skeleton class to implement LP solver interfaces |
---|
29 | class LpSkeleton :public LpSolverBase { |
---|
30 | int col_num,row_num; |
---|
31 | |
---|
32 | protected: |
---|
33 | ///\e |
---|
34 | virtual LpSolverBase &_newLp(); |
---|
35 | ///\e |
---|
36 | virtual LpSolverBase &_copyLp(); |
---|
37 | /// \e |
---|
38 | virtual int _addCol(); |
---|
39 | /// \e |
---|
40 | virtual int _addRow(); |
---|
41 | /// \e |
---|
42 | virtual void _eraseCol(int i); |
---|
43 | /// \e |
---|
44 | virtual void _eraseRow(int i); |
---|
45 | /// \e |
---|
46 | virtual void _getColName(int col, std::string & name); |
---|
47 | /// \e |
---|
48 | virtual void _setColName(int col, const std::string & name); |
---|
49 | |
---|
50 | /// \e |
---|
51 | virtual void _setRowCoeffs(int i, LpRowIterator b, LpRowIterator e); |
---|
52 | /// \e |
---|
53 | virtual void _setColCoeffs(int i, LpColIterator b, LpColIterator e); |
---|
54 | |
---|
55 | /// Set one element of the coefficient matrix |
---|
56 | virtual void _setCoeff(int row, int col, Value value); |
---|
57 | |
---|
58 | /// Get one element of the coefficient matrix |
---|
59 | virtual Value _getCoeff(int row, int col); |
---|
60 | |
---|
61 | /// The lower bound of a variable (column) have to be given by an |
---|
62 | /// extended number of type Value, i.e. a finite number of type |
---|
63 | /// Value or -\ref INF. |
---|
64 | virtual void _setColLowerBound(int i, Value value); |
---|
65 | /// \e |
---|
66 | |
---|
67 | /// The upper bound of a variable (column) have to be given by an |
---|
68 | /// extended number of type Value, i.e. a finite number of type |
---|
69 | /// Value or \ref INF. |
---|
70 | virtual void _setColUpperBound(int i, Value value); |
---|
71 | /// \e |
---|
72 | |
---|
73 | // /// The lower bound of a linear expression (row) have to be given by an |
---|
74 | // /// extended number of type Value, i.e. a finite number of type |
---|
75 | // /// Value or -\ref INF. |
---|
76 | // virtual void _setRowLowerBound(int i, Value value); |
---|
77 | // /// \e |
---|
78 | |
---|
79 | // /// The upper bound of a linear expression (row) have to be given by an |
---|
80 | // /// extended number of type Value, i.e. a finite number of type |
---|
81 | // /// Value or \ref INF. |
---|
82 | // virtual void _setRowUpperBound(int i, Value value); |
---|
83 | |
---|
84 | /// The lower and upper bound of a linear expression (row) have to be |
---|
85 | /// given by an |
---|
86 | /// extended number of type Value, i.e. a finite number of type |
---|
87 | /// Value or +/-\ref INF. |
---|
88 | virtual void _setRowBounds(int i, Value lb, Value ub); |
---|
89 | /// \e |
---|
90 | |
---|
91 | |
---|
92 | /// \e |
---|
93 | virtual void _clearObj(); |
---|
94 | /// \e |
---|
95 | virtual void _setObjCoeff(int i, Value obj_coef); |
---|
96 | |
---|
97 | /// \e |
---|
98 | virtual Value _getObjCoeff(int i); |
---|
99 | |
---|
100 | ///\e |
---|
101 | |
---|
102 | ///\bug Wrong interface |
---|
103 | /// |
---|
104 | virtual SolveExitStatus _solve(); |
---|
105 | |
---|
106 | ///\e |
---|
107 | |
---|
108 | ///\bug Wrong interface |
---|
109 | /// |
---|
110 | virtual Value _getPrimal(int i); |
---|
111 | |
---|
112 | ///\e |
---|
113 | |
---|
114 | ///\bug Wrong interface |
---|
115 | /// |
---|
116 | virtual Value _getDual(int i); |
---|
117 | |
---|
118 | ///\e |
---|
119 | |
---|
120 | ///\bug Wrong interface |
---|
121 | /// |
---|
122 | virtual Value _getPrimalValue(); |
---|
123 | |
---|
124 | ///\e |
---|
125 | |
---|
126 | ///\bug Wrong interface |
---|
127 | /// |
---|
128 | virtual SolutionStatus _getPrimalStatus(); |
---|
129 | |
---|
130 | ////e |
---|
131 | virtual SolutionStatus _getDualStatus(); |
---|
132 | |
---|
133 | |
---|
134 | ///\e |
---|
135 | virtual ProblemTypes _getProblemType(); |
---|
136 | |
---|
137 | ///\e |
---|
138 | virtual void _setMax(); |
---|
139 | ///\e |
---|
140 | virtual void _setMin(); |
---|
141 | |
---|
142 | ///\e |
---|
143 | virtual bool _isMax(); |
---|
144 | |
---|
145 | |
---|
146 | |
---|
147 | ///\e |
---|
148 | virtual bool _isBasicCol(int i); |
---|
149 | |
---|
150 | |
---|
151 | |
---|
152 | public: |
---|
153 | LpSkeleton() : LpSolverBase(), col_num(0), row_num(0) {} |
---|
154 | }; |
---|
155 | |
---|
156 | } //namespace lemon |
---|
157 | |
---|
158 | #endif // LEMON_LP_SKELETON |
---|