summaryrefslogtreecommitdiff
path: root/impl/main.cpp
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@carlo-laptop>2012-08-06 22:58:29 +1000
committerCarlo Zancanaro <carlo@carlo-laptop>2012-08-06 22:58:29 +1000
commit42e729d20000eb141b2907ad83630af34f4afea3 (patch)
treee231556126d538d6b61fe099c6245176aeb3df15 /impl/main.cpp
parent77d26a8f2832791587b19351ee1fde207fdda608 (diff)
New variation on the equation system solver.
Much simpler to understand. Basically have a variable assignment which is dynamic and updates with the strategy changes. Similarly have strategy changes easily invalidate the variable assignment. This makes them strongly inter-dependent, but simplifies the implementation considerably. Proving it should be easier like this, too.
Diffstat (limited to 'impl/main.cpp')
-rw-r--r--impl/main.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/impl/main.cpp b/impl/main.cpp
index a6693f0..374d21f 100644
--- a/impl/main.cpp
+++ b/impl/main.cpp
@@ -131,6 +131,7 @@ int main (int argc, char* argv[]) {
EquationSystem<ZBar> system;
treeToSystem<ZBar>(ret.tree, system);
+ /*
// PARSE ARGUMENTS - fixpoint
FixpointAlgorithm<ZBar>* algorithm = NULL;
if (!strcmp(argv[2], "naive")) {
@@ -161,10 +162,11 @@ int main (int argc, char* argv[]) {
if (!improvement || !algorithm) {
exit(1);
}
+ */
log::debug << system << std::endl;
system.indexMaxExpressions(); // make reverse-lookup O(1) instead of O(n)
- StableVariableAssignment<ZBar> result(system.variableCount(), infinity<ZBar>());
+ /*StableVariableAssignment<ZBar> result(system.variableCount(), infinity<ZBar>());
ConcreteMaxStrategy<ZBar> strategy(system);
IdSet<Variable<ZBar>> s1(system.variableCount());
IdSet<Variable<ZBar>> s2(system.variableCount());
@@ -180,18 +182,18 @@ int main (int argc, char* argv[]) {
s2.clear();
changed = improvement->improve(system, strategy, result, s1, s2);
log::debug << "Changed: " << (changed ? "true" : "false") << std::endl;
- } while(changed);
+ } while(changed);*/
+
+
+ DynamicMaxStrategy<ZBar> strategy(system);
+ DynamicVariableAssignment<ZBar> rho(system, strategy);
+ strategy.setRho(rho);
for (unsigned int i = 0, size = system.variableCount(); i < size; ++i) {
Variable<ZBar>& var = system.variable(i);
- cout << var.name() << " = " << result[var] << endl;
+ cout << var.name() << " = " << rho[var] << endl;
}
- delete algorithm;
- if (naiveImprovement != improvement)
- delete improvement;
- delete naiveImprovement;
-
parser -> free(parser);
tokens -> free(tokens);
lex -> free(lex);