diff options
author | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-16 13:26:07 +1100 |
---|---|---|
committer | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-16 13:26:07 +1100 |
commit | 18a747edd76918e2a1a4fb608b2d3923fcc535fa (patch) | |
tree | bdb46b63234a649a32c8db36e4e232dbfff5730b | |
parent | 697c1c0cd3815eee72b3eedb874fe0e044a69432 (diff) |
A quick fix to the solver.
-rw-r--r-- | impl/Expression.hpp | 8 | ||||
-rw-r--r-- | impl/VariableAssignment.hpp | 12 | ||||
-rw-r--r-- | impl/gmon.out | bin | 78165 -> 76225 bytes | |||
-rw-r--r-- | impl/systems/gmon.out | bin | 79219 -> 75981 bytes | |||
-rw-r--r-- | impl/systems/test.eqns | 24 |
5 files changed, 28 insertions, 16 deletions
diff --git a/impl/Expression.hpp b/impl/Expression.hpp index 00bc9cd..0d48d70 100644 --- a/impl/Expression.hpp +++ b/impl/Expression.hpp @@ -27,6 +27,10 @@ struct Expression { return NULL; } + virtual MaxExpression<Domain>* toMaxExpression() { + return NULL; + } + virtual Domain eval(const VariableAssignment<Domain>&) const = 0; virtual Domain eval(const VariableAssignment<Domain>& rho, const MaxStrategy<Domain>&) const { @@ -145,6 +149,10 @@ struct MaxExpression : public OperatorExpression<Domain> { MaxExpression(const unsigned int& id, const Maximum<Domain>& op, const std::vector<Expression<Domain>*>& arguments) : OperatorExpression<Domain>(op, arguments), _id(id) { } + MaxExpression* toMaxExpression() { + return this; + } + const MaxExpression* toMaxExpression() const { return this; } diff --git a/impl/VariableAssignment.hpp b/impl/VariableAssignment.hpp index ae5efd7..a9247b5 100644 --- a/impl/VariableAssignment.hpp +++ b/impl/VariableAssignment.hpp @@ -38,8 +38,16 @@ struct DynamicVariableAssignment : public VariableAssignment<Domain> { if (_stable.contains(x)) { _stable.remove(x); _values[x] = infinity<Domain>(); - - solve(x); + + IdSet<Variable<Domain> > infl = _influence[x]; + _influence[x].clear(); + for (typename IdSet<Variable<Domain> >::iterator + it = infl.begin(), + ei = infl.end(); + it != ei; + ++it) { + invalidate(_system.variable(*it)); + } } } diff --git a/impl/gmon.out b/impl/gmon.out Binary files differindex aff812c..f33c245 100644 --- a/impl/gmon.out +++ b/impl/gmon.out diff --git a/impl/systems/gmon.out b/impl/systems/gmon.out Binary files differindex 3240978..b5abe0e 100644 --- a/impl/systems/gmon.out +++ b/impl/systems/gmon.out diff --git a/impl/systems/test.eqns b/impl/systems/test.eqns index fb23f1e..af18a57 100644 --- a/impl/systems/test.eqns +++ b/impl/systems/test.eqns @@ -1,16 +1,12 @@ i-4[0] = max(-inf, 0) -neg-i4[0] = max(-inf, 0) -neg-i1-pre = max(-inf, guard(add(min(neg-i4[0], inf), min(i-4[0], inf)), 0, neg-i4[0]), guard(add(min(neg-i2-pre, inf), min(i-2-pre, inf)), 0, neg-i2-pre)) -i-1-pre = max(-inf, guard(add(min(neg-i4[0], inf), min(i-4[0], inf)), 0, i-4[0]), guard(add(min(neg-i2-pre, inf), min(i-2-pre, inf)), 0, i-2-pre)) -neg-i3-pre = max(-inf, guard(add(min(neg-i1-pre, inf), min(i-1-pre, 2)), 0, neg-i1-pre)) -i-3-pre = max(-inf, guard(add(min(neg-i1-pre, inf), min(i-1-pre, 2)), 0, min(2, i-1-pre))) -neg-i0-pre = max(-inf, guard(add(min(neg-i1-pre, -3), min(i-1-pre, inf)), 0, min(-3, neg-i1-pre))) -i-0-pre = max(-inf, guard(add(min(neg-i1-pre, -3), min(i-1-pre, inf)), 0, i-1-pre)) +negi-4[0] = max(-inf, 0) +negi-1-pre = max(-inf, guard(add(min(negi-4[0], inf), min(i-4[0], inf)), 0, negi-4[0]), guard(add(min(negi-2-pre, inf), min(i-2-pre, inf)), 0, negi-2-pre)) +i-1-pre = max(-inf, guard(add(min(negi-4[0], inf), min(i-4[0], inf)), 0, i-4[0]), guard(add(min(negi-2-pre, inf), min(i-2-pre, inf)), 0, i-2-pre)) +negi-3-pre = max(-inf, guard(add(min(negi-1-pre, inf), min(i-1-pre, 2)), 0, negi-1-pre)) +i-3-pre = max(-inf, guard(add(min(negi-1-pre, inf), min(i-1-pre, 2)), 0, min(2, i-1-pre))) +negi-0-pre = max(-inf, guard(add(min(negi-1-pre, -3), min(i-1-pre, inf)), 0, min(-3, negi-1-pre))) +i-0-pre = max(-inf, guard(add(min(negi-1-pre, -3), min(i-1-pre, inf)), 0, i-1-pre)) i-3[0] = max(-inf, add(0, i-3-pre)) -neg-i3[0] = max(-inf, add(0, neg-i3-pre)) -neg-i2-pre = max(-inf, guard(add(min(neg-i3[0], inf), min(i-3[0], inf)), 0, neg-i3[0])) -i-2-pre = max(-inf, guard(add(min(neg-i3[0], inf), min(i-3[0], inf)), 0, i-3[0])) -x = max(-inf, 0) -y = max(-inf, x, z) -z = max(-inf, y) - +negi-3[0] = max(-inf, add(0, negi-3-pre)) +negi-2-pre = max(-inf, guard(add(min(negi-3[0], inf), min(i-3[0], inf)), 0, negi-3[0])) +i-2-pre = max(-inf, guard(add(min(negi-3[0], inf), min(i-3[0], inf)), 0, i-3[0])) |