All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Related Functions
LpBase::DualExpr Class Reference

Detailed Description

This data structure represents a column of the matrix, thas is it strores a linear expression of the dual variables (Rows).

There are several ways to access and modify the contents of this container.

e[v]=5;
e[v]+=12;
e.erase(v);

or you can also iterate through its elements.

double s=0;
for(LpBase::DualExpr::ConstCoeffIt i(e);i!=INVALID;++i)
s+=*i;

(This code computes the sum of all coefficients).

See Also
Expr

#include <lemon/lp_base.h>

Classes

class  CoeffIt
 Iterator over the expression. More...
 
class  ConstCoeffIt
 Iterator over the expression. More...
 

Public Types

typedef LpBase::Row Key
 The key type of the expression.
 
typedef LpBase::Value Value
 The value type of the expression.
 

Public Member Functions

 DualExpr ()
 Default constructor.
 
 DualExpr (const Row &r)
 Construct an expression from a row.
 
Value operator[] (const Row &r) const
 Returns the coefficient of the row.
 
Valueoperator[] (const Row &r)
 Returns the coefficient of the row.
 
void set (const Row &r, const Value &v)
 Sets the coefficient of the row.
 
void simplify (Value epsilon=0.0)
 Removes the coefficients which's absolute value does not exceed epsilon.
 
void clear ()
 Sets all coefficients to 0.
 
DualExproperator+= (const DualExpr &e)
 Compound assignment.
 
DualExproperator-= (const DualExpr &e)
 Compound assignment.
 
DualExproperator*= (const Value &v)
 Multiply with a constant.
 
DualExproperator/= (const Value &v)
 Division with a constant.
 

Related Functions

(Note that these are not member functions.)

LpBase::DualExpr operator+ (const LpBase::DualExpr &a, const LpBase::DualExpr &b)
 Addition.
 
LpBase::DualExpr operator- (const LpBase::DualExpr &a, const LpBase::DualExpr &b)
 Substraction.
 
LpBase::DualExpr operator* (const LpBase::DualExpr &a, const LpBase::Value &b)
 Multiply with constant.
 
LpBase::DualExpr operator* (const LpBase::Value &a, const LpBase::DualExpr &b)
 Multiply with constant.
 
LpBase::DualExpr operator/ (const LpBase::DualExpr &a, const LpBase::Value &b)
 Divide with constant.
 

Constructor & Destructor Documentation

DualExpr ( )
inline

Construct an empty expression, the coefficients are initialized to zero.

DualExpr ( const Row r)
inline

Construct an expression, which has a term with r dual variable and 1.0 coefficient.