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

How to speed up DStarLite algorithm implementation (improvement) #817

Open
jrmses opened this issue Apr 13, 2023 · 1 comment
Open

How to speed up DStarLite algorithm implementation (improvement) #817

jrmses opened this issue Apr 13, 2023 · 1 comment

Comments

@jrmses
Copy link

jrmses commented Apr 13, 2023

I have been using DStaLite and, in my profiles, most of the time was spent in "is_obstacle" function (13 secs out of 16 in a simple example)
I have found a easy way to improve the time it spends in this critical function. In my laptop (3080) it passed from 16 sec to 3 secs.

You just need to:

change definition of self.obstacles_xy to a dictionary:

self.obstacles_xy = dict(((obstacle.x, obstacle.y),True) for obstacle in self.obstacles)

in "is_obstacle" now do:

def is_obstacle(self, node: Node):

is_in_obstacles= (node.x,node.y) in self.obstacles_xy

is_in_detected_obstacles = False
if self.detected_obstacles_xy.shape[0] > 0:
is_x_equal = self.detected_obstacles_xy[:, 0] == node.x
is_y_equal = self.detected_obstacles_xy[:, 1] == node.y
is_in_detected_obstacles = (is_x_equal & is_y_equal).any()

return is_in_obstacles or is_in_detected_obstacles

@jrmses jrmses changed the title Speed up DStartLite algorithm implementation Speed up DStarLite algorithm implementation Apr 13, 2023
@jrmses jrmses changed the title Speed up DStarLite algorithm implementation How to speed up DStarLite algorithm implementation (improvement) Apr 17, 2023
@AtsushiSakai
Copy link
Owner

AtsushiSakai commented Apr 27, 2023

PR is welcome

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

No branches or pull requests

2 participants