summaryrefslogtreecommitdiff
path: root/impl/main.cpp
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@carlo-laptop>2012-10-23 15:16:31 +1100
committerCarlo Zancanaro <carlo@carlo-laptop>2012-10-23 15:16:31 +1100
commit3002319eb5fd6b3eff0ffa764534bb571536a08c (patch)
treec2f79591a54aff370b34717ebf50358f62d4bda4 /impl/main.cpp
parenta1b28d756fe52a53d9d4da4d23853969fd529115 (diff)
parent14c0c8bb717a668084cae8cd4b359ffd6fca73b0 (diff)
Merge branch 'master' of https://bitbucket.org/czan/honours
Conflicts: .gitignore impl/MaxStrategy.hpp impl/VariableAssignment.hpp impl/systems/test.eqns impl/test/7.eqns
Diffstat (limited to 'impl/main.cpp')
-rw-r--r--impl/main.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/impl/main.cpp b/impl/main.cpp
index b547c48..02faca5 100644
--- a/impl/main.cpp
+++ b/impl/main.cpp
@@ -140,6 +140,20 @@ int main (int argc, char* argv[]) {
log::debug << system << endl;
system.indexMaxExpressions(); // make reverse-lookup O(1) instead of O(n)
+ IdMap<Variable<ZBar>,ZBar> result = solve_for(system);
+ if (variables.size() > 0) {
+ for (unsigned int i = 0, size = system.variableCount(); i < size; ++i) {
+ Variable<ZBar>& var = system.variable(i);
+ if (variables.find(var.name()) != variables.end())
+ cout << var.name() << " = " << result[var] << endl;
+ }
+ } else {
+ for (unsigned int i = 0, size = system.variableCount(); i < size; ++i) {
+ Variable<ZBar>& var = system.variable(i);
+ cout << var.name() << " = " << result[var] << endl;
+ }
+ }
+ /*
DynamicMaxStrategy<ZBar> strategy(system);
DynamicVariableAssignment<ZBar> rho(system, strategy);
strategy.setRho(rho);
@@ -157,6 +171,7 @@ int main (int argc, char* argv[]) {
cout << var.name() << " = " << rho[var].asKnown() << endl;
}
}
+ */
parser -> free(parser);
tokens -> free(tokens);