LimitSolutions: prevent child compute calls after max_solutions is reached#745
LimitSolutions: prevent child compute calls after max_solutions is reached#745rhaschke merged 2 commits intomoveit:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #745 +/- ##
==========================================
- Coverage 52.89% 52.76% -0.13%
==========================================
Files 138 138
Lines 10641 11288 +647
Branches 1128 1128
==========================================
+ Hits 5628 5955 +327
- Misses 5005 5325 +320
Partials 8 8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
rhaschke
left a comment
There was a problem hiding this comment.
In general looks good. I think the two last checks for forwarded_solutions < max_solutions are redundant and can be dropped - forwarded_solutions doesn't change in between, does it?
No, the wrapper approach here, doesn't allow for this solution either. |
|
Thanks. |
Currently, when
max_solutionsis reached, the child may still continue computing additional solutions. This was not an issue with a simpleGeneratorstage, but with a largeSerialContainerwith multiple nested stages, the computational cost becomes significant.Moreover, these additional solutions are not propagated, since the limit for forwarding solutions has already been reached. Thus, this extra computation is wasted.
With the change proposed in this PR, once the limit of forwarded solutions (
max_solutions) is reached, the child container will stop generating further solutions.For future reference, as discussed here, a better approach might be to relax the
max_solutionsrestriction and allow incremental forwarding of solutions, before the task fails. While limiting solutions helps reduce combinatorial explosion in long tasks, it also risks missing valid alternatives. @rhaschke Do you see a simple way—without major refactoring—to achieve this using the current wrapper implementation?