summaryrefslogtreecommitdiff
path: root/aztec.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'aztec.cpp')
-rw-r--r--aztec.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/aztec.cpp b/aztec.cpp
new file mode 100644
index 0000000..12197d9
--- /dev/null
+++ b/aztec.cpp
@@ -0,0 +1,18 @@
+#include "aztec.hpp"
+
+PerfectMatching findGroundState(const AztecDiamond& a) {
+ PerfectMatching pm(a.vertices.size(), a.edges.size());
+
+ for (const AztecDiamond::Edge& e : a.edges) {
+ pm.AddEdge(e.head->index, e.tail->index, e.weight);
+ }
+
+ pm.options.verbose = false;
+ pm.Solve();
+
+ return pm;
+}
+
+bool edgeMatched(PerfectMatching& pm, const AztecDiamond::Edge& e) {
+ return e.tail->index == pm.GetMatch(e.head->index);
+}