diff options
Diffstat (limited to 'hungarian.cpp')
-rw-r--r-- | hungarian.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/hungarian.cpp b/hungarian.cpp index 00cc91d..b8cb7ab 100644 --- a/hungarian.cpp +++ b/hungarian.cpp @@ -75,7 +75,7 @@ public: } } bool isTight() const { - return std::abs(s->y + t->y - weight) < 1e-10; + return std::abs(s->y + t->y - weight) < 1e-13; } }; @@ -166,10 +166,10 @@ public: if (e.isTight() && (e.head().index == i && !e.inPath)) { if (!e.tail().inMatching()) { break; + } else { + e.inPath= true; + path.push({e.tail().neighbors.begin(), e.tail().neighbors.end(), e.tail().index}); } - - e.inPath= true; - path.push({e.tail().neighbors.begin(), e.tail().neighbors.end(), e.tail().index}); } else { it++; path.top() = {it, itEnd, i}; @@ -177,12 +177,6 @@ public: } } - - if (path.empty()) { - exit(1); - } - - while (!path.empty()) { auto [it, itEnd, i] = path.top(); Edge& e = it->get(); |