1.1 --- a/lemon/lp_base.h Wed Nov 14 17:44:42 2007 +0000
1.2 +++ b/lemon/lp_base.h Wed Nov 14 17:53:08 2007 +0000
1.3 @@ -1369,9 +1369,27 @@
1.4
1.5 ///\e
1.6 Value primal(Col c) const { return _getPrimal(_lpId(c)); }
1.7 + ///\e
1.8 + Value primal(const Expr& e) const {
1.9 + double res = e.constComp();
1.10 + for (std::map<Col, double>::const_iterator it = e.begin();
1.11 + it != e.end(); ++it) {
1.12 + res += _getPrimal(_lpId(it->first)) * it->second;
1.13 + }
1.14 + return res;
1.15 + }
1.16
1.17 ///\e
1.18 Value dual(Row r) const { return _getDual(_lpId(r)); }
1.19 + ///\e
1.20 + Value dual(const DualExpr& e) const {
1.21 + double res = 0.0;
1.22 + for (std::map<Row, double>::const_iterator it = e.begin();
1.23 + it != e.end(); ++it) {
1.24 + res += _getPrimal(_lpId(it->first)) * it->second;
1.25 + }
1.26 + return res;
1.27 + }
1.28
1.29 ///\e
1.30 bool isBasicCol(Col c) const { return _isBasicCol(_lpId(c)); }