From 8c7de1fc64e2ef1994b558f223e0e77fb1395539 Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Fri, 2 Nov 2012 16:11:39 +1100 Subject: Change to using "touched" sets, and some writing. --- impl/MaxStrategy.hpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'impl/MaxStrategy.hpp') diff --git a/impl/MaxStrategy.hpp b/impl/MaxStrategy.hpp index 6fee921..1b471e0 100644 --- a/impl/MaxStrategy.hpp +++ b/impl/MaxStrategy.hpp @@ -132,7 +132,7 @@ private: struct DependencyAssignment : public VariableAssignment{ DependencyAssignment(DynamicMaxStrategy& strat, - VariableAssignment& rho, + DynamicVariableAssignment& rho, const MaxExpression& expr) : _strat(strat), _rho(rho), @@ -144,11 +144,23 @@ private: // recursive magic! _strat.solve(*_strat._system[var]); _strat._influence[*_strat._system[var]].insert(_expr); - return _rho[var]; + + // force evaluation to get touched variables + Domain value = _rho[var]; + // invalidate touched variables + IdSet > changed = _rho.get_changed(); + for (typename IdSet >::iterator + it = changed.begin(), + ei = changed.end(); + it != ei; + ++it) { + _strat.invalidate(_strat._system.variable(*it)); + } + return value; } private: DynamicMaxStrategy& _strat; - VariableAssignment& _rho; + DynamicVariableAssignment& _rho; const MaxExpression& _expr; IdSet > _current; }; -- cgit v1.2.3