Top Banner
Artificial Intelligence Problem Solving Eriq Muhammad Adams [email protected]
71

Artificial Intelligence Problem Solving Eriq Muhammad Adams [email protected].

Jan 15, 2016

Download

Documents

Lexus Walsh
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript

Kecerdasan Buatan

Artificial IntelligenceProblem SolvingEriq Muhammad [email protected] Solving AgentsProblem FormulationExample ProblemsBasic Search AlgorithmsProblem-Solving Agentenvironmentagent?sensorsactuatorsProblem-Solving Agentenvironmentagent?sensorsactuators Formulate Goal Formulate ProblemStatesActions Find Solution14 Jan 2004CS 3243 - Blind Search5Problem-solving agents

Example: Route finding

Holiday PlanningOn holiday in Romania; Currently in Arad. Flight leaves tomorrow from Bucharest.Formulate Goal:Be in BucharestFormulate Problem:States: various citiesActions: drive between citiesFind solution:Sequence of cities: Arad, Sibiu, Fagaras, BucharestProblem Formulation

GoalStartStatesActionsSolutionVacuum World

Search Problem State spaceeach state is an abstract representation of the environmentthe state space is discrete Initial state Successor function Goal test Path costSearch Problem State space Initial state:usually the current state sometimes one or several hypothetical states (what if ) Successor function Goal test Path costSearch Problem State space Initial state Successor function:[state subset of states]an abstract representation of the possible actions Goal test Path costSearch Problem State space Initial state Successor function Goal test:usually a conditionsometimes the description of a state Path costSearch Problem State space Initial state Successor function Goal test Path cost:[path positive number]usually, path cost = sum of step costse.g., number of moves of the empty tileExample: 8-puzzle1234567812345678Initial stateGoal stateExample: 8-puzzleSize of the state space = 9!/2 = 181,440

15-puzzle .65 x 1012

24-puzzle .5 x 102510 million states/sec0.18 sec6 days12 billion yearsExample: Robot navigationWhat is the state space?Example: Robot navigationCost of one horizontal/vertical step = 1Cost of one diagonal step = 2 Example: Robot navigationAssumptions in Basic SearchThe environment is staticThe environment is discretizableThe environment is observableThe actions are deterministic

Simple Agent AlgorithmProblem-Solving-Agentinitial-state sense/read stategoal select/read goalsuccessor select/read action modelsproblem (initial-state, goal, successor)solution search(problem)perform(solution)Search of State SpaceSearch of State SpaceSearch of State SpaceSearch of State SpaceSearch of State SpaceSearch of State Space search treeBasic Search Concepts Search tree Search node Node expansion Search strategy: At each stage it determines which node to expandSearch Nodes States123456781234567812345678135681345678247212345678The search tree may be infinite evenwhen the state space is finite14 Jan 2004CS 3243 - Blind Search30Implementation: states vs. nodesA state is a (representation of) a physical configurationA node is a data structure constituting part of a search tree includes state, parent node, action, path cost g(x), depth

The Expand function creates new nodes, filling in the various fields and using the SuccessorFn of the problem to create the corresponding states.

Node Data Structure STATE PARENT ACTION COST DEPTHIf a state is too large, it maybe preferable to only represent theinitial state and (re-)generate theother states when neededFringe Set of search nodes that have not been expanded yet Implemented as a queue FRINGEINSERT(node,FRINGE)REMOVE(FRINGE) The ordering of the nodes in FRINGE defines the search strategySearch AlgorithmIf GOAL?(initial-state) then return initial-stateINSERT(initial-node,FRINGE)Repeat:If FRINGE is empty then return failuren REMOVE(FRINGE)s STATE(n)For every state s in SUCCESSORS(s)Create a node nIf GOAL?(s) then return path or goal stateINSERT(n,FRINGE)

Search StrategiesA strategy is defined by picking the order of node expansionPerformance Measures:Completeness does it always find a solution if one exists?Time complexity number of nodes generated/expandedSpace complexity maximum number of nodes in memoryOptimality does it always find a least-cost solutionTime and space complexity are measured in terms ofb maximum branching factor of the search treed depth of the least-cost solutionm maximum depth of the state space (may be )Remark Some problems formulated as search problems are NP-hard (non-deterministic polynomial-time hard) problems. We cannot expect to solve such a problem in less than exponential time in the worst-case But we can nevertheless strive to solve as many instances of the problem as possible Blind vs. Heuristic Strategies Blind (or uninformed) strategies do not exploit any of the information contained in a state (or use only the information available in the problem definition)

Heuristic (or informed) strategies exploits such information to assess that one node is more promising than anotherBlind Strategies Breadth-firstBidirectional

Depth-firstDepth-limited Iterative deepening

Uniform-Cost Step cost = 1Step cost = c(action) > 0 Breadth-First Strategy New nodes are inserted at the end of FRINGE2345167FRINGE = (1)Breadth-First Strategy New nodes are inserted at the end of FRINGEFRINGE = (2, 3)2345167Breadth-First Strategy New nodes are inserted at the end of FRINGEFRINGE = (3, 4, 5)2345167Breadth-First Strategy New nodes are inserted at the end of FRINGEFRINGE = (4, 5, 6, 7)2345167Evaluation b: branching factor d: depth of shallowest goal node Complete Optimal if step cost is 1 Number of nodes generated:1 + b + b2 + + bd + b(bd-1) = O(bd+1) Time and space complexity is O(bd+1) Time and Memory Requirementsd#NodesTimeMemory2111.01 msec11 Kbytes411,1111 msec1 Mbyte6~1061 sec100 Mb8~108100 sec10 Gbytes10~10102.8 hours1 Tbyte12~101211.6 days100 Tbytes14~10143.2 years10,000 TbAssumptions: b = 10; 1,000,000 nodes/sec; 100bytes/nodeBidirectional Strategy2 fringe queues: FRINGE1 and FRINGE2Time and space complexity = O(bd/2) 0. The cost of the path to each fringe node N is g(N) = costs of all steps. The goal is to generate a solution path of minimal cost. The queue FRINGE is sorted in increasing cost.S01A5B15CSGABC51151055G11G10Uniform-Cost Strategy

Summary Search tree state space Search strategies: breadth-first, depth-first, and variants Evaluation of strategies: completeness, optimality, time and space complexity Avoiding repeated states Optimal search with variable step costs