summaryrefslogtreecommitdiff
path: root/impl/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'impl/main.cpp')
-rw-r--r--impl/main.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/impl/main.cpp b/impl/main.cpp
index b761587..26aedbe 100644
--- a/impl/main.cpp
+++ b/impl/main.cpp
@@ -6,6 +6,7 @@
#include "Operator.hpp"
#include "EquationSystem.hpp"
#include "MaxStrategy.hpp"
+#include "ImprovementOperator.hpp"
#include "FixpointAlgorithm.hpp"
extern "C" {
@@ -126,14 +127,17 @@ int main (int argc, char* argv[]) {
}
// PARSE ARGUMENTS - strat improvement
- MaxStrategy<ZBar>::ImprovementOperator* naiveImprovement = new MaxStrategy<ZBar>::NaiveImprovementOperator();
- MaxStrategy<ZBar>::ImprovementOperator* improvement = NULL;
+ ImprovementOperator<ZBar>* naiveImprovement = new NaiveImprovementOperator<ZBar>();
+ ImprovementOperator<ZBar>* improvement = NULL;
if (!strcmp(argv[3], "repeat")) {
- improvement = new MaxStrategy<ZBar>::RepeatedImprovementOperator(*naiveImprovement);
+ improvement = new RepeatedImprovementOperator<ZBar>(*naiveImprovement);
cout << "Repeated strategy improvement" << endl;
} else if (!strcmp(argv[3], "naive")) {
improvement = naiveImprovement;
cout << "Naive strategy improvement" << endl;
+ } else if (!strcmp(argv[3], "smart")) {
+ improvement = new SmartImprovementOperator<ZBar>(system);
+ cout << "Smart strategy improvement" << endl;
} else {
cout << "Unknown strategy improvement algorithm." << endl;
}
@@ -143,7 +147,7 @@ int main (int argc, char* argv[]) {
cout << system << endl;
StableVariableAssignment<ZBar> result(system.variableCount(), infinity<ZBar>());
- MaxStrategy<ZBar> strategy(system);
+ ConcreteMaxStrategy<ZBar> strategy(system);
IdSet<Variable<ZBar> > s1(system.variableCount());
IdSet<Variable<ZBar> > s2(system.variableCount());
bool changed = false;
@@ -159,7 +163,9 @@ int main (int argc, char* argv[]) {
cout << endl;
exit(0);*/
- changed = strategy.improve(*improvement, result, s1, s2);
+ s2.clear();
+ changed = improvement->improve(strategy, result, s1, s2);
+ std::cout << (changed ? "true" : "false") << std::endl;
} while(changed);
cout << endl;