The A* algorithm uses the evaluation function:
f(v)=g(v)+h(v)
Where:
- g(v): the actual cost from the start node to node v
- h(v): the heuristic estimate of the cost from node v to the goal
- f(v): the estimated total cost of the path through node v to the goal
What happens if we redefine f(v)=2g(v)+h(v)?
This changes the priority in which nodes are selected for expansion. Let's analyze what this does:
1. Same Node Order?
No, not necessarily.
Dividing by 2 is a scalar transformation (scaling), and it doesn't change the relative order of nodes if all nodes are scaled equally. However, this scaling can affect tie-breaking, especially when multiple nodes have similar values of f(v). Depending on how your priority queue resolves ties (e.g., FIFO, LIFO, or based on secondary criteria), different nodes might be expanded first.
So, unless the tie-breaking mechanism is identical and all f(v) values are distinct, the node expansion order may differ.
2. Admissibility and Optimality
Let’s consider whether A* with f(v)=2g(v)+h(v) still guarantees optimal solutions.
- If h(v) is admissible (i.e., never overestimates the true cost), then 2h(v) is also admissible — even more conservative.
- Since both and are scaled equally, the relative importance of path cost and heuristic is changed.
f′(v)=21g(v)+
This is equivalent to weighting the heuristic and the path cost equally, which resembles a form of Weighted A*, where you use:
f(v)=(1−w)g(v)+wh(v)
In this case, w=0.5.
- Weighted A* with w>0 is not guaranteed to be optimal unless w=1 (standard A*) or h(v) is scaled appropriately.
- In this modified version, since g( is effectively "discounted", the search becomes , possibly leading to suboptimal paths.
⚠️ So, no, this modified A* does not guarantee the same result — neither in terms of the path found nor the sequence of node expansions.
Summary
| Aspect | Standard A* (f=g+h) | Modified A* (f=2g+) |
|---|
Final Answer:
No, using f(v)=2g(v)+h(v) instead of in A* . It can lead to:
- Different node expansion order
- Possibly suboptimal paths
- A more greedy behavior than standard A*
So, while the general behavior may appear similar in some cases, the results and performance are not guaranteed to be the same.