Rewrite TSP solver for improved path optimization and clarity
- Completely re-implemented the TSP algorithm in C++ for better path quality - Added detailed comments and documentation to clarify each step - Improved nearest neighbor, 2-opt, and relocation logic - Enhanced handling of start/end point constraints - Updated PathUtils.py docstring to accurately describe start point behavior
This commit is contained in:
@@ -626,7 +626,8 @@ def sort_locations_tsp(locations, keys, attractors=None, startPoint=None, endPoi
|
||||
- endPoint: Optional ending point [x, y]
|
||||
|
||||
Returns the sorted list of locations in TSP order.
|
||||
If startPoint is None, path starts from the first point in the original order.
|
||||
If startPoint is None, the path is optimized to start near the first point in the original list,
|
||||
but may not start exactly at that point.
|
||||
"""
|
||||
# Extract points from locations
|
||||
points = [(loc[keys[0]], loc[keys[1]]) for loc in locations]
|
||||
|
||||
Reference in New Issue
Block a user