#include #include #include #include "Operator.hpp" #include "Expression.hpp" #include "EquationSystem.hpp" #include "MaxStrategy.hpp" using namespace std; /*template struct Complete { Complete(const T& value) : _value(value) { } private: bool _infinity; T _value; };*/ typedef std::vector*> Args; typedef Expression E; typedef Constant C; typedef Minimum Min; std::vector< Expression* > empty; int main () { EquationSystem sys; Variable* x = sys.newVariable("x"); Args incArgs; incArgs.push_back(new E(x, empty)); Args minArgs; minArgs.push_back(new E(new Increment, incArgs)); minArgs.push_back(new E(new C(100), empty)); Args maxArgs; maxArgs.push_back(new E(new C(0), empty)); maxArgs.push_back(new E(new Min(), minArgs)); sys[*x] = sys.newMaxExpression(maxArgs); // x = max(0, min(x+1, 100)) cout << sys.minFixpoint()[*x] << endl; // -> 100, as expected return 0; }