| ... | ... |
@@ -110,98 +110,96 @@ |
| 110 | 110 |
///Returns the constraint identifier understood by GLPK. |
| 111 | 111 |
int lpxRow(Row r) const { return rows(id(r)); }
|
| 112 | 112 |
|
| 113 | 113 |
///Returns the variable identifier understood by GLPK. |
| 114 | 114 |
int lpxCol(Col c) const { return cols(id(c)); }
|
| 115 | 115 |
|
| 116 | 116 |
}; |
| 117 | 117 |
|
| 118 | 118 |
/// \brief Interface for the GLPK LP solver |
| 119 | 119 |
/// |
| 120 | 120 |
/// This class implements an interface for the GLPK LP solver. |
| 121 | 121 |
///\ingroup lp_group |
| 122 | 122 |
class GlpkLp : public LpSolver, public GlpkBase {
|
| 123 | 123 |
public: |
| 124 | 124 |
|
| 125 | 125 |
///\e |
| 126 | 126 |
GlpkLp(); |
| 127 | 127 |
///\e |
| 128 | 128 |
GlpkLp(const GlpkLp&); |
| 129 | 129 |
|
| 130 | 130 |
///\e |
| 131 | 131 |
virtual GlpkLp* cloneSolver() const; |
| 132 | 132 |
///\e |
| 133 | 133 |
virtual GlpkLp* newSolver() const; |
| 134 | 134 |
|
| 135 | 135 |
private: |
| 136 | 136 |
|
| 137 | 137 |
mutable std::vector<double> _primal_ray; |
| 138 | 138 |
mutable std::vector<double> _dual_ray; |
| 139 | 139 |
|
| 140 | 140 |
void _clear_temporals(); |
| 141 | 141 |
|
| 142 | 142 |
protected: |
| 143 | 143 |
|
| 144 | 144 |
virtual const char* _solverName() const; |
| 145 | 145 |
|
| 146 | 146 |
virtual SolveExitStatus _solve(); |
| 147 | 147 |
virtual Value _getPrimal(int i) const; |
| 148 | 148 |
virtual Value _getDual(int i) const; |
| 149 | 149 |
|
| 150 | 150 |
virtual Value _getPrimalValue() const; |
| 151 | 151 |
|
| 152 | 152 |
virtual VarStatus _getColStatus(int i) const; |
| 153 | 153 |
virtual VarStatus _getRowStatus(int i) const; |
| 154 | 154 |
|
| 155 | 155 |
virtual Value _getPrimalRay(int i) const; |
| 156 | 156 |
virtual Value _getDualRay(int i) const; |
| 157 | 157 |
|
| 158 |
///\todo It should be clarified |
|
| 159 |
/// |
|
| 160 | 158 |
virtual ProblemType _getPrimalType() const; |
| 161 | 159 |
virtual ProblemType _getDualType() const; |
| 162 | 160 |
|
| 163 | 161 |
public: |
| 164 | 162 |
|
| 165 | 163 |
///Solve with primal simplex |
| 166 | 164 |
SolveExitStatus solvePrimal(); |
| 167 | 165 |
|
| 168 | 166 |
///Solve with dual simplex |
| 169 | 167 |
SolveExitStatus solveDual(); |
| 170 | 168 |
|
| 171 | 169 |
///Turns on or off the presolver |
| 172 | 170 |
|
| 173 | 171 |
///Turns on (\c b is \c true) or off (\c b is \c false) the presolver |
| 174 | 172 |
/// |
| 175 | 173 |
///The presolver is off by default. |
| 176 | 174 |
void presolver(bool b); |
| 177 | 175 |
|
| 178 | 176 |
///Enum for \c messageLevel() parameter |
| 179 | 177 |
enum MessageLevel {
|
| 180 | 178 |
/// no output (default value) |
| 181 | 179 |
MESSAGE_NO_OUTPUT = 0, |
| 182 | 180 |
/// error messages only |
| 183 | 181 |
MESSAGE_ERROR_MESSAGE = 1, |
| 184 | 182 |
/// normal output |
| 185 | 183 |
MESSAGE_NORMAL_OUTPUT = 2, |
| 186 | 184 |
/// full output (includes informational messages) |
| 187 | 185 |
MESSAGE_FULL_OUTPUT = 3 |
| 188 | 186 |
}; |
| 189 | 187 |
|
| 190 | 188 |
private: |
| 191 | 189 |
|
| 192 | 190 |
MessageLevel _message_level; |
| 193 | 191 |
|
| 194 | 192 |
public: |
| 195 | 193 |
|
| 196 | 194 |
///Set the verbosity of the messages |
| 197 | 195 |
|
| 198 | 196 |
///Set the verbosity of the messages |
| 199 | 197 |
/// |
| 200 | 198 |
///\param m is the level of the messages output by the solver routines. |
| 201 | 199 |
void messageLevel(MessageLevel m); |
| 202 | 200 |
}; |
| 203 | 201 |
|
| 204 | 202 |
/// \brief Interface for the GLPK MIP solver |
| 205 | 203 |
/// |
| 206 | 204 |
/// This class implements an interface for the GLPK MIP solver. |
| 207 | 205 |
///\ingroup lp_group |
| ... | ... |
@@ -160,78 +160,66 @@ |
| 160 | 160 |
|
| 161 | 161 |
///\e |
| 162 | 162 |
virtual SolveExitStatus _solve(); |
| 163 | 163 |
|
| 164 | 164 |
///\e |
| 165 | 165 |
virtual Value _getPrimal(int i) const; |
| 166 | 166 |
///\e |
| 167 | 167 |
virtual Value _getDual(int i) const; |
| 168 | 168 |
|
| 169 | 169 |
///\e |
| 170 | 170 |
virtual Value _getPrimalValue() const; |
| 171 | 171 |
|
| 172 | 172 |
///\e |
| 173 | 173 |
virtual Value _getPrimalRay(int i) const; |
| 174 | 174 |
///\e |
| 175 | 175 |
virtual Value _getDualRay(int i) const; |
| 176 | 176 |
|
| 177 | 177 |
///\e |
| 178 | 178 |
virtual ProblemType _getPrimalType() const; |
| 179 | 179 |
///\e |
| 180 | 180 |
virtual ProblemType _getDualType() const; |
| 181 | 181 |
|
| 182 | 182 |
///\e |
| 183 | 183 |
virtual VarStatus _getColStatus(int i) const; |
| 184 | 184 |
///\e |
| 185 | 185 |
virtual VarStatus _getRowStatus(int i) const; |
| 186 | 186 |
|
| 187 | 187 |
///\e |
| 188 | 188 |
virtual const char* _solverName() const; |
| 189 | 189 |
|
| 190 | 190 |
}; |
| 191 | 191 |
|
| 192 | 192 |
/// \brief Skeleton class for a MIP solver interface |
| 193 | 193 |
/// |
| 194 | 194 |
///This class does nothing, but it can serve as a skeleton when |
| 195 | 195 |
///implementing an interface to new solvers. |
| 196 | 196 |
///\ingroup lp_group |
| 197 | 197 |
class MipSkeleton : public MipSolver, public SkeletonSolverBase {
|
| 198 | 198 |
public: |
| 199 | 199 |
///\e |
| 200 | 200 |
MipSkeleton() : MipSolver(), SkeletonSolverBase() {}
|
| 201 | 201 |
///\e |
| 202 | 202 |
virtual MipSkeleton* newSolver() const; |
| 203 | 203 |
///\e |
| 204 | 204 |
virtual MipSkeleton* cloneSolver() const; |
| 205 | 205 |
|
| 206 | 206 |
protected: |
| 207 | 207 |
///\e |
| 208 |
|
|
| 209 |
///\bug Wrong interface |
|
| 210 |
/// |
|
| 211 | 208 |
virtual SolveExitStatus _solve(); |
| 212 | 209 |
|
| 213 | 210 |
///\e |
| 214 |
|
|
| 215 |
///\bug Wrong interface |
|
| 216 |
/// |
|
| 217 | 211 |
virtual Value _getSol(int i) const; |
| 218 | 212 |
|
| 219 | 213 |
///\e |
| 220 |
|
|
| 221 |
///\bug Wrong interface |
|
| 222 |
/// |
|
| 223 | 214 |
virtual Value _getSolValue() const; |
| 224 | 215 |
|
| 225 | 216 |
///\e |
| 226 |
|
|
| 227 |
///\bug Wrong interface |
|
| 228 |
/// |
|
| 229 | 217 |
virtual ProblemType _getType() const; |
| 230 | 218 |
|
| 231 | 219 |
///\e |
| 232 | 220 |
virtual const char* _solverName() const; |
| 233 | 221 |
}; |
| 234 | 222 |
|
| 235 | 223 |
} //namespace lemon |
| 236 | 224 |
|
| 237 | 225 |
#endif |
0 comments (0 inline)