Fix island discovery with multiple coupled trees#3088
Open
Ashutosh0x wants to merge 1 commit intogoogle-deepmind:mainfrom
Open
Fix island discovery with multiple coupled trees#3088Ashutosh0x wants to merge 1 commit intogoogle-deepmind:mainfrom
Ashutosh0x wants to merge 1 commit intogoogle-deepmind:mainfrom
Conversation
When a constraint row involves multiple trees (e.g., in a complex tendon equality), the number of edges added to the adjacency graph can exceed the number of non-zeros in the Jacobian row. This change increases the size of the temporary edge array to 2*nJ edges (4*nJ integers), ensuring sufficient space for graph construction. Fixes google-deepmind#3073
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This Pull Request fixes a crash in the MuJoCo engine when loading models with equality constraints that couple many bodies (e.g., complex tendon equalities).
The Problem
During island discovery, the engine builds an adjacency graph of bodies (trees). The temporary edge array was sized to hold at most
J (number of non-zeros in the constraint Jacobian) edges. However, when a single constraint row involves $ distinct trees, it can contribute up to (k-1)$ edges to the graph. If (k-1) > k$, the edge array can be too small even if \le nJ$.
The Fix
Increased the size of the temporary edge array from
J edges to 2nJ edges (and 4nJ integers). This provides a safe upper bound for any configuration of constraints.
Fixes #3073