Examples has been integrated with the shrdlite-offline.ts file use by typing "node shrdlite-offline.js ASTAR #city-to-start-from"
The important files are AStar.ts and AStarExample.ts. AStar.ts is where the A* algorithem is implemented, AStarExample.ts is the Bucharest example from the slides in lecture 2 as described below.
To implement this lab we chose to have a single file for the A* algorithm which holds all interesting functions that are needed.
As heuristics we are using the direct path from the cities to the city of Bucharest. See image below.
City indexes | City names |
---|---|
0. | Arad |
1. | Bucharest |
2. | Chraiova |
3. | Dobreta |
4. | Eforie |
5. | Fagaras |
6. | Giurgiu |
7. | Hirsova |
8. | Iasi |
9. | Lugoj |
10. | Mehadia |
11. | Neamt |
12. | Oreada |
13. | Pitesti |
14. | Rimnicu Vilecea |
15. | Sibiu |
16. | Timisoara |
17. | Urziceni |
18. | Vaslui |
19. | Zerind |