#include <lemon/lp_base.h>
Inherited by LpCplex [virtual]
, LpGlpk [virtual]
, LpSkeleton, and MipSolverBase [virtual]
.
Inheritance diagram for LpSolverBase:
Public Types | |
enum | SolveExitStatus { SOLVED = 0, UNSOLVED = 1 } |
Possible outcomes of an LP solving procedure. More... | |
enum | SolutionStatus { UNDEFINED = 0, INFEASIBLE = 1, FEASIBLE = 2, OPTIMAL = 3, INFINITE = 4 } |
More... | |
enum | ProblemTypes { PRIMAL_DUAL_FEASIBLE = 0, PRIMAL_FEASIBLE_DUAL_INFEASIBLE = 1, PRIMAL_INFEASIBLE_DUAL_FEASIBLE = 2, PRIMAL_DUAL_INFEASIBLE = 3, UNKNOWN = 4 } |
The type of the investigated LP problem More... | |
typedef double | Value |
The floating point type used by the solver. | |
Public Member Functions | |
LpSolverBase () | |
| |
virtual | ~LpSolverBase () |
| |
LpSolverBase & | newLp () |
Creates a new LP problem. | |
LpSolverBase & | copyLp () |
Makes a copy of the LP problem. | |
Build up and modify the LP | |
Col | addCol () |
Add a new empty column (i.e a new variable) to the LP. | |
template<class T> | |
int | addColSet (T &t) |
Adds several new columns (i.e a variables) at once. | |
void | col (Col c, const DualExpr &e) |
Set a column (i.e a dual constraint) of the LP. | |
Col | addCol (const DualExpr &e, Value obj=0) |
Add a new column to the LP. | |
Row | addRow () |
Add a new empty row (i.e a new constraint) to the LP. | |
template<class T> | |
int | addRowSet (T &t) |
Add several new rows (i.e a constraints) at once. | |
void | row (Row r, Value l, const Expr &e, Value u) |
Set a row (i.e a constraint) of the LP. | |
void | row (Row r, const Constr &c) |
Set a row (i.e a constraint) of the LP. | |
Row | addRow (Value l, const Expr &e, Value u) |
Add a new row (i.e a new constraint) to the LP. | |
Row | addRow (const Constr &c) |
Add a new row (i.e a new constraint) to the LP. | |
void | eraseCol (Col c) |
Erase a coloumn (i.e a variable) from the LP. | |
void | eraseRow (Row r) |
Erase a row (i.e a constraint) from the LP. | |
std::string | colName (Col c) |
Get the name of a column. | |
void | colName (Col c, const std::string &name) |
Set the name of a column. | |
void | coeff (Row r, Col c, Value val) |
Set an element of the coefficient matrix of the LP. | |
void | colLowerBound (Col c, Value value) |
Set the lower bound of a column (i.e a variable). | |
template<class T> | |
void | colLowerBound (T &t, Value value) |
Set the lower bound of several columns (i.e a variables) at once. | |
void | colUpperBound (Col c, Value value) |
Set the upper bound of a column (i.e a variable). | |
template<class T> | |
void | colUpperBound (T &t, Value value) |
Set the lower bound of several columns (i.e a variables) at once. | |
void | colBounds (Col c, Value lower, Value upper) |
Set the lower and the upper bounds of a column (i.e a variable). | |
template<class T> | |
void | colBounds (T &t, Value lower, Value upper) |
Set the lower and the upper bound of several columns (i.e a variables) at once. | |
void | rowBounds (Row c, Value lower, Value upper) |
Set the lower and the upper bounds of a row (i.e a constraint). | |
void | objCoeff (Col c, Value v) |
Set an element of the objective function. | |
void | setObj (Expr e) |
Set the objective function. | |
void | max () |
Maximize. | |
void | min () |
Minimize. | |
Solve the LP | |
SolveExitStatus | solve () |
Obtain the solution | |
SolutionStatus | primalStatus () |
The status of the primal problem (the original LP problem). | |
SolutionStatus | dualStatus () |
The status of the dual (of the original LP) problem. | |
ProblemTypes | problemType () |
The type of the original LP problem. | |
Value | primal (Col c) |
| |
Value | dual (Row r) |
| |
bool | isBasicCol (Col c) |
| |
Value | primalValue () |
| |
Static Public Attributes | |
static const Value | INF |
The infinity constant. | |
static const Value | NaN |
The not a number constant. | |
Protected Member Functions | |
virtual LpSolverBase & | _copyLp () |
virtual ProblemTypes | _getProblemType ()=0 |
Classes | |
class | Col |
Refer to a column of the LP. More... | |
class | Constr |
Linear constraint. More... | |
class | DualExpr |
Linear expression of rows. More... | |
class | Expr |
Linear expression of variables and a constant component. More... | |
class | Row |
Refer to a row of the LP. More... |
enum SolveExitStatus |
enum SolutionStatus |
UNDEFINED |
Feasible solution hasn't been found (but may exist).
|
INFEASIBLE | The problem has no feasible solution. |
FEASIBLE | Feasible solution found. |
OPTIMAL | Optimal solution exists and found. |
INFINITE |
The cost function is unbounded.
|
enum ProblemTypes |
virtual LpSolverBase& _copyLp | ( | ) | [inline, protected, virtual] |
Reimplemented in LpGlpk, and LpSkeleton.
virtual ProblemTypes _getProblemType | ( | ) | [protected, pure virtual] |
Implemented in LpSkeleton.
int addColSet | ( | T & | t | ) | [inline] |
This magic function takes a container as its argument and fills its elements with new columns (i.e. variables)
t | can be
|
c | is the column to be modified | |
e | is a dual linear expression (see DualExpr) a better one. |
e | is a dual linear expression (see DualExpr) | |
obj | is the corresponding component of the objective function. It is 0 by default. |
Row addRow | ( | ) | [inline] |
This function adds a new empty row (i.e a new constraint) to the LP.
int addRowSet | ( | T & | t | ) | [inline] |
This magic function takes a container as its argument and fills its elements with new row (i.e. variables)
t | can be
|
r | is the row to be modified | |
l | is lower bound (-INF means no bound) | |
e | is a linear expression (see Expr) | |
u | is the upper bound (INF means no bound) |
r | is the row to be modified | |
c | is a linear expression (see Constr) |
std::string colName | ( | Col | c | ) | [inline] |
c | is the coresponding coloumn |
void colName | ( | Col | c, | |
const std::string & | name | |||
) | [inline] |
c | is the coresponding coloumn | |
name | The name to be given |
r | is the row of the element to be modified | |
c | is the coloumn of the element to be modified | |
val | is the new value of the coefficient |
The lower bound of a variable (column) has to be given by an extended number of type Value, i.e. a finite number of type Value or -INF.
void colLowerBound | ( | T & | t, | |
Value | value | |||
) | [inline] |
This magic function takes a container as its argument and applies the function on all of its elements. The lower bound of a variable (column) has to be given by an extended number of type Value, i.e. a finite number of type Value or -INF.
The upper bound of a variable (column) has to be given by an extended number of type Value, i.e. a finite number of type Value or INF.
void colUpperBound | ( | T & | t, | |
Value | value | |||
) | [inline] |
This magic function takes a container as its argument and applies the function on all of its elements. The upper bound of a variable (column) has to be given by an extended number of type Value, i.e. a finite number of type Value or INF.
void setObj | ( | Expr | e | ) | [inline] |
SolveExitStatus solve | ( | ) | [inline] |
Solve the LP problem at hand
Value primalValue | ( | ) | [inline] |