Comments (4)
I'll leave here some of my old notes regarding open and closed lists:
Open list
- Priority queue: https://stackoverflow.com/questions/45577114/a-star-algorithm-open-and-closed-lists
- The best choice is a list that has both a fast insert and extract minimum operation. The performance of the insert operation is more important than extract minimum since the algorithm typically doesnโt extract all nodes inserted into the open list, with the exception being when no path exists). See https://www.growingwiththeweb.com/2012/06/a-pathfinding-algorithm.html
Closed list
- We may not need a closed list. Some implementations of the A* algorithm have a closed list, but some others just mark the nodes as visited instead. Do the latter require that the heuristic is admissible? I need to investigate this further before completely getting rid of the closed list.
- https://takinginitiative.wordpress.com/2011/05/02/optimizing-the-a-algorithm/
from php-a-star.
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.
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.
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.
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)
- Performance: allocating new nodes HOT 7
- Create a benchmark utility HOT 1
- Maybe consider generalizing the algorithm to allow for BFS, UCS, DFS, etc HOT 2
- Measure memory usage in the benchmark
- Measure number of nodes expanded in the benchmark
- Run static analysis tools HOT 1
- Exclude unnecessary files when composer is run with --prefer-dist
- Parent loop HOT 2
- Remove unneeded methods in the Node interface
- Scrutinizer support
- Enforce the coding standards via Travis-CI HOT 1
- Ease the library usage HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-a-star.