The purpose of this program is to train for the execution of the provided Search Algorithms by hand in order to be well prepared for the Exam of IN2062 (Grundlagen der Künstlichen Intelligenz).
Seach Algorithms taken from this repository:
Algorithm | Function name | Notes |
---|---|---|
Breadth First Search | breadth_first_graph_search |
[unused] also without explored set: breadth_first_tree_search
|
Depth First Search | depth_first_tree_search |
[unused] also with explored set: depth_first_graph_search
|
Uniform Cost Search aka Dijkstra | uniform_cost_search |
|
Depth Limited Search | depth_limited_search |
|
Iterative Deepening Search | iterative_deepening_search |
|
Greedy Best First Search | greedy_best_first_graph_search |
|
astar_search |
Additionally, some util functions for these algorithms and the romania example were taken from the same repository.
- Branching factor (max number of successors of any node)
$b$ - Maximum length of any path (in state space)
$m$ - Depth of shallowest goal node
$d$ - Cost of optimal solution
$C^*$ - Minimum Step cost
$\epsilon$ - Depth limit
$l$ (For depth limited search) - Estimated and cost from the root to the goal
$h$ - Actual cost from the root to the goal
$h^*$ - Relative error
$\epsilon^* = \frac{(h^* − h)}{h^*}$
Algorithm | Informed/Uninformed | Complete | Optimal | Time complexity | Space Complexity |
---|---|---|---|---|---|
BFS | Uninformed | Yes (for finite |
No (but Yes if equal cost per stel) | Nodes in frontier: |
|
DFS | Uninformed | No (but Yes when checking for cycles in finite state spaces) | No | ||
Uniform Cost Search (Dijkstra) - Best First Search mit |
Uninformed | Yes (if all costs are |
Yes (If cost |
|
|
Depth Limited Search | Uninformed | No (if |
No (if |
||
Iterative Deepening | Uninformed | Yes (if |
Yes, if all step costs are the same | ||
Greedy Best First Search | Informed | Yes (if graph search is used) | No |
|
|
|
Informed | Yes (if all costs are |
Yes (if costs are positive and heuristic is admissible) |
|
|
Note: DFS and BFS conduct a goal check on nodes that are added to the frontier, while the other algorithms do so when nodes are taken out of the frontier
Explanations:
- Optimal: Does the strategy find the optimal solution (minimum costs)?
- Complete: Is it guaranteed that the algorithm finds a solution if one exists?
-
Consistency:
$h(n)$ is consistent, iff$h(n) \leq c(n, a, n') + h(n')$ for all nodes$n$ , action$a$ and all direct successors$n'$ gilt. - Admissible: An admissible heuristic is an underestimation, i.e., it has to be less than or equal to the actual cost.
-
$h_2$ dominates$h_1$ iff$\forall n: h_2(n) \geq h_1(n)$ - Every consistent heuristic is also admissible
- In
$A^*$ :- If the heuristic is consistent, any node is only expanded if it is located on an optimal path to its state.
- A dominating heuristic will never expand more nodes than the heuristic it dominates
- matplotlib
- networkX