In this project, I implement most of the classical search algorithms are used in AI, such as:
- Breath First Search(BFS)
- Depth First Search(DFS)
- Depth First Search(DFS) limited depth
- iterative deepening Depth First Search(DFS)
- uniform cost search
- greedy best first search
- A* (A star)
To use these search algorithms for solving your problem, you should define your problem and its state classes that extend from Problem and State class.
Use MyProblem extends Problem
and MyProblemState extends State
to achieve that.
For example, I model a navigation problem in Romania that should find a path from Arad to Bucharest, I solved it by defining NavigationProblem and NavState classes and use search algorithms. You can see the map of the cities below:
You can also see the CityIDs that I assume below:
- Arad
- Zerind
- Oradea
- Sibia
- Timisoara
- Lugoj
- Mehadia
- Dobreta
- Craiova
- Rimnicu Vilcea
- Pitesti
- Fagaras
- Bucharest
- Giurgiu
- Urziceni
- Hirsova
- Eforie
- Vaslui
- Iasi
- Neamt