Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Further optimize st-a* true heuristic #91

Closed
Elucidation opened this issue Jun 19, 2023 · 5 comments
Closed

Further optimize st-a* true heuristic #91

Elucidation opened this issue Jun 19, 2023 · 5 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@Elucidation
Copy link
Owner

check that true heuristic weighting appropriately causes A* to go along path without branching out more than necessary

@Elucidation
Copy link
Owner Author

Right now the score is based solely on the heuristic, which isn't exactly A* but more of a optimized DFS that when using the true heuristic becomes A* with no obstacles (since the true heuristic is A*).

Elucidation added a commit that referenced this issue Jun 19, 2023
@Elucidation
Copy link
Owner Author

Elucidation commented Jun 19, 2023

Collecting some logs from before/after the change, we can see

image

Local test run scatter plot comparing # of cells visited versus duration of generate path (ms) before and after change 455576f shows that despite the number of cells visited increasing, the overall search time decreases.

This is a bit counter-intuitive, as I'd expect total search time to be positively correlated (linear or quadratic) with number of cells visited. On further inspection, looking at path length we see our answer

image

Here, clearly path length is strongly correlated with total generate path time.

It looks like with the proper scoring system, we no longer fall into extremely!! (1000+) long path length searches from before vs after.
This means before with our DFS-like search we were getting trapped in long crazy routes when trying to follow the true heuristic, since st-astar allows searching with no motion except time, likely this involves paths where the robot waits in place for long periods of time until the true heuristic path is available.

We can see this in the histograms of generate_path times before/after

image

@Elucidation
Copy link
Owner Author

Elucidation commented Jun 19, 2023

Changes pushed to GCE instance at 11:30am and running for a couple hours, we see a dramatic improvement in generate path times as expected (top-left heat 2D histogram in logy mode).
The rate at which items are being added appears to be slightly better (~0.53/s vs ~0.51/s), CPU utilization after the change spike has returned to better than before

image

Notably, the memory used doesn't appear to have changed

@Elucidation Elucidation added bug Something isn't working enhancement New feature or request labels Jun 19, 2023
@Elucidation Elucidation self-assigned this Jun 19, 2023
@Elucidation
Copy link
Owner Author

Elucidation commented Jun 19, 2023

The improvement here is drastic, the 99th percentile of generate_paths has dropped from ~80ms to ~5.5ms, more than a 10x improvement.

image

image

This means 99% of the time up to 90 robots could be processed at once, and in practice more. This will allow us to start scaling up the size of the warehouse.

It doesn't appear the mean time has increased either, despite the number of visited cells likely increasing. The benefit of optimal paths outweighs the DFS-like nature of the previous algorithm dramatically.

@Elucidation
Copy link
Owner Author

Running on dev machine, can easily scale up to ~220 robots, after the front-loaded path-finding, which scales at around ~30 path searches per ~100ms (the arbitrary threshold used), it is able to run all 220 robots per cycle since not every robot is searching for a path at the same time. This comes out to a mean ~3.3ms per generate path, at the initial bump.

2023-06-19 12:36:27 2023-06-19 19:36:27,719 - robot_allocator - INFO - update end, took 116.401 ms, processed 30/222 jobs, assigned 0/0 available robots to 1 available tasks

image

Because the path finding duration is much more stable and low now, this sets the stage for parceling out processing tasks to worker nodes to scale up for larger quantities of robots nicely.

@Elucidation Elucidation pinned this issue Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant