From 26f679bd8e9d91dc03e3c7782d390a2f2b92e245 Mon Sep 17 00:00:00 2001 From: Robert Haschke Date: Thu, 16 May 2019 18:12:01 +0200 Subject: [PATCH] relax assertion --- core/src/container.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/core/src/container.cpp b/core/src/container.cpp index 5114a35a..1a702d94 100644 --- a/core/src/container.cpp +++ b/core/src/container.cpp @@ -304,8 +304,19 @@ struct SolutionCollector { SolutionCollector(size_t max_depth) : max_depth(max_depth) {} void operator()(const SolutionSequence::container_type& trace, double cost) { - // traced path should not extend past container boundaries - assert(trace.size() <= max_depth); +#ifndef NDEBUG + // Traced path should not extend past container boundaries, i.e. trace.size() <= max_depth + // However, as the Merging-Connect's solution may be composed of several subsolutions, we need to disregard those + size_t len = trace.size(); + const StagePrivate* prev_creator = nullptr; + for (const auto& s : trace) { + if (s->creator() == prev_creator) + --len; + else + prev_creator = s->creator(); + } + assert(len <= max_depth); +#endif solutions.emplace_back(std::make_pair(trace, cost)); }