Coder Social home page Coder Social logo

Parent loop about php-a-star HOT 2 CLOSED

jmgq avatar jmgq commented on June 8, 2024
Parent loop

from php-a-star.

Comments (2)

pathway avatar pathway commented on June 8, 2024

I think the reason has to do with Algorithm.php 87:

$successors = $this->computeAdjacentNodes($currentNode, $goal);

Currently computeAdjacentNodes sets parents for all adjacent nodes, but we have not done the checks to see if we need to revisit the successor, until later:

            if ($successor->getG() >= $successorInOpenList->getG()) {

I think these checks should be done first, and then set parents only if successor passes this check.

I totally could be wrong. But I think wiki agrees with this comment:
http://en.wikipedia.org/wiki/A*_search_algorithm#Pseudocode

-- [email protected]

from php-a-star.

jmgq avatar jmgq commented on June 8, 2024

Thank you very much for submitting this issue.

The solution you submitted on #3 worked for that scenario, but it broke some other tests unfortunately.

You are right when you say that we need to delay the setting of the parents after the checks, but the problem with your solution in #3 is that you also delayed the setting of the G and H values, which made the algorithm fail in other scenarios.

I've deployed a fix, which is available in v1.1.1.

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.