190 likes | 362 Views
CSCI 4310. Lecture 2: Search. Search Techniques. Search is Fundamental to Many AI Techniques. Semantic Networks. Nodes: objects in the domain Links: Relationships between objects OOP: link is an “is a” relationship Meaning depends on the application
E N D
CSCI 4310 Lecture 2: Search
Search Techniques • Search is Fundamental to Many AI Techniques
Semantic Networks • Nodes: objects in the domain • Links: Relationships between objects • OOP: link is an “is a” relationship • Meaning depends on the application • This abstract concept is put into practice in Ch. 4
Semantic Nets • Book Converts to Trees
Search • What should a goal-based program do when none of the actions it can currently perform result in a goal state? • Choose an action that at least leads to a state that is closer to a goal than the current state. • Heuristics • Refine our search procedure, or narrow the search space.
Definitions • State: finite representation of the world at a given time. • Operator: a function that transforms one state into another (also called rule, transition, successor function, production, action). • Initial state: world state at the beginning. • Goal state: desired world state (can be several) • Goal test: test to determine if the goal has been reached.
Definitions • Reachable goal: a state reachable via a sequence of operators. • State space: set of all reachable states from initial state (possibly infinite). • Cost function: a function that assigns a cost to each operation. The ‘path cost’ is the TOTAL cost of getting from the start to the goal. • Performance: • cost of the final operator sequence • cost of finding the sequence • Path: A sequence of actions leading from one state to another. • Solution: A path from the initial state to a state that satisfies the goal test (goal state).
Depth First Search • Uninformed search DFS applet
Depth First Search dfs (node v) { visit(v); for each child w of v dfs(w); } O(bm) time complexity b: max branching factor m: max depth Can be implemented with only storing the ‘current’ path: O(bm) space
Depth First Search • Use when all partial paths reach dead ends or become complete paths after a reasonable number of steps • Can use fewer resources than BFS
Breadth First Search • Uninformed search
DEPTH 0 DEPTH 1 DEPTH 2 Breadth First Search O(bd) time and space complexity b: max branching factor d: depth of solution
Breadth First Search • BFS may use more memory, but will not get stuck in blind alleys, and will always find the shortest path first. • BFS may be more appropriate when exploring very large search spaces where there is an expected solution which takes a relatively small number of steps, or when you are interested in all the solutions.
Summary: Uninformed Search • Problem formulation and representation is key! • Implementation as expanding directed graph of states and transitions • Appropriate for problems where no solution is known and many combinations must be tried • Problem space is of exponential size in the number of world states -- NP-hard problems • Fails due to lack of space and/or time.
From a Higher Level • Task discriminator • Many AI ‘searching’ techniques • DFS or BFS • Heuristic • Rule-based system • Genetic Algorithm • …
“Macro”-search What do I do next? Stair Climbing Facial recognition algorithm Neural Network Rule Based Expert System
Limited Cross-disciplinary systems • We have made impressive progress in machines that… • Play chess • Diagnose medical problems • Climb stairs • But no robot can walk down stairs and then play a game of chess? • Why
A simple example, but the task of task determination is difficult • How do you do this as a human? • Goal-driven behaviors and divide and conquer can help
Reading • Chapters 2 in Winston • Chapters 2-3 in Buckland