Robots * Doing search with them for a project. * Anyone want to check one out? * Unix lab You have seen graphs before... * Trees used in data structures for sorting. - Tree - graph with no cycles - Heap (all children have values less than their parents, heapsort - binary search tree (child to right is greater, child to left is smaller) Graph search * If you have the whole graph, like cities and distances between them. * Dijkstra's algorithm (look it up on wikipedia). * breadth-first search - example on a graph * depth-first search - example on a graph * for both of those - keeping track of visited nodes to avoid going in cycles - keep track of nodes that have not been visited that are next to visit - use a queue for BFS, stack for DFS - example. General definition of uninformed search problem * Initial state * Goal state * Way to transition from current state to next states * What choice to make about what state to look at next - Example: sliding puzzle, 8-queens, sudoku, 4-coloring, route-finding in a computer game, SAT, ... - note for 8-queens - problem formulation makes a big difference in the size of the search space, and makes using search much better than simply trying all possible ways to put 8 queens on the board! - similar point for 4-coloring. Description of any general search algorithm * Explored region, frontier (haven't looked at their neighbors yet). * Each step puts something from frontier into explored region, and puts the neighbors of that new explored node into the frontier. * The choice is which frontier node to explore next. As said above, use queue for BFS, stack for DFS. Tree versus Graph search * Graph search also keeps a list of visited vertices, so will not go into loops. Tree search does not. * So tree search can go into infinite loops, but space complexity can be much less! Performance * Completeness, optimality, time, space. * BFS: complete, optimal (for unit-cost paths), time O(b^{d+1}), space O(b^d) * uniform-cost search: optimal in general, time and space complexity can be much better than BFS. - This is a sort of sub-case of A*, so we'll talk about it with A*. * DFS: smaller space than BFS, not optimal * Others: uniform-cost, depth-limited, iterative deepening, bidirectional BFS algorithm from book. Homework 0 * Looking at the code, explaining some things about python. * Go look at the python resources linked on the webpage !!! * Possible additions to it - function to generate a random sudoku board - improving the search by being smarter (who can solve boards by checking the smallest number of states - by improving order in which moves are considered or other ways, optimize the running time even if the same number of states are searched) - check whether a sudoku board is uniquely solvable - would bidirectional search be appropriate? - which uninformed search strategy would be best? does it matter?