Skip to content

LimitSolutions: prevent child compute calls after max_solutions is reached#745

Merged
rhaschke merged 2 commits intomoveit:masterfrom
DaniGarciaLopez:master
Apr 23, 2026
Merged

LimitSolutions: prevent child compute calls after max_solutions is reached#745
rhaschke merged 2 commits intomoveit:masterfrom
DaniGarciaLopez:master

Conversation

@DaniGarciaLopez
Copy link
Copy Markdown
Contributor

Currently, when max_solutions is reached, the child may still continue computing additional solutions. This was not an issue with a simple Generator stage, but with a large SerialContainer with 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_solutions restriction 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?

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.76%. Comparing base (a7e3961) to head (410d305).
⚠️ Report is 2 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@rhaschke rhaschke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Comment thread core/src/stages/limit_solutions.cpp Outdated
Comment thread core/src/stages/limit_solutions.cpp Outdated
@rhaschke
Copy link
Copy Markdown
Contributor

For future reference, as discussed here, a better approach might be to allow incremental forwarding of solutions. @rhaschke Do you see a simple way—without major refactoring—to achieve this using the current wrapper implementation?

No, the wrapper approach here, doesn't allow for this solution either.

@rhaschke rhaschke merged commit 4b94350 into moveit:master Apr 23, 2026
5 of 8 checks passed
@rhaschke
Copy link
Copy Markdown
Contributor

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants