Public Types | Public Member Functions

LpSolver Class Reference


Detailed Description

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 Lp default 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.

#include <lemon/lp_base.h>

Inheritance diagram for LpSolver:

List of all members.

Public Types

enum  ProblemType {
  UNDEFINED = 0, INFEASIBLE = 1, FEASIBLE = 2, OPTIMAL = 3,
  UNBOUNDED = 4
}
 

The problem types for primal and dual problems.

More...
enum  VarStatus {
  BASIC, FREE, LOWER, UPPER,
  FIXED
}
 

The basis status of variables.

More...

Public Member Functions

virtual LpSolvernewSolver () const =0
 Allocate a new LP problem instance.
virtual LpSolvercloneSolver () const =0
 Make a copy of the LP problem.
Solve the LP
SolveExitStatus solve ()
Obtain the Solution
ProblemType primalType () const
 The type of the primal problem.
ProblemType dualType () const
 The type of the dual problem.
Value primal (Col c) const
 Return the primal value of the column.
Value primal (const Expr &e) const
 Return the primal value of the expression.
Value primalRay (Col c) const
 Returns a component of the primal ray.
Value dual (Row r) const
 Return the dual value of the row.
Value dual (const DualExpr &e) const
 Return the dual value of the dual expression.
Value dualRay (Row r) const
 Returns a component of the dual ray.
VarStatus colStatus (Col c) const
 Return the basis status of the column.
VarStatus rowStatus (Row r) const
 Return the basis status of the row.
Value primal () const
 The value of the objective function.

Member Enumeration Documentation

Enumerator:
UNDEFINED 

= 0. Feasible solution hasn't been found (but may exist).

INFEASIBLE 

= 1. The problem has no feasible solution.

FEASIBLE 

= 2. Feasible solution found.

OPTIMAL 

= 3. Optimal solution exists and found.

UNBOUNDED 

= 4. The cost function is unbounded.

enum VarStatus
Enumerator:
BASIC 

The variable is in the basis.

FREE 

The variable is free, but not basic.

LOWER 

The variable has active lower bound.

UPPER 

The variable has active upper bound.

FIXED 

The variable is non-basic and fixed.


Member Function Documentation

SolveExitStatus solve ( ) [inline]

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 SolveExitStatus.
Value primal ( Col  c) const [inline]

Return the primal value of the column.

Precondition:
The problem is solved.
Value primal ( const Expr e) const [inline]

Return the primal value of the expression, i.e. the dot product of the primal solution and the expression.

Precondition:
The problem is solved.
Value primalRay ( Col  c) const [inline]

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.

Precondition:
The problem is solved and the dual problem is infeasible.
Note:
Some solvers does not provide primal ray calculation functions.
Value dual ( Row  r) const [inline]

Return the dual value of the row.

Precondition:
The problem is solved.
Value dual ( const DualExpr e) const [inline]

Return the dual value of the dual expression, i.e. the dot product of the dual solution and the dual expression.

Precondition:
The problem is solved.
Value dualRay ( Row  r) const [inline]

The dual ray is solution of the modified primal problem, where we change each finite bound to 0 (i.e. the objective function coefficients in the primal problem), and we looking for a ositive 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.

Precondition:
The problem is solved and the primal problem is infeasible.
Note:
Some solvers does not provide dual ray calculation functions.
VarStatus colStatus ( Col  c) const [inline]
See also:
VarStatus
VarStatus rowStatus ( Row  r) const [inline]
See also:
VarStatus
Value primal ( ) const [inline]
Returns:
  • INF or -INF means either infeasibility or unboundedness of the primal problem, depending on whether we minimize or maximize.
  • NaN if no primal solution is found.
  • The (finite) objective value if an optimal solution is found.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines