Skip to content

Conversation

@TahaZahid05
Copy link

@TahaZahid05 TahaZahid05 commented Dec 27, 2025

Reference issue

Fixes #1333

What does this implement/fix?

This PR optimizes the D* Lite algorithm by replacing the list-based priority queue with a heapq-based implementation using lazy deletion.

Performance improvements:

  • Priority queue operations: O(n log n) → O(log n)
  • Node lookup: O(n) → O(1)

Changes:

  • Implement min-heap priority queue using heapq
  • Add lazy deletion pattern with entry_finder dictionary
  • Add __eq__ and __hash__ methods to Node class for proper dictionary operations
  • Add comprehensive docstrings to new priority queue methods
  • Update unit tests to verify path finding with dynamic obstacles

Compatibility:

  • Uses only standard library (heapq) - no new dependencies
  • Maintains identical algorithm behavior and visualization
  • All existing functionality preserved

Additional information

The optimization significantly improves scalability for larger grids and scenarios with frequent obstacle updates, while maintaining the exact same algorithm behavior and API.

CheckList

  • Did you add an unittest for your new example or defect fix?
  • Did you add documents for your new example?
  • All CIs are green? (You can check it after submitting)

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.

[Optimization] Enhancing D* Lite performance using heapq and lazy deletion

1 participant