diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2022-10-11 14:25:11 +0200 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2022-10-11 14:25:11 +0200 |
commit | 6308773c0b6b745d49d20dc2afd6ab7ec63cb996 (patch) | |
tree | a60fc6397eed84b5286bd22952d7331489e70b15 /aztec.cpp | |
parent | 2083cff9581c3953ebdfa9a9ff951016c0ffc8b5 (diff) | |
download | code-6308773c0b6b745d49d20dc2afd6ab7ec63cb996.tar.gz code-6308773c0b6b745d49d20dc2afd6ab7ec63cb996.tar.bz2 code-6308773c0b6b745d49d20dc2afd6ab7ec63cb996.zip |
Refactoring.
Diffstat (limited to 'aztec.cpp')
-rw-r--r-- | aztec.cpp | 18 |
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); +} |