summaryrefslogtreecommitdiff
path: root/impl/main.cpp
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@carlo-laptop>2012-04-27 13:33:58 +1000
committerCarlo Zancanaro <carlo@carlo-laptop>2012-04-27 13:33:58 +1000
commit2c22cee1f8fa87c527449a8bdc668ea311fdaf64 (patch)
tree561d7cc1193765418d402c2265aeb39837c101a7 /impl/main.cpp
parent76a4f0fcf3a9bf54ef910cdb2c0bebea37182391 (diff)
Bit more work. maxFixpoint should be working now.
Diffstat (limited to 'impl/main.cpp')
-rw-r--r--impl/main.cpp33
1 files changed, 20 insertions, 13 deletions
diff --git a/impl/main.cpp b/impl/main.cpp
index 589a1e7..6f84cdd 100644
--- a/impl/main.cpp
+++ b/impl/main.cpp
@@ -4,6 +4,7 @@
#include "Operator.hpp"
#include "Expression.hpp"
+#include "EquationSystem.hpp"
#include "MaxStrategy.hpp"
using namespace std;
@@ -19,22 +20,28 @@ struct Complete {
std::vector< Expression<float>* > empty;
int main () {
- Variable<float> x;
- x.id(0);
- Variable<float> y;
- y.id(1);
+ EquationSystem<float> fac;
+ Variable<float>* x = fac.newVariable("x");
+ Variable<float>* y = fac.newVariable("y");
VariableAssignment<float> rho(2);
- rho[x] = 12;
- rho[y] = 10;
- Expression<float> expr(&x, empty);
+ rho[*x] = 12;
+ rho[*y] = 10;
+ Expression<float> expr(x, empty);
std::vector<Expression<float>*> args;
- args.push_back(new Expression<float>(&x, empty));
- args.push_back(new Expression<float>(&y, empty));
- MaxExpression<float> maxExpr(args);
- maxExpr.id(0);
+ args.push_back(new Expression<float>(x, empty));
+ args.push_back(new Expression<float>(y, empty));
+ args.push_back(new Expression<float>(new Constant<float>(10), empty));
+ MaxExpression<float>* maxExpression = fac.newMaxExpression(args);
+ Expression<float>* minExpression = new Expression<float>(new Minimum<float>(), args);
+
+
MaxStrategy<float> strat(1);
- strat[maxExpr] = 0;
- cout << strat(maxExpr,rho) << endl;
+ strat[*maxExpression] = 0;
+ cout << strat(*maxExpression,rho) << endl;
+
+ fac[*x] = minExpression;
+ fac[*y] = minExpression;
+ cout << fac.maxFixpoint()[*x] << endl;
return 0;
}