Skip to content

aliarjomandbigdeli/search-algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Search Algorithms in AI

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)

How to use

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:

picture

You can also see the CityIDs that I assume below:

  1. Arad
  2. Zerind
  3. Oradea
  4. Sibia
  5. Timisoara
  6. Lugoj
  7. Mehadia
  8. Dobreta
  9. Craiova
  10. Rimnicu Vilcea
  11. Pitesti
  12. Fagaras
  13. Bucharest
  14. Giurgiu
  15. Urziceni
  16. Hirsova
  17. Eforie
  18. Vaslui
  19. Iasi
  20. Neamt