Coder Social home page Coder Social logo

Improve the NodeList's efficiency about php-a-star HOT 4 OPEN

jmgq avatar jmgq commented on June 8, 2024
Improve the NodeList's efficiency

from php-a-star.

Comments (4)

jmgq avatar jmgq commented on June 8, 2024 1

I'll leave here some of my old notes regarding open and closed lists:

Open list

Closed list

from php-a-star.

jmgq avatar jmgq commented on June 8, 2024 1

Hi @pathway, nice to see you again! Apologies for my late reply, somehow I missed it.

I think an option to allow sub-optimal routes could be sometimes useful.

I agree, this is already possible with the current implementation, as it's up to the user to provide the heuristic implementation.

Choice of how you track closed list, doesn't interact with the heuristic or with admissibility at all.

Thanks for clarifying, I believe you're correct. I was a bit confused when doing my research, because some implementations of the A* algorithm don't use a closed list at all. This is the case in the pseudo-code provided in Wikipedia. This leads me to believe that the closed list is strictly not necessary, but using one would make the algorithm more efficient. And we can make it even more efficient by choosing the right implementation of the closed list, it could even be a flag in the node, as you said, instead of an actual list or independent structure.

from php-a-star.

jmgq avatar jmgq commented on June 8, 2024

As part of v2.0.0, a new interface called NodeCollectionInterface has been released. The first draft of the new AStar class allowed the user to pass their own open and close lists via the constructor, but it was later on removed (in commit 686b0b6). It is better for the constructor to not have those parameters until some other implementations of NodeCollectionInterface have been created and tested, so that NodeCollectionInterface is not part of the public API until it's strictly necessary.

from php-a-star.

pathway avatar pathway commented on June 8, 2024

Do the latter require that the heuristic is admissible

You always need an admissible heuristic, unless you are ok with sub-optimal routes. How important that is can be domain-specific.

image

Depending on the specific case, finding the truly optimal route may be hugely expensive (imagine a 200x exaggeration of the image from your link above), so you may be happy with just finding something "reasonable". So I think an option to allow sub-optimal routes could be sometimes useful.

The "closed list" is just permanently (for the current search) flagging each node as "done", so you can handle it any way you want -- a flag, a list, a map. Yes doing this in the cheapest way is good. Choice of how you track closed list, doesn't interact with the heuristic or with admissibility at all. You also want a way that is easy/cheap to "reset" for the next search.

from php-a-star.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.