#include <lemon/lp_base.h>
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... | |
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. | |
DualExpr | col (Col c) const |
Get a column (i.e a dual constraint) of the LP. | |
Col | addCol (const DualExpr &e, Value o=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. | |
Expr | row (Row r) const |
Get 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) const |
Get the name of a column. | |
void | colName (Col c, const std::string &name) |
Set the name of a column. | |
Col | colByName (const std::string &name) const |
Get the column by its name. | |
void | coeff (Row r, Col c, Value val) |
Set an element of the coefficient matrix of the LP. | |
Value | coeff (Row r, Col c) const |
Get 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). | |
Value | colLowerBound (Col c) const |
Get 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). | |
Value | colUpperBound (Col c) const |
Get the upper bound of a column (i.e a variable). | |
template<class T > | |
void | colUpperBound (T &t, Value value) |
Set the upper 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 | getRowBounds (Row c, Value &lower, Value &upper) const |
Get 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. | |
Value | objCoeff (Col c) const |
Get an element of the objective function. | |
void | obj (Expr e) |
Set the objective function. | |
Expr | obj () const |
Get the objective function. | |
void | max () |
Maximize. | |
void | min () |
Minimize. | |
bool | isMax () const |
Query function: is this a maximization problem? | |
bool | isMin () const |
Query function: is this a minimization problem? | |
Solve the LP | |
SolveExitStatus | solve () |
Obtain the solution | |
SolutionStatus | primalStatus () const |
The status of the primal problem (the original LP problem). | |
SolutionStatus | dualStatus () const |
The status of the dual (of the original LP) problem. | |
ProblemTypes | problemType () const |
The type of the original LP problem. | |
Value | primal (Col c) const |
| |
Value | primal (const Expr &e) const |
| |
Value | dual (Row r) const |
| |
Value | dual (const DualExpr &e) const |
| |
bool | isBasicCol (Col c) const |
| |
Value | primalValue () const |
| |
Static Public Attributes | |
static const Value | INF = std::numeric_limits<Value>::infinity() |
The infinity constant. | |
static const Value | NaN = std::numeric_limits<Value>::quiet_NaN() |
The not a number constant. | |
Protected Types | |
typedef MappedInputIterator< Expr > | ConstRowIterator |
STL compatible iterator for lp col. | |
typedef MappedInputIterator < DualExpr > | ConstColIterator |
STL compatible iterator for lp row. | |
typedef MappedOutputIterator < Expr > | RowIterator |
STL compatible iterator for lp col. | |
typedef MappedOutputIterator < DualExpr > | ColIterator |
STL compatible iterator for lp row. |
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 |
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. |
r | is the column to get |
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) |
r | is the row to get |
std::string colName | ( | Col | c | ) | const [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 |
Col colByName | ( | const std::string & | name | ) | const [inline] |
name | The name of the column |
INVALID
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 |
r | is the row of the element in question | |
c | is the coloumn of the element in question |
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.
This function returns the lower bound for column (variable) c (this might be -INF as well).
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.
This function returns the upper bound for column (variable) c (this might be INF as well).
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.
The lower and the upper bound of a constraint (row) are extended numbers of type Value, i.e. finite numbers of type Value, -INF or INF.
SolveExitStatus solve | ( | ) | [inline] |
Solve the LP problem at hand
Value primalValue | ( | ) | const [inline] |