-
Notifications
You must be signed in to change notification settings - Fork 41
[Bug]: $O(N^2)$ Bottleneck and Hardcoded TCA in CollisionEngine #192
Copy link
Copy link
Open
Labels
assignedIndicates that the issue has been assigned to a contributor who is actively working on it.Indicates that the issue has been assigned to a contributor who is actively working on it.backendBackend developmentBackend developmentbugSomething isn't workingSomething isn't workingdatabaseDatabase and schema related changesDatabase and schema related changestype:backendChanges backend services or server-side logic.Changes backend services or server-side logic.type:bugFixes an existing bug or unexpected behavior.Fixes an existing bug or unexpected behavior.
Description
Activity
Metadata
Metadata
Assignees
Labels
assignedIndicates that the issue has been assigned to a contributor who is actively working on it.Indicates that the issue has been assigned to a contributor who is actively working on it.backendBackend developmentBackend developmentbugSomething isn't workingSomething isn't workingdatabaseDatabase and schema related changesDatabase and schema related changestype:backendChanges backend services or server-side logic.Changes backend services or server-side logic.type:bugFixes an existing bug or unexpected behavior.Fixes an existing bug or unexpected behavior.
Bug description
[Performance/Bug]:$O(N^2)$ Bottleneck and Hardcoded TCA in CollisionEngine
Description
As an ECSoC'26 contributor reviewing the orbital engine logic (referencing the file kepler.pdf verbatim), I found major architectural and logical flaws in the
CollisionEnginethat will cause performance degradation and inaccurate predictions[cite: 1].Issues Identified
CollisionEngine.predict_collisionsutilizes a nested loop to calculate distances between every single object pair in the catalog (for i in range(len(propagated)):...for j in range(i + 1, len(propagated)):)[cite: 1]. For a catalog of thousands of satellites and debris, this results in hundreds of millions of distance calculations, severely bottlenecking the system[cite: 1].datetime.utcnow(), rather than propagating the trajectories to identify the actual Time of Closest Approach[cite: 1]. Furthermore, theconjunctionTimeis hardcoded tonow + datetime.timedelta(minutes=12.0)regardless of orbital dynamics[cite: 1].Steps to reproduce
Steps to Reproduce
SpaceObjectentries (e.g., > 5,000)[cite: 1].run_collision_scanningtask[cite: 1].12.0minute forward projection[cite: 1].Expected behavior
Expected Behavior
The engine utilizes a broad-phase spatial filter or orbital plane pre-filtering to scale efficiently for thousands of objects[cite: 1]. It dynamically propagates orbits forward in time to calculate the true Time of Closest Approach (TCA)[cite: 1].
Actual behavior
Actual Behavior
The engine uses a deeply nested loop to evaluate distances for every possible object pair, resulting in an$O(N^2)$ bottleneck[cite: 1]. Additionally, it calculates the distance between objects at the exact instant of
datetime.utcnow()and simply hardcodes the future conjunction time to exactly 12 minutes later (now + datetime.timedelta(minutes=12.0)) regardless of actual orbital dynamics[cite: 1].Screenshots or recordings
No response
Platform
Backend
Environment
No response
Error messages or logs
Difficulty
None
Priority
None
Additional information
No response