diff options
author | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-09-05 10:25:19 +1000 |
---|---|---|
committer | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-09-05 10:25:19 +1000 |
commit | 608cf2e6a2ccc967e82b2b7a9693fd0bafb778fb (patch) | |
tree | 02a4f4136e50af3865df5acefc9174f73004c10a /impl/MaxStrategy.hpp | |
parent | 35d53c78a4afd739d1246db486f2703e44590eda (diff) |
Delete a lot of tex stuff, better debug info
Some other stuff, too, I think. Oh well. No biggie!
Diffstat (limited to 'impl/MaxStrategy.hpp')
-rw-r--r-- | impl/MaxStrategy.hpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/impl/MaxStrategy.hpp b/impl/MaxStrategy.hpp index 8f40c99..d15884c 100644 --- a/impl/MaxStrategy.hpp +++ b/impl/MaxStrategy.hpp @@ -12,6 +12,16 @@ struct MaxStrategy { virtual unsigned int get(const MaxExpression<Domain>& e) const = 0; }; +unsigned int stack_depth = 1; + +std::string indent() { + std::string result = ""; + for (unsigned int i = 0; i < stack_depth; ++i) { + result += '\t'; + } + return result; +} + #include "VariableAssignment.hpp" template<typename Domain> @@ -41,7 +51,7 @@ struct DynamicMaxStrategy : public MaxStrategy<Domain> { } void invalidate(const Variable<Domain>& v) const { - log::strategy << "\tInvalidating " << v << " - " << *_system[v] << std::endl; + log::strategy << indent() << "Invalidating " << v << " - " << *_system[v] << std::endl; _stable.filter(_var_influence[v]); for (auto it = _var_influence[v].begin(); @@ -55,10 +65,12 @@ private: void solve(const MaxExpression<Domain>& x) const { if (!_stable.contains(x)) { _stable.insert(x); - log::strategy << "\tStabilise " << x << std::endl; + log::strategy << indent() << "Stabilise " << x << std::endl; + stack_depth++; unsigned int val = x.bestStrategy(DependencyAssignment(*this, *_rho, x), DependencyStrategy(*this, x)); + stack_depth--; if (val != _values[x]) { log::strategy << x << " => " << *x.arguments()[val] << std::endl; @@ -77,10 +89,10 @@ private: solve(_system.maxExpression(*it)); } } else { - log::strategy << "\t" << x << " did not change" << std::endl; + log::strategy << indent() << x << " did not change" << std::endl; } } else { - log::strategy << "\t" << x << " is stable" << std::endl; + log::strategy << indent() << x << " is stable" << std::endl; } } |