COIN-OR::LEMON - Graph Library

Changeset 1279:7caed393608e in lemon-0.x


Ignore:
Timestamp:
03/31/05 10:34:55 (15 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1711
Message:

LpSolverBase::Expr is documented

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/athos/lp/lp_base.h

    r1275 r1279  
    3535  ///Internal data structure to convert floating id's to fix one's
    3636   
    37   ///\todo This might by implemented to be usable in other places.
     37  ///\todo This might be implemented to be also usable in other places.
    3838  class _FixId
    3939  {
     
    171171   };
    172172   
    173     ///Linear expression
    174     //    typedef SparseLinExpr<Col> Expr;
     173    ///Linear expression of variables and a constant component
     174   
     175    ///This data structure strores a linear expression of the variables
     176    ///(\ref Col "Col"s) and also has a constant component.
     177    ///
     178    ///There are several ways to access and modify the contents of this
     179    ///container.
     180    ///- Its it fully compatible with \c std::map<Col,double>, so for expamle
     181    ///if \c e is an Expr and \c v and \c w are of type \ref Col then you can
     182    ///read and modify the coefficients like
     183    ///these.
     184    ///\code
     185    ///e[v]=5;
     186    ///e[v]+=12;
     187    ///e.erase(v);
     188    ///\endcode
     189    ///or you can also iterate through its elements.
     190    ///\code
     191    ///double s=0;
     192    ///for(LpSolverBase::Expr::iterator i=e.begin();i!=e.end();++i)
     193    ///  s+=i->second;
     194    ///\endcode
     195    ///(This code computes the sum of all coefficients).
     196    ///- Numbers (<tt>double</tt>'s)
     197    ///and variables (\ref Col "Col"s) directly convert to an
     198    ///\ref Expr and the usual linear operations are defined so 
     199    ///\code
     200    ///v+w
     201    ///2*v-3.12*(v-w/2)+2
     202    ///v*2.1+(3*v+(v*12+w+6)*3)/2
     203    ///\endcode
     204    ///are valid expressions. The usual assignment operations are also defined.
     205    ///\code
     206    ///e=v+w;
     207    ///e+=2*v-3.12*(v-w/2)+2;
     208    ///e*=3.4;
     209    ///e/=5;
     210    ///\endcode
     211    ///- The constant member can be set and read by \ref constComp()
     212    ///\code
     213    ///e.constComp()=12;
     214    ///double c=e.constComp();
     215    ///\endcode
     216    ///
     217    ///\note that \ref clear() not only sets all coefficients to 0 but also
     218    ///clears the constant components.
    175219    class Expr : public std::map<Col,Value>
    176220    {
Note: See TracChangeset for help on using the changeset viewer.