summaryrefslogtreecommitdiff
path: root/impl/main.cpp
blob: 6f84cdd2ffb4fc03483aa2d4ad1c8c6afa6a701c (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <iostream>
#include <vector>
#include <math.h>

#include "Operator.hpp"
#include "Expression.hpp"
#include "EquationSystem.hpp"
#include "MaxStrategy.hpp"

using namespace std;

/*template<typename T>
struct Complete {
  Complete(const T& value)
    : _value(value) { }
  private:
  bool _infinity;
  T _value;
};*/

std::vector< Expression<float>* > empty;
int main () {
  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);

  std::vector<Expression<float>*> args;
  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[*maxExpression] = 0;
  cout << strat(*maxExpression,rho) << endl;

  fac[*x] = minExpression;
  fac[*y] = minExpression;
  cout << fac.maxFixpoint()[*x] << endl;
  return 0;
}