summaryrefslogtreecommitdiff
path: root/impl/main.cpp
diff options
context:
space:
mode:
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;
}