QUESTION IMAGE
Question
problem 1 (10 points): trace the operation of \\(a^*\\) search (use the tree version, i.e. without using a closed list) applied to the problem of getting to bucharest from lugoj using the straight-line distance heuristic. that is, show the sequence of nodes that the algorithm will consider and the \\(f, g,\\) and \\(h\\) score for each node. you dont need to draw the graph, just write down a sequence of \\((city, f(city), g(city), h(city))\\) in the order in which the nodes are expanded.
Identify search parameters
We trace tree-version \(A^*\) search from Lugoj to Bucharest.
The evaluation function is:
where \(g(n)\) is the path cost from Lugoj, and \(h(n)\) is the straight-line distance to Bucharest.
Straight-line distances \(h(n)\) from Figure 2:
- Arad: 366
- Bucharest: 0
- Craiova: 160
- Drobeta: 242
- Eforie: 161
- Fagaras: 176
- Giurgiu: 77
- Hirsova: 151
- Iasi: 226
- Lugoj: 244
- Mehadia: 241
- Neamt: 234
- Oradea: 380
- Pitesti: 100
- Rimnicu Vilcea: 193
- Sibiu: 253
- Timisoara: 329
- Urziceni: 80
- Vaslui: 199
- Zerind: 374
Initialize search tree
Start at Lugoj:
- Path: [Lugoj]
- \(g(\text{Lugoj}) = 0\)
- \(h(\text{Lugoj}) = 244\)
- \(f(\text{Lugoj}) = 0 + 244 = 244\)
Frontier: \(\{\text{Lugoj}: (0, 244, 244)\}\)
Expand Lugoj:
- To Timisoara: \(g = 111\), \(h = 329\), \(f = 440\)
- To Mehadia: \(g = 70\), \(h = 241\), \(f = 311\)
Frontier:
- Mehadia: \(g = 70\), \(h = 241\), \(f = 311\)
- Timisoara: \(g = 111\), \(h = 329\), \(f = 440\)
Expand Mehadia
Expand Mehadia (lowest \(f = 311\)):
- To Lugoj: \(g = 70 + 70 = 140\), \(h = 244\), \(f = 384\)
- To Drobeta: \(g = 70 + 75 = 145\), \(h = 242\), \(f = 387\)
Frontier:
- Lugoj (via Mehadia): \(g = 140\), \(h = 244\), \(f = 384\)
- Drobeta: \(g = 145\), \(h = 242\), \(f = 387\)
- Timisoara: \(g = 111\), \(h = 329\), \(f = 440\)
Expand Lugoj (via Mehadia)
Expand Lugoj (lowest \(f = 384\)):
- To Timisoara: \(g = 140 + 111 = 251\), \(h = 329\), \(f = 580\)
- To Mehadia: \(g = 140 + 70 = 210\), \(h = 241\), \(f = 451\)
Frontier:
- Drobeta: \(g = 145\), \(h = 242\), \(f = 387\)
- Timisoara (direct): \(g = 111\), \(h = 329\), \(f = 440\)
- Mehadia (via Lugoj): \(g = 210\), \(h = 241\), \(f = 451\)
- Timisoara (via Lugoj): \(g = 251\), \(h = 329\), \(f = 580\)
Expand Drobeta
Expand Drobeta (lowest \(f = 387\)):
- To Mehadia: \(g = 145 + 75 = 220\), \(h = 241\), \(f = 461\)
- To Craiova: \(g = 145 + 120 = 265\), \(h = 160\), \(f = 425\)
Frontier:
- Craiova: \(g = 265\), \(h = 160\), \(f = 425\)
- Timisoara (direct): \(g = 111\), \(h = 329\), \(f = 440\)
- Mehadia (via Lugoj): \(g = 210\), \(h = 241\), \(f = 451\)
- Mehadia (via Drobeta): \(g = 220\), \(h = 241\), \(f = 461\)
- Timisoara (via Lugoj): \(g = 251\), \(h = 329\), \(f = 580\)
Expand Craiova
Expand Craiova (lowest \(f = 425\)):
- To Drobeta: \(g = 265 + 120 = 385\), \(h = 242\), \(f = 627\)
- To Rimnicu Vilcea: \(g = 265 + 146 = 411\), \(h = 193\), \(f = 604\)
- To Pitesti: \(g = 265 + 138 = 403\), \(h = 100\), \(f = 503\)
Frontier:
- Timisoara (direct): \(g = 111\), \(h = 329\), \(f = 440\)
- Mehadia (via Lugoj): \(g = 210\), \(h = 241\), \(f = 451\)
- Mehadia (via Drobeta): \(g = 220\), \(h = 241\), \(f = 461\)
- Pitesti (via Craiova): \(g = 403\), \(h = 100\), \(f = 503\)
- Timisoara (via Lugoj): \(g = 251\), \(h = 329\), \(f = 580\)
- Rimnicu Vilcea (via Craiova): \(g = 411\), \(h = 193\), \(f = 604\)
- Drobeta (via Craiova): \(g = 385\), \(h = 242\), \(f = 627\)
Expand Timisoara (direct)
Expand Timisoara (lowest \(f = 440\)):
- To Lugoj: \(g = 111 + 111 = 222\), \(h = 244\), \(f = 466\)
- To Arad: \(g = 111 + 118 = 22…
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
The sequence of nodes expanded by the tree-version of the \(A^*\) search algorithm, along with their corresponding \(f\), \(g\), and \(h\) values, is as follows:
- Lugoj: \(f = 244\), \(g = 0\), \(h = 244\)
- Mehadia: \(f = 311\), \(g = 70\), \(h = 241\)
- Lugoj (via Mehadia): \(f = 384\), \(g = 140\), \(h = 244\)
- Drobeta: \(f = 387\), \(g = 145\), \(h = 242\)
- Craiova: \(f = 425\), \(g = 265\), \(h = 160\)
- Timisoara: \(f = 440\), \(g = 111\), \(h = 329\)
- Mehadia (via Lugoj): \(f = 451\), \(g = 210\), \(h = 241\)
- Mehadia (via Drobeta): \(f = 461\), \(g = 220\), \(h = 241\)
- Lugoj (via Timisoara): \(f = 466\), \(g = 222\), \(h = 244\)
- Pitesti: \(f = 503\), \(g = 403\), \(h = 100\)
- Bucharest: \(f = 504\), \(g = 504\), \(h = 0\)