COIN-OR::LEMON - Graph Library

Changeset 2513:26983135fd6d in lemon-0.x


Ignore:
Timestamp:
11/14/07 18:53:08 (16 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3378
Message:

Query the result value of an expression

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/lp_base.h

    r2495 r2513  
    13701370    ///\e
    13711371    Value primal(Col c) const { return _getPrimal(_lpId(c)); }
     1372    ///\e
     1373    Value primal(const Expr& e) const {
     1374      double res = e.constComp();
     1375      for (std::map<Col, double>::const_iterator it = e.begin();
     1376           it != e.end(); ++it) {
     1377        res += _getPrimal(_lpId(it->first)) * it->second;
     1378      }
     1379      return res;
     1380    }
    13721381
    13731382    ///\e
    13741383    Value dual(Row r) const { return _getDual(_lpId(r)); }
     1384    ///\e
     1385    Value dual(const DualExpr& e) const {
     1386      double res = 0.0;
     1387      for (std::map<Row, double>::const_iterator it = e.begin();
     1388           it != e.end(); ++it) {
     1389        res += _getPrimal(_lpId(it->first)) * it->second;
     1390      }
     1391      return res;
     1392    }
    13751393
    13761394    ///\e
Note: See TracChangeset for help on using the changeset viewer.