Usually this class is not used directly, please use one of the concrete implementations of the solver interface.
#include <lemon/lp_base.h>
Classes | |
class | Col |
Refer to a column of the LP. More... | |
class | ColIt |
Iterator for iterate over the columns of an LP problem. 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... | |
class | RowIt |
Iterator for iterate over the rows of an LP problem. More... | |
class | UnsupportedFormatError |
Unsupported file format exception. More... | |
Public Types | |
enum | SolveExitStatus { SOLVED = 0, UNSOLVED = 1 } |
Possible outcomes of an LP solving procedure. More... | |
enum | Sense { MIN, MAX } |
Direction of the optimization. More... | |
enum | MessageLevel { MESSAGE_NOTHING, MESSAGE_ERROR, MESSAGE_WARNING, MESSAGE_NORMAL, MESSAGE_VERBOSE } |
Enum for messageLevel() parameter. More... | |
typedef double | Value |
The floating point type used by the solver. | |
Public Member Functions | |
virtual | ~LpBase () |
Virtual destructor. | |
const char * | solverName () const |
Gives back the name of the solver. | |
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 variables) at once. More... | |
void | col (Col c, const DualExpr &e) |
Set a column (i.e a dual constraint) of the LP. More... | |
DualExpr | col (Col c) const |
Get a column (i.e a dual constraint) of the LP. More... | |
Col | addCol (const DualExpr &e, Value o=0) |
Add a new column to the LP. More... | |
Row | addRow () |
Add a new empty row (i.e a new constraint) to the LP. More... | |
template<class T > | |
int | addRowSet (T &t) |
Add several new rows (i.e constraints) at once. More... | |
void | row (Row r, Value l, const Expr &e, Value u) |
Set a row (i.e a constraint) of the LP. More... | |
void | row (Row r, const Constr &c) |
Set a row (i.e a constraint) of the LP. More... | |
Expr | row (Row r) const |
Get a row (i.e a constraint) of the LP. More... | |
Row | addRow (Value l, const Expr &e, Value u) |
Add a new row (i.e a new constraint) to the LP. More... | |
Row | addRow (const Constr &c) |
Add a new row (i.e a new constraint) to the LP. More... | |
void | erase (Col c) |
Erase a column (i.e a variable) from the LP. More... | |
void | erase (Row r) |
Erase a row (i.e a constraint) from the LP. More... | |
std::string | colName (Col c) const |
Get the name of a column. More... | |
void | colName (Col c, const std::string &name) |
Set the name of a column. More... | |
Col | colByName (const std::string &name) const |
Get the column by its name. More... | |
std::string | rowName (Row r) const |
Get the name of a row. More... | |
void | rowName (Row r, const std::string &name) |
Set the name of a row. More... | |
Row | rowByName (const std::string &name) const |
Get the row by its name. More... | |
void | coeff (Row r, Col c, Value val) |
Set an element of the coefficient matrix of the LP. More... | |
Value | coeff (Row r, Col c) const |
Get an element of the coefficient matrix of the LP. More... | |
void | colLowerBound (Col c, Value value) |
Set the lower bound of a column (i.e a variable) More... | |
Value | colLowerBound (Col c) const |
Get the lower bound of a column (i.e a variable) More... | |
template<class T > | |
void | colLowerBound (T &t, Value value) |
Set the lower bound of several columns (i.e variables) at once. More... | |
void | colUpperBound (Col c, Value value) |
Set the upper bound of a column (i.e a variable) More... | |
Value | colUpperBound (Col c) const |
Get the upper bound of a column (i.e a variable) More... | |
template<class T > | |
void | colUpperBound (T &t, Value value) |
Set the upper bound of several columns (i.e variables) at once. More... | |
void | colBounds (Col c, Value lower, Value upper) |
Set the lower and the upper bounds of a column (i.e a variable) More... | |
template<class T > | |
void | colBounds (T &t, Value lower, Value upper) |
Set the lower and the upper bound of several columns (i.e variables) at once. More... | |
void | rowLowerBound (Row r, Value value) |
Set the lower bound of a row (i.e a constraint) More... | |
Value | rowLowerBound (Row r) const |
Get the lower bound of a row (i.e a constraint) More... | |
void | rowUpperBound (Row r, Value value) |
Set the upper bound of a row (i.e a constraint) More... | |
Value | rowUpperBound (Row r) const |
Get the upper bound of a row (i.e a constraint) More... | |
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 (const Expr &e) |
Set the objective function. More... | |
Expr | obj () const |
Get the objective function. More... | |
void | sense (Sense sense) |
Set the direction of optimization. | |
Sense | sense () const |
Query the direction of the optimization. | |
void | max () |
Set the sense to maximization. | |
void | min () |
Set the sense to maximization. | |
void | clear () |
Clear the problem. | |
void | messageLevel (MessageLevel level) |
Set the message level of the solver. | |
void | write (std::string file, std::string format="MPS") const |
Write the problem to a file in the given format. More... | |
Static Public Member Functions | |
static int | id (const Col &col) |
Returns the ID of the column. | |
static Col | colFromId (int id) |
Returns the column with the given ID. More... | |
static int | id (const Row &row) |
Returns the ID of the row. | |
static Row | rowFromId (int id) |
Returns the row with the given ID. More... | |
Static Public Attributes | |
static const Value | INF |
The infinity constant. | |
static const Value | NaN |
The not a number constant. | |
enum SolveExitStatus |
enum Sense |
enum MessageLevel |
|
inlinestatic |
|
inlinestatic |
|
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. |
c | is the column to get |
e | is a dual linear expression (see DualExpr) |
o | is the corresponding component of the objective function. It is 0 by default. |
|
inline |
This function adds a new empty row (i.e a new constraint) to the LP.
|
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 |
c | is a linear expression (see Constr) |
r | is the row to get |
c | is a linear expression (see Constr) |
|
inline |
c | is the column to be deleted |
|
inline |
r | is the row to be deleted |
|
inline |
c | is the coresponding column |
|
inline |
c | is the coresponding column |
name | The name to be given |
|
inline |
name | The name of the column |
INVALID
|
inline |
r | is the coresponding row |
|
inline |
r | is the coresponding row |
name | The name to be given |
|
inline |
name | The name of the row |
INVALID
r | is the row of the element to be modified |
c | is the column of the element to be modified |
val | is the new value of the coefficient |
r | is the row of the element |
c | is the column of the element |
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).
c
|
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).
c
|
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 bound of a constraint (row) 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 row (constraint) c
(this might be -INF as well).
r
The upper bound of a constraint (row) 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 row (constraint) c
(this might be -INF as well).
r
|
inline |
This function writes the problem to a file in the given format. Different solver backends may support different formats. Trying to write in an unsupported format will trigger UnsupportedFormatError. For the supported formats, visit the documentation of the base class of the related backends (CplexBase, GlpkBase etc.)
file | The file path |
format | The output file format. |