summaryrefslogtreecommitdiff
path: root/impl/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'impl/main.cpp')
-rw-r--r--impl/main.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/impl/main.cpp b/impl/main.cpp
new file mode 100644
index 0000000..814a3ee
--- /dev/null
+++ b/impl/main.cpp
@@ -0,0 +1,36 @@
+#include "Constant.h"
+#include "Variable.h"
+#include "Min.h"
+#include "Max.h"
+#include "Sum.h"
+#include "Equation.h"
+#include "EquationSystem.h"
+
+#include <iostream>
+
+using namespace std;
+
+int main() {
+ std::map<std::string, int> mappings;
+ mappings["x"] = 10;
+
+ Equation<int> e(Variable<int>("x"),
+ new Max<int>(
+ new Min<int>(
+ new Constant<int>(100),
+ new Sum<int>(
+ new Variable<int>("x"),
+ new Constant<int>(100))),
+ new Constant<int>(20)));
+
+ Equation<int> e2(Variable<int>("x"),
+ new Constant<int>(200));
+
+ EquationSystem<int> es;
+ es.add(e);
+ es.add(e2);
+ std::map<std::string, int> result = es.solve(mappings);
+ cout << result["x"] << endl;
+
+ return 0;
+}