Presentation is loading. Please wait.

Presentation is loading. Please wait.

Intelligence Artificial Intelligence Ian Gent Search: 1.

Similar presentations


Presentation on theme: "Intelligence Artificial Intelligence Ian Gent Search: 1."— Presentation transcript:

1 Intelligence Artificial Intelligence Ian Gent ipg@cs.st-and.ac.uk Search: 1

2 Intelligence Artificial Intelligence Part I :What is Search? Part II: Presenting search abstractly Part III: Basic search algorithms Search: 1

3 3 What is AI? zVery hard to define Artificial Intelligence ynot attempt at building machine to pass Turing Test zPerhaps, exploiting power of machines to do tasks normally considered intelligence? zPractical day to day answer is: zAI is what we don’t know how to do yet yOnce we know how to do something, it’s not AI ye.g. optical character recognition, speech recognition yMany AI problems involve combinatorial search

4 4 Example Search Problem: SAT zWe need to define problems and solutions zPropositional Satisfiability (SAT) yreally a logical problem -- I’ll present as a letters game zProblem is a list of words ycontains upper and lower case letters (order unimportant) ye.g. ABC, ABc, AbC, Abc, aBC, abC, abc zSolution is choice of upper/lower case letter yone choice per letter yeach word to contain at least one of our choices ye.g. AbC is unique solution to above problem.

5 5 Why is SAT a search problem? zThere is no efficient algorithm known for SAT yall complete algorithms are exponential time z3-SAT is NP-Complete y3-SAT = each word contains exactly 3 letters zNP-Complete ywe can recognise solutions in polynomial time xeasy to check letter choice satisfies each word yall other NP problems can be solved by translation to SAT zMany AI problems fall into NP-Complete class

6 6 Example: Travelling Salesperson zProblem: graph with an cost for each edge ye.g. zSolution: tour visiting all nodes returning to base ymeeting some cost limit (or reaching minimum cost) ye.g. minimum cost is 21 above zTSP is NP-Complete yeasy to check that tour costs no more than limit y(finding optimal cost in technically different complexity class) 4 2 3 4 5 2 1 4 2

7 7 Example (Not): Sorting zProblem, a list of numbers ye.g. 5 6 3 2 4 8 zSolution, list in ascending order ye.g. 2 3 4 5 6 8 zIn NP (easy to check that result in ascending order) zNot NP-complete ycannot solve SAT via sorting ycan be solved in O(n log n) time zWe know how to do it efficiently, so it’s not AI

8 8 Final Example: Games zProblem: a position in a Chess/Go/… game zSolution: a strategy to guarantee winning game zHarder than NP problems yit is not easy to check that a strategy wins ycan solve SAT via games zTechnically, games usually PSPACE-complete yAll NP-complete problems in PSPACE z Games are valid AI application zAI usually attacks NP-complete or harder search problems

9 9 Presenting Search Abstractly zHelps to understand the abstract nature of search ysearch states, search spaces, search trees… yknow what particular search algorithms are trying to do zThere are two kinds of search algorithm yComplete xguaranteed to find solution or prove there is none yIncomplete xmay not find a solution even when it exists xoften more efficient (or there would be no point) xe.g. Genetic Algorithms zFor now concerned with complete algorithms

10 10 Search States zSearch states summarises the state of search zA solution tells us everything we need to know ye.g. in SAT, whether each letter is UPPER or lower case yin TSP, route taken round nodes of graph zThis is a (special) example of a search state yit contains complete information yit solves the problem zIn general a search state may not do either of those yit may not specify everything about a possible solution yit may not solve the problem or extend to a solution

11 11 Search States zSearch states summarise the state of search zE.g. in SAT ya search state might be represented by aB zE.g. in TSP ya search state might specify some of the order of visits zE.g. in Chess ya search state might be represented by the board position x(quiz for chessplayers: …and what else?)

12 12 Generalising Search zWith search states we can generalise search ynot just finding a solution to a problem zGenerally, find a solution which extends search state ye.g. find solution to ABC, ABc, AbC, Abc, aBC, abC, abc which extends aB ythere is no such solution though whole problem solvable zOriginal search problem is to extend null state zSearch in AI by structured exploration of search states

13 13 Search Space and Search Trees zSearch space is logical space composed of ynodes are search states ylinks are all legal connections between search states xe.g. in chess, no link between states where W castles having previously moved K. yalways just an abstraction ythink of search algorithms trying to navigate this extremely complex space

14 14 Search Trees zSearch trees do not summarise all possible searches yinstead an abstraction of one possible search zRoot is null state zedges represent one choice ye.g. to set value of A first zchild nodes represent extensions ychildren give all possible choices zleaf nodes are solutions/failures zExample in SAT yalgorithm detects failure early yneed not pick same variables everywhere

15 15 Why are search trees abstract? zSearch trees are very useful concept ybut as an abstraction zSearch algorithms do not store whole search trees ythat would need exponential space ywe can discard nodes in search tree already explored zSearch algorithms store frontier of search yI.e. nodes in search tree with some unexplored children zVery many search algorithms understandable in terms of search trees yand specifically how they explore the frontier

16 16 Some classic search algorithms zDepth-first search yI.e. explore all nodes in subtree of current node before any other nodes ypick leftmost and deepest element of frontier zBreadth-first search yexplore all nodes at one height in tree before any other nodes ypick shallowest and leftmost element of frontier zBest-first search ypick whichever element of frontier seems most promising

17 17 More classic search algorithms zDepth-bounded depth first search ylike depth first but set limit on depth of search in tree zIterative Deepening search yuse depth-bounded search but iteratively increase limit

18 18 Next week on Search in AI zPresentation of search algorithms in terms of lists ye.g. depth-first = stack, breadth-first = queue zHeuristics in search yhow to pick which variable to set


Download ppt "Intelligence Artificial Intelligence Ian Gent Search: 1."

Similar presentations


Ads by Google