summaryrefslogtreecommitdiff
path: root/impl/EquationSystem.hpp
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@carlo-laptop>2012-08-07 17:01:57 +1000
committerCarlo Zancanaro <carlo@carlo-laptop>2012-08-07 17:01:57 +1000
commitc26f38114fedde81effb938ffbedfe922d77a322 (patch)
treef5c637526607507e2861ab8bce69d49e89a4f541 /impl/EquationSystem.hpp
parent42e729d20000eb141b2907ad83630af34f4afea3 (diff)
A whole bunch of clean up work around the place.
- Make it a bit nicer to use the command-line - Remove the strategies we won't be using - Clean up some code around the place, generally
Diffstat (limited to 'impl/EquationSystem.hpp')
-rw-r--r--impl/EquationSystem.hpp32
1 files changed, 1 insertions, 31 deletions
diff --git a/impl/EquationSystem.hpp b/impl/EquationSystem.hpp
index 4bae53a..4c55bd7 100644
--- a/impl/EquationSystem.hpp
+++ b/impl/EquationSystem.hpp
@@ -88,32 +88,6 @@ struct EquationSystem {
return _right_sides[var.id()];
}
- StableVariableAssignment<Domain>* assignment(const Domain& value) const {
- return new StableVariableAssignment<Domain>(_variables.size(), value);
- }
- StableVariableAssignment<Domain>* eval(const VariableAssignment<Domain>& rho) const {
- StableVariableAssignment<Domain>* result = this->assignment(-infinity<Domain>());
- for (unsigned int i = 0, length = _variables.size();
- i < length;
- ++i) {
- const Variable<Domain>& var = *_variables[i];
- const Expression<Domain>& expr = * (*this)[var];
- (*result)[var] = expr.eval(rho);
- }
- return result;
- }
- StableVariableAssignment<Domain>* eval(const VariableAssignment<Domain>& rho, const MaxStrategy<Domain>& strat) const {
- StableVariableAssignment<Domain>* result = this->assignment(-infinity<Domain>());
- for (unsigned int i = 0, length = _variables.size();
- i < length;
- ++i) {
- const Variable<Domain>& var = *_variables[i];
- const Expression<Domain>& expr = * (*this)[var];
- (*result)[var] = expr.eval(rho, strat);
- }
- return result;
- }
-
void indexMaxExpressions() {
_expr_to_var = new IdMap<MaxExpression<Domain>,Variable<Domain>*>(maxExpressionCount(), NULL);
for (unsigned int i = 0, length = _right_sides.size(); i < length; ++i) {
@@ -130,11 +104,7 @@ struct EquationSystem {
return NULL;
}
} else {
- for (unsigned int i = 0, length = _right_sides.size(); i < length; ++i) {
- if (_right_sides[i] == &expr)
- return _variables[i];
- }
- return NULL;
+ throw "Must index max expressions before attempting lookup";
}
}