Body: <p>I have a doubt about A* goal test.</p>
  <p>As far as I know an <strong>early goal test</strong> is performed when a node (representing a certain state) is inserted in the <strong>frontier</strong> or, to conform with AIMA terminology, when is <strong>reached/generated</strong>.</p>
  <p>Quoting AIMA 4ed:</p>
  <blockquote>
  <p>(...) with a consistent heuristic, the first time we <strong>reach</strong> a state it will be on an <strong>optimal path</strong>, so we never have to re-add a state to the frontier, and never have to change an entry in reached.</p>
  </blockquote>
  <p>With this piece of information I suppose that an <strong>early goal test</strong> is totally <strong>safe</strong>, but I wasn't able to find anything about it on the internet to confirm my hypothesis, so my second guess is that I am wrong about it.</p>
  <p>Am I wrong? Did I misunderstood something?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-03-16T19:07:34.373Z
Comments.Text: Yes, you can. It's an extremely common optimization to early-exit like this in pathfinding code when you know for sure the heuristic will always be consistent.
Comments.UserDisplayName: BlueRaja - Danny Pflughoeft
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-03-24T10:22:29.653Z
Comments.Text: Is early goal test ok even with multiple goal states? I think it is not. It is true that we can adapt a problem with multiple goal states to a problem with one goal state by connecting all goal states to an unique goal state, but this is equivalent to perform a late goal test with the original goal states in my opinion.
Comments.UserDisplayName: InCrisis
Tags: <heuristics><a-star><consistent-heuristic>
Title: Is possible to perform an early goal test with A* using a consistent heuristic?
UserDisplayName: InCrisis
ThreadText: # Is possible to perform an early goal test with A* using a consistent heuristic?
  
  (Asked by: username_0 on 2022-03-16)
  
  I have a doubt about A\* goal test.
  
  As far as I know an **early goal test** is performed when a node (representing a certain state) is inserted in the **frontier** or, to conform with AIMA terminology, when is **reached/generated**.
  
  Quoting AIMA 4ed:
  
  > (...) with a consistent heuristic, the first time we **reach** a state it will be on an **optimal path**, so we never have to re-add a state to the frontier, and never have to change an entry in reached.
  
  With this piece of information I suppose that an **early goal test** is totally **safe**, but I wasn't able to find anything about it on the internet to confirm my hypothesis, so my second guess is that I am wrong about it.
  
  Am I wrong? Did I misunderstood something?
  
  **Tags:** heuristics, a-star, consistent-heuristic
  > **Comments:**
  > **username_1**: Yes, you can. It's an extremely common optimization to early-exit like this in pathfinding code when you know for sure the heuristic will always be consistent.  
  > **username_0**: Is early goal test ok even with multiple goal states? I think it is not. It is true that we can adapt a problem with multiple goal states to a problem with one goal state by connecting all goal states to an unique goal state, but this is equivalent to perform a late goal test with the original goal states in my opinion.  
  
  ---
  
  ## 0 answers
  
  