summaryrefslogtreecommitdiff
path: root/impl/main.cpp
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@carlo-laptop>2012-04-06 14:02:26 +1000
committerCarlo Zancanaro <carlo@carlo-laptop>2012-04-06 14:02:26 +1000
commit5d7252681da3b26845fc4e5dcf0b0e94ed9fabb1 (patch)
tree20bc0a6b62390aabda0b8c446d3a2177990863f6 /impl/main.cpp
parent83e2c574bdefe2d040cdfbe20a73380a0f0123dd (diff)
Move everything into impl/ and add a Makefile.
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;
+}