LpSolver
Declared in lemon/lp_base.h, in the group LP and MIP Solvers; the same class on the Doxygen site.
-
class LpSolver : public virtual LpBase
Common base class for LP solvers.
This class is an abstract base class for LP solvers. This class provides a full interface for set and modify an LP problem, solve it and retrieve the solution. You can use one of the descendants as a concrete implementation, or the
Lpdefault LP solver. However, if you would like to handle LP solvers as reference or pointer in a generic way, you can use this class directly.Subclassed by ClpLp, CplexLp, GlpkLp, LpSkeleton, SoplexLp
Solve the LP
-
inline SolveExitStatus solve()
-
Solve the LP problem at hand
- Returns:
The result of the optimization procedure. Possible values and their meanings can be found in the documentation of
Obtain the Solution
-
inline ProblemType primalType() const
The type of the primal problem.
-
inline ProblemType dualType() const
The type of the dual problem.
-
inline Value primal( Col c ) const
Return the primal value of the column.
- Pre:
The problem is solved.
-
inline Value primal( const Expr & e ) const
Return the primal value of the expression.
Return the primal value of the expression, i.e. the dot product of the primal solution and the expression.
- Pre:
The problem is solved.
-
inline Value primalRay( Col c ) const
Returns a component of the primal ray.
The primal ray is solution of the modified primal problem, where we change each finite bound to 0, and we looking for a negative objective value in case of minimization, and positive objective value for maximization. If there is such solution, that proofs the unsolvability of the dual problem, and if a feasible primal solution exists, then the unboundness of primal problem.
Note
Some solvers does not provide primal ray calculation functions.
- Pre:
The problem is solved and the dual problem is infeasible.
-
inline Value dual( Row r ) const
Return the dual value of the row.
- Pre:
The problem is solved.
-
inline Value dual( const DualExpr & e ) const
Return the dual value of the dual expression.
Return the dual value of the dual expression, i.e. the dot product of the dual solution and the dual expression.
- Pre:
The problem is solved.
-
inline Value dualRay( Row r ) const
Returns a component of the dual ray.
The dual ray is solution of the modified dual problem, where we change its right-hand sides (i.e. the objective function coefficients in the primal problem) to 0, and we look for a positive objective value. If there is such solution, that proofs the unsolvability of the primal problem, and if a feasible dual solution exists, then the unboundness of dual problem.
Note
Some solvers does not provide dual ray calculation functions.
- Pre:
The problem is solved and the primal problem is infeasible.
Public Types
-
enum ProblemType
The problem types for primal and dual problems.
Values:
-
enumerator UNDEFINED
= 0. Feasible solution hasn’t been found (but may exist).
-
enumerator INFEASIBLE
= 1. The problem has no feasible solution.
-
enumerator FEASIBLE
= 2. Feasible solution found.
-
enumerator OPTIMAL
= 3. Optimal solution exists and found.
-
enumerator UNBOUNDED
= 4. The cost function is unbounded.
-
enumerator UNDEFINED
-
enum VarStatus
The basis status of variables.
Values:
-
enumerator BASIC
The variable is in the basis.
-
enumerator FREE
The variable is free, but not basic.
-
enumerator LOWER
The variable has active lower bound.
-
enumerator UPPER
The variable has active upper bound.
-
enumerator FIXED
The variable is non-basic and fixed.
-
enumerator BASIC
Public Functions
Protected Functions
-
virtual SolveExitStatus _solve() = 0
-
virtual Value _getPrimal( int i ) const = 0
-
virtual Value _getDual( int i ) const = 0
-
virtual Value _getPrimalRay( int i ) const = 0
-
virtual Value _getDualRay( int i ) const = 0
-
virtual Value _getPrimalValue() const = 0
-
virtual ProblemType _getPrimalType() const = 0
-
virtual ProblemType _getDualType() const = 0
-
inline SolveExitStatus solve()