There are several ways to access and modify the contents of this container.
std::map<Col,double>
, so for expamle if e
is an Expr and v
and w
are of type Col, then you can read and modify the coefficients like these. e[v]=5; e[v]+=12; e.erase(v);
double s=0; for(LpSolverBase::Expr::iterator i=e.begin();i!=e.end();++i) s+=i->second;
double
's) and variables (Cols) directly convert to an Expr and the usual linear operations are defined, so v+w 2*v-3.12*(v-w/2)+2 v*2.1+(3*v+(v*12+w+6)*3)/2
e=v+w; e+=2*v-3.12*(v-w/2)+2; e*=3.4; e/=5;
e.constComp()=12;
double c=e.constComp();
#include <lemon/lp_base.h>
Inherits std::map<Col,Value>.
Public Member Functions | |
Expr () | |
| |
Expr (const Key &v) | |
| |
Expr (const Value &v) | |
| |
void | set (const Key &v, const Value &c) |
| |
Value & | constComp () |
| |
const Value & | constComp () const |
| |
void | simplify () |
Removes the components with zero coefficient. | |
void | simplify (double &tolerance) |
Removes the coefficients closer to zero than tolerance . | |
void | clear () |
Sets all coefficients and the constant component to 0. | |
Expr & | operator+= (const Expr &e) |
| |
Expr & | operator-= (const Expr &e) |
| |
Expr & | operator*= (const Value &c) |
| |
Expr & | operator/= (const Value &c) |
| |
Related Functions | |
(Note that these are not member functions.) | |
LpSolverBase::Expr | operator- (const LpSolverBase::Expr &a, const LpSolverBase::Expr &b) |
| |
LpSolverBase::Expr | operator* (const LpSolverBase::Expr &a, const LpSolverBase::Value &b) |
| |
LpSolverBase::Expr | operator* (const LpSolverBase::Value &a, const LpSolverBase::Expr &b) |
| |
LpSolverBase::Expr | operator/ (const LpSolverBase::Expr &a, const LpSolverBase::Value &b) |
|