From 6f49860389b973bf0ec58cdefc63cda41f432d1c Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Mon, 5 Nov 2012 18:14:23 +1100 Subject: Remove a bit of junk and fix up the logging again. --- impl/MaxStrategy.hpp | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) (limited to 'impl/MaxStrategy.hpp') diff --git a/impl/MaxStrategy.hpp b/impl/MaxStrategy.hpp index 1b471e0..32f3e32 100644 --- a/impl/MaxStrategy.hpp +++ b/impl/MaxStrategy.hpp @@ -20,7 +20,7 @@ unsigned int stack_depth = 1; std::string indent() { std::string result = ""; for (unsigned int i = 0; i < stack_depth; ++i) { - result += ' '; + result += '\t'; } return result; } @@ -57,19 +57,6 @@ struct DynamicMaxStrategy : public MaxStrategy { return _values[e]; } - void invalidate(const Variable& v) { - log::strategy << indent() << "Invalidating " << v << " - " << *_system[v] << std::endl; - - IdSet > infl = _influence[*_system[v]]; - for (typename IdSet >::iterator - it = infl.begin(), - end = infl.end(); - it != end; - ++it) { - invalidate(_system.maxExpression(*it)); - } - } - void invalidate(const MaxExpression& v) { if (_stable.contains(v)) { log::strategy << indent() << "Invalidating " << v << std::endl; @@ -90,7 +77,6 @@ struct DynamicMaxStrategy : public MaxStrategy { private: void solve(const MaxExpression& x) { if (!_stable.contains(x)) { - std::cerr << indent() << x.id() << std::endl; _stable.insert(x); log::strategy << indent() << "Stabilise " << x << std::endl; @@ -101,7 +87,6 @@ private: stack_depth--; if (val != _values[x]) { - std::cerr << indent() << "-" << std::endl; log::strategy << x << " => " << *x.arguments()[val] << std::endl; _values[x] = val; @@ -140,13 +125,11 @@ private: _current(strat._system.variableCount()) { } const Domain operator[](const Variable& var) { - // solve the strategy for this variable, too - // recursive magic! - _strat.solve(*_strat._system[var]); - _strat._influence[*_strat._system[var]].insert(_expr); - // force evaluation to get touched variables Domain value = _rho[var]; + + _strat._influence[*_strat._system[var]].insert(_expr); + // invalidate touched variables IdSet > changed = _rho.get_changed(); for (typename IdSet >::iterator @@ -154,7 +137,7 @@ private: ei = changed.end(); it != ei; ++it) { - _strat.invalidate(_strat._system.variable(*it)); + _strat.invalidate(*_strat._system[_strat._system.variable(*it)]); } return value; } -- cgit v1.2.3