search
play

Search How do I find a solution to a problem? The problem Give - PDF document

Search How do I find a solution to a problem? The problem Give some description of a goal, how to achieve it? Think of agent Being in some state Chess: board position Knowing what properties a goal state should have


  1. 
 Search “How do I find a solution to a problem?” The problem •Give some description of a goal, how to achieve it? •Think of agent • Being in some state Chess: board position • Knowing what properties a goal state should have Chess: king in check, nowhere to move that isn’t in check • Knowing how to move from state to state Chess: rules of the game •State space: composed of all possible states •State space search: From a start state, find a path to a goal state COS 470/570 Introduction to Artificial Intelligence What can be represented in this formalism? • Anything that has objects, properties, relationships , ways to get from state to state • Chess: board, pieces, properties of pieces, locations of pieces, moves… • Theorem proving: axioms, rules of inference, theorem, objects • Route planning: locations, roads, direction of travel of roads, speed limits, … COS 470/570 Introduction to Artificial Intelligence What can be represented in this formalism? • Mobile robot: robots, other objects, locations, locations of objects, actions robot can take, sensor data, … • Medicine: patient, providers, equipment, pathogens, drugs, drug—patient effects, drug—pathogen effects, … • Natural language understanding: words, phrases, definitions, grammar rules,… COS 470/570 Introduction to Artificial Intelligence

  2. Domains • Domain: the world of the agent • Domain knowledge: what agent can know about world • Chess: moves, pieces’ worth, … • Mobile robot: actions, action results, sensors, temperature, objects can’t occupy same space, … • Medicine: anatomy, physiology, pathology, pharmacology, … • Agent may know domain knowledge, or could be built in to problem/solution formalization COS 470/570 Introduction to Artificial Intelligence State spaces • Model state space with graph • Often a digraph — e.g., one-way streets, irreversible reactions, … COS 470/570 Introduction to Artificial Intelligence State spaces R R R R R R COS 470/570 Introduction to Artificial Intelligence State spaces COS 470/570 Introduction to Artificial Intelligence

  3. State space search formalism • Problem: state space + start state + goal state description • Description may completely or partially describe goal • May have 0, 1, or more actual goal states • Solution: path from start state to goal state • Search: process of finding the path • Start at start state • Expand the start state by finding its children (neighbors) • If goal found, stop • Else, systematically expand children, etc. COS 470/570 Introduction to Artificial Intelligence State representation issues • What to put in the state? • Important stuff • Enough to differentiate between states • What to leave out? • The rest • Saves space, time during matching COS 470/570 Introduction to Artificial Intelligence State representation issues • Represent entire state? • Partial state representation? • Concentrate search on important features of goal • Can match multiple goals • Concrete or abstract state description? • “White king is on K1, black queen is on Q1,…” or “White king is in check, no moves that aren’t also in check” • Other abstract representations: “understand the utterance”, “diagnose the patient’s problem”, “create a plan to build a house”, … • Relative or absolute description (of goals, esp.)? • “Closest state to the ocean” • Diagnosis that covers most symptoms COS 470/570 Introduction to Artificial Intelligence State space representation •Represent entire state space? • Pros: can use global knowledge, can guarantee optimal path • Cons: map of space may be unavailable, size may be huge (GPS route planning, chess) or infinite (NLP) — too big to store, too big to search efficiently •Generate states as needed? • Need operators to apply to states ⇒ children • Pros: cheaper for large search spaces, can deal with huge/ infinite search spaces • Cons: maybe inefficient for small search spaces, may not be able to “run” operators in reverse COS 470/570 Introduction to Artificial Intelligence

  4. Operators • Operator — if s, s i are states: f ( s ) → { s 1 , s 2 , …} • Operator set: defines all legal state transitions • Choosing operator to apply to state: • Match description of applicable state(s) to current state • Preconditions • Operator provides description of new state COS 470/570 Introduction to Artificial Intelligence • Robot world: • State representation? • Initial state? Goal state? • Operators? COS 470/570 Introduction to Artificial Intelligence Uninformed search COS 470/570 Introduction to Artificial Intelligence Blind (uninformed) search • Basically, all the searches you’ve seen so far • No information used about topology of state space • Which node chosen for expansion ⇒ search type COS 470/570 Introduction to Artificial Intelligence

  5. Search trees •Search space: graph of states •Search tree: • Record/state of search so far • Root: node corresponding to initial state • Leaves: nodes that are candidates for expansion (frontier) • Interior nodes: states that have been seen/expanded •Nodes ⇔ states • Information about the state • Bookkeeping information •Don’t want repeated nodes •Path from root → goal node at leaves = solution COS 470/570 Introduction to Artificial Intelligence Search space vs search tree COS 470/570 Introduction to Artificial Intelligence Kinds of search algorithms • Uninformed search • No knowledge about search space guides search • Often exponential in worst & average case • Not exponential in total number of nodes n ! • Rather, search is exponential in depth of search tree • If b = branching factor, d = depth, then most are 𝒫 ( b d ) • n is also 𝒫 ( b d ) • Informed (heuristic) search • Use heuristic knowledge to choose nodes • Heuristics about topology, problem structure, domain, problem solving itself COS 470/570 Introduction to Artificial Intelligence Kinds of search algorithms • Searches also differ by general order they expand nodes • Breadth-first search (BFS) • What is it? • Implement with what data structure? • Depth-first search (DFS) • What is it? • Implement with what data structure? • Temporal backtracking • Backtracking during search vs during execution COS 470/570 Introduction to Artificial Intelligence

  6. Evaluating search algorithms • Completeness • Time/space complexity • Optimality • of quality of solution (path cost, goal selected) • of search effort/space • Complexity of algorithm (to some extent) Surprise: trade-offs! COS 470/570 Introduction to Artificial Intelligence Evaluation of BFS • As a group, answer: • Complete? • Optimal? If yes, under what condition(s)? • Time complexity? • Space complexity? COS 470/570 Introduction to Artificial Intelligence Evaluation of BFS • Complete? • Optimal? If yes, under what condition(s)? • Time complexity: • Process each node, each edge, so 𝒫 ( | V | + | E | ) • Best, average, and worst-case time! • Cool — linear…right? • Suppose goal is d links away from root, and on average branching factor is b • #nodes seen/expanded? or, better, what is | E |? 𝒫 ( b d ) • Space complexity? 𝒫 ( b d ) COS 470/570 Introduction to Artificial Intelligence How bad is that, though, really? • Suppose b = 2, process 1 edge/ns COS 470/570 Introduction to Artificial Intelligence

  7. How bad is space complexity? • Do we need to store all expanded nodes? • Could prune branch when we reach known node • Problem: how do we know? • Worst case — search space is a tree • Suppose only require 1 byte/node • For b , d from before: • Goal at level 30 ⇒ need 1 GiB • Goal at level 85 ⇒ 32 YiB (yobibytes or 39 yottabytes) = 35 trillion TiB! • If d = 266, store 1 bit/atom, would need all the atoms in the universe COS 470/570 Introduction to Artificial Intelligence Evaluation of DFS • As a group, answer: • Complete? • Optimal? If yes, under what condition(s)? • Time complexity? • Space complexity? COS 470/570 Introduction to Artificial Intelligence Evaluating DFS • Complete? • Optimal? If so, under what condition(s)? • Time & space complexity? • With branching factor b and goal depth d … • What’s max #edges traversed in worst case? All of them! • What’s the max # nodes stored at any one time? 𝒫 ( bd ) COS 470/570 Introduction to Artificial Intelligence BFS vs DFS BFS DFS Complete? Yes Yes Optimal? Yes (with uniform costs) No Time? Exponential Exponential Space? Exponential ( b= 2, d= 80: ~1E12 TiB) Linear ( b =2, d= 80: 2x80=160 B) Other Susceptible to infinite b Susceptible to infinite d COS 470/570 Introduction to Artificial Intelligence

Recommend


More recommend