Index: src/work/athos/lp/lp_base.h
===================================================================
--- src/work/athos/lp/lp_base.h (revision 1275)
+++ src/work/athos/lp/lp_base.h (revision 1279)
@@ -35,5 +35,5 @@
///Internal data structure to convert floating id's to fix one's
- ///\todo This might by implemented to be usable in other places.
+ ///\todo This might be implemented to be also usable in other places.
class _FixId
{
@@ -171,6 +171,50 @@
};
- ///Linear expression
- // typedef SparseLinExpr
Expr;
+ ///Linear expression of variables and a constant component
+
+ ///This data structure strores a linear expression of the variables
+ ///(\ref Col "Col"s) and also has a constant component.
+ ///
+ ///There are several ways to access and modify the contents of this
+ ///container.
+ ///- Its it fully compatible with \c std::map, so for expamle
+ ///if \c e is an Expr and \c v and \c w are of type \ref Col then you can
+ ///read and modify the coefficients like
+ ///these.
+ ///\code
+ ///e[v]=5;
+ ///e[v]+=12;
+ ///e.erase(v);
+ ///\endcode
+ ///or you can also iterate through its elements.
+ ///\code
+ ///double s=0;
+ ///for(LpSolverBase::Expr::iterator i=e.begin();i!=e.end();++i)
+ /// s+=i->second;
+ ///\endcode
+ ///(This code computes the sum of all coefficients).
+ ///- Numbers (double's)
+ ///and variables (\ref Col "Col"s) directly convert to an
+ ///\ref Expr and the usual linear operations are defined so
+ ///\code
+ ///v+w
+ ///2*v-3.12*(v-w/2)+2
+ ///v*2.1+(3*v+(v*12+w+6)*3)/2
+ ///\endcode
+ ///are valid expressions. The usual assignment operations are also defined.
+ ///\code
+ ///e=v+w;
+ ///e+=2*v-3.12*(v-w/2)+2;
+ ///e*=3.4;
+ ///e/=5;
+ ///\endcode
+ ///- The constant member can be set and read by \ref constComp()
+ ///\code
+ ///e.constComp()=12;
+ ///double c=e.constComp();
+ ///\endcode
+ ///
+ ///\note that \ref clear() not only sets all coefficients to 0 but also
+ ///clears the constant components.
class Expr : public std::map
{