[Lemon-commits] deba: r3379 - lemon/trunk/lemon
Lemon SVN
svn at lemon.cs.elte.hu
Wed Nov 14 18:53:08 CET 2007
Author: deba
Date: Wed Nov 14 18:53:08 2007
New Revision: 3379
Modified:
lemon/trunk/lemon/lp_base.h
Log:
Query the result value of an expression
Modified: lemon/trunk/lemon/lp_base.h
==============================================================================
--- lemon/trunk/lemon/lp_base.h (original)
+++ lemon/trunk/lemon/lp_base.h Wed Nov 14 18:53:08 2007
@@ -1369,9 +1369,27 @@
///\e
Value primal(Col c) const { return _getPrimal(_lpId(c)); }
+ ///\e
+ Value primal(const Expr& e) const {
+ double res = e.constComp();
+ for (std::map<Col, double>::const_iterator it = e.begin();
+ it != e.end(); ++it) {
+ res += _getPrimal(_lpId(it->first)) * it->second;
+ }
+ return res;
+ }
///\e
Value dual(Row r) const { return _getDual(_lpId(r)); }
+ ///\e
+ Value dual(const DualExpr& e) const {
+ double res = 0.0;
+ for (std::map<Row, double>::const_iterator it = e.begin();
+ it != e.end(); ++it) {
+ res += _getPrimal(_lpId(it->first)) * it->second;
+ }
+ return res;
+ }
///\e
bool isBasicCol(Col c) const { return _isBasicCol(_lpId(c)); }
More information about the Lemon-commits
mailing list