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 CollisionEngine that will cause performance degradation and inaccurate predictions[cite: 1].
Issues Identified
-
$O(N^2)$ Algorithmic Bottleneck:
CollisionEngine.predict_collisions utilizes 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].
-
Logical Flaw in Time of Closest Approach (TCA): The engine currently calculates the distance between objects at the exact instant of
datetime.utcnow(), rather than propagating the trajectories to identify the actual Time of Closest Approach[cite: 1]. Furthermore, the conjunctionTime is hardcoded to now + datetime.timedelta(minutes=12.0) regardless of orbital dynamics[cite: 1].
Steps to reproduce
Steps to Reproduce
- Populate the database with a realistic number of
SpaceObject entries (e.g., > 5,000)[cite: 1].
- Trigger the
run_collision_scanning task[cite: 1].
- Observe the task hanging or timing out due to the unoptimized $O(N^2)$ loop[cite: 1].
- Review generated conjunctions and note the hardcoded
12.0 minute 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
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