Path Finding Algorithm [A* Algorithm]

แชร์
ฝัง
  • เผยแพร่เมื่อ 30 พ.ค. 2024
  • I demonstrate how the A* algorithm works, how I implemented it, and show some interesting findings that I discovered along the way!
    ----------------------------------------------------------------------------------------------------------------
    Thanks for watching! Please leave your comments below, I'd love to hear them! I should have my next video up next week!
    ----------------------------------------------------------------------------------------------------------------
    Music: www.bensound.com
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 46

  • @funkyb6598
    @funkyb6598 6 ปีที่แล้ว +4

    Thank you! You broke down something complex into something simple. I have been struggling with A*. But after your explanation, I'm going to try again : )

  • @andriyyavorskyy1169
    @andriyyavorskyy1169 7 ปีที่แล้ว +2

    this is the best video explaining a *

  • @odinoczka
    @odinoczka 6 ปีที่แล้ว +9

    What you have failed to mention, which is very important, is:
    1. H(v) is a an *estimation* of distance between the current node and the target node.
    2. There is a set of requirements for H(v) function to ensure it is finding the correct (optimal) path in the graph. These are:
    a) H(v) is a (and this is a term I had to make up, cause I dont know the translation from polish - excuse me) is a low threshold estimate of the distance (which basically means, that for every node in the graph, H(v) is smaller or equal to the G'(v) - where G' stand for the summary cost of shortest path between the node v and target node)
    b) H(v) is monotonous - for each edge H(u)

    • @etbilu6265
      @etbilu6265 2 ปีที่แล้ว

      PLEASE !Would please recommend ME a BOOK ? I WANT LEARN YOUR EXPLANATION BUT GRAPH IS SO HARD ! THANKS IN ADVANCE

  • @chrislzm
    @chrislzm 6 ปีที่แล้ว +7

    Awesome video dude. The visualization of the algorithm is amazing, and you gave just the right of information about how the algorithm works. Bravo.

    • @justindietel6127
      @justindietel6127  4 ปีที่แล้ว

      Thanks! That's exactly what I was going for! I wanted to give enough detail without rambling on for 30 minutes.

  • @RS-jp5wg
    @RS-jp5wg 2 ปีที่แล้ว

    I am working on humans evacuation dynamics.
    Your explanation is quite helpful. Thanks

  • @CensSka
    @CensSka 7 ปีที่แล้ว

    Awesome work!

  • @monkeeyo101
    @monkeeyo101 3 ปีที่แล้ว

    How do current nodes and previous nodes change throughout the pathfinding?

  • @bagok701
    @bagok701 7 ปีที่แล้ว +1

    Hi take a look at recent grid based optimizations of a* like Jump point search and Rectangular Symmetry Reduction. also compare your changes to the cost functions to Bredth first search and Depth first search.

  • @tawfik1546
    @tawfik1546 4 ปีที่แล้ว

    this is great ! thanks

  • @nsk8ter524
    @nsk8ter524 7 ปีที่แล้ว

    This is soo cool. Thanks for the video.

  • @krzysztofbracha6852
    @krzysztofbracha6852 7 ปีที่แล้ว

    Amazing video concise and comprehend. Looking forward to see more from you!

  • @reinderdorman2169
    @reinderdorman2169 7 ปีที่แล้ว +4

    Any chance your algorithm is on github or something, including the interactiveness?

    • @justindietel6127
      @justindietel6127  7 ปีที่แล้ว +3

      Sorry, I have chosen to keep my IP private.

  • @swimmer4986
    @swimmer4986 7 ปีที่แล้ว

    What software do you use to test the algorithm or refine it (like in your example)? Do you build it from scratch on something using python or use something like matlab or others to get it?

    • @justindietel6127
      @justindietel6127  7 ปีที่แล้ว

      The algorithm and animation was written entirely in matlab.

    • @swimmer4986
      @swimmer4986 7 ปีที่แล้ว

      Alright thanks

  • @pedromartins204
    @pedromartins204 7 ปีที่แล้ว

    hi man, awsome video, btw what software do you use to visualize the algorithm's behavior like that, its pretty helpful. Could you tell us? :p

    • @justindietel6127
      @justindietel6127  7 ปีที่แล้ว +2

      I wrote my visualization code using a program called Matlab. If you are at a university, your school probably offers licenses for free. www.mathworks.com
      My other diagrams and animations were created using various animation software.

  • @lucavolker6325
    @lucavolker6325 ปีที่แล้ว

    How does the algorithm get the H-cost? I mean we dont know the way from the current Position to the end..

  • @Herotruth
    @Herotruth 7 ปีที่แล้ว +1

    I also see you have calculated the F-Cost. What algo did you use for that. As there might be various paths to calculate that.

    • @justindietel6127
      @justindietel6127  7 ปีที่แล้ว +4

      Herotruth, thanks for both of your questions. I will try to answer both of them here. In my example, the f-cost is simply a linear combination of the g and h costs. Formally written: f(g, h) = ag + bh, where a and b are constants. For most of the video, I make a = b = 1. At the end of the video, I talk about making the costs more expensive. Basically, I was changing the constants in the f-cost formula. If I set a = 1000 and b = 1, the g-cost gets expensive, and simulates the BFS approach. Alternatively, if I set a= 1 and b = 1000, the h-cost gets expensive and simulates the DPS approach. Optimizing between the two approaches to find the best and fastest solution is an interesting problem worth pursuing.

  • @SonNguyenVirgo
    @SonNguyenVirgo 6 ปีที่แล้ว +1

    I dont know when and why it reach the end, or juat run forrever ?

    • @Chubzdoomer
      @Chubzdoomer 4 ปีที่แล้ว

      It reaches the end as soon as the goal node is added to the "closed" list (meaning it's been found). At that point, the path is created by tracking the lineage of parents from the goal node all the way back to the start (like following a trail of breadcrumbs).

  • @preetiprasad3933
    @preetiprasad3933 3 ปีที่แล้ว

    Great video! Can you kindly share the MATLAB code for this?

  • @soldierofyhvh5966
    @soldierofyhvh5966 6 ปีที่แล้ว

    Finding the shortest distance between two paths... Wouldn't that be like finding the displacement verses the finding the distance? Very good video, by the way.

    • @justindietel6127
      @justindietel6127  6 ปีที่แล้ว

      Soldier ofYHVH what do you mean? Do you mean shortest distance between two points? The objective of this algorithm is to minimize the number of nodes in a path between two points.

    • @soldierofyhvh5966
      @soldierofyhvh5966 6 ปีที่แล้ว

      I realize the objective of the algorithm. When you said "my algorithm will be finding the shortest path" and then you referred to that as distance later in the video, it threw me off. The algorithm is not intended to find the shortest path, it is intended to find the lowest f-cost. When you used the right triangle as an example, the hypotenuse would seem to be the displacement, and the 1 on the x axis and the 1 on the y axis would seem to be the distance. Displacement is the shortest distance between two points, and distance is the amount of space between those two points (and is longer than the path of displacement). But after watching the video several times, the shortest path isn't always possible, otherwise your object wouldn't need to calculate the lowest f-cost and could just move directly towards the target and through any obstacles. So in this instance, you are calculating the distance verses the displacement, or so it would seem. Thanks for responding, and nice video any way it goes.

    • @justindietel6127
      @justindietel6127  6 ปีที่แล้ว

      Soldier ofYHVH You are correct. The purpose of this algorithm is not to calculate the displacement between two points, but rather approach a shortest path and distance through the A* algorithm process.

  • @kaidongtian3622
    @kaidongtian3622 6 ปีที่แล้ว

    Could you please share your matlab code?

  • @Herotruth
    @Herotruth 7 ปีที่แล้ว

    Are you using DFS or BFS?

  • @riccardod.888
    @riccardod.888 7 ปีที่แล้ว +21

    I love you (no homo)

  • @stephenallenasuncion4947
    @stephenallenasuncion4947 3 ปีที่แล้ว

    so whats the parent node!

  • @saqibazim8114
    @saqibazim8114 7 ปีที่แล้ว

    Hey your visual graph which shows the propagation of the graph is amazing ..Can u please tell me how I can visualize this kind of propagation..? If not can you please provide me with the code..Thanks a lot :)

    • @justindietel6127
      @justindietel6127  7 ปีที่แล้ว

      I created a basic animation to visualize the solutions of the algorithm. Instead of running ALL the calculations and showing the best solution, I chose to render each step of the solution. Every time a node is visited, I update the path, and then put that frame into the animation. After each step, I wait a fraction of a second so that the animation isn't too fast. You can make this kind of animation really easily. I made this animation in a couple hours having not made an animation ever before. I created mine directly in my matlab code. Good luck!
      I have chosen not to share my code, as I wish to keep my IP private.

    • @zenchiassassin283
      @zenchiassassin283 4 ปีที่แล้ว

      @@justindietel6127 Do you draw with the mouse all the obstacles ? How?

  • @missfariha1837
    @missfariha1837 5 หลายเดือนก่อน

    can you upload this code??

  • @thecommandblockuser6939
    @thecommandblockuser6939 6 ปีที่แล้ว +1

    If there is no path, what happens?

    • @Chubzdoomer
      @Chubzdoomer 4 ปีที่แล้ว

      The algorithm simply runs until there are no more nodes to visit (the "open" list is empty; every valid node has been evaluated). If the goal hasn't been found at that point, it stops and no path is ever created.

  • @tornjak096
    @tornjak096 2 ปีที่แล้ว

    Wow

  • @radsimu
    @radsimu 6 ปีที่แล้ว

    there are not 100 nodes in this example.. there are 81. you skipped over 0-10 and multiples of 10

    • @justindietel6127
      @justindietel6127  6 ปีที่แล้ว +1

      Radu Simionescu The nodes are the intersections, not the boxes. Look at 1:38, the nodes are numbered 1-100. The corresponding node is to the lower right of each number. Hope this clears up the confusion.

  • @jackscott5121
    @jackscott5121 6 ปีที่แล้ว +5

    I have no idea what’s going on

  • @RioMilano2002
    @RioMilano2002 3 ปีที่แล้ว

    'your algorithm'?