Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Multi-armed bandit wikipedia , lookup
Ethics of artificial intelligence wikipedia , lookup
Soar (cognitive architecture) wikipedia , lookup
History of artificial intelligence wikipedia , lookup
Collaborative information seeking wikipedia , lookup
Agent-based model in biology wikipedia , lookup
Agent-based model wikipedia , lookup
Cognitive model wikipedia , lookup
INTELLIGENT SYSTEMS Prof. Magdy M. Aboul-Ela Information Systems Department Faculty of Management and Information Systems French University in Egypt Email: [email protected] [email protected] [email protected] 1 Textbook S. Russell and P. Norvig Artificial Intelligence: A Modern Approach Prentice Hall, 2003, Second Edition 2 Outline • • • • Course overview What is AI? A brief history The state of the art 3 Course overview • • • • • • Introduction and Agents Search Knowledge Representation Symbolic Logic Prolog Applications 4 What is an Artificial Intelligence (AI) ? • AI attempts to build intelligent entities • AI is both science and engineering: – the science of understanding intelligent entities — of developing theories which attempt to explain and predict the nature of such entities; – the engineering of intelligent entities. 5 What is AI? Views of AI fall into four categories: Thinking humanly Thinking rationally Acting humanly Acting rationally 6 Acting humanly: Turing Test • Turing (1950) "Computing machinery and intelligence": • "Can machines think?" "Can machines behave intelligently?" • Operational test for intelligent behavior: the Imitation Game • Predicted that by 2000, a machine might have a 30% chance of fooling a lay person for 5 minutes • Anticipated all major arguments against AI in following 50 years • Suggested major components of AI: knowledge, reasoning, language understanding, learning • 7 Thinking humanly: cognitive modeling • 1960s "cognitive revolution": informationprocessing psychology • • Requires scientific theories of internal activities of the brain • • -- How to validate? Requires 1) Predicting and testing behavior of human subjects (top-down) or 2) Direct identification from neurological data (bottom-up) • Both approaches (roughly, Cognitive Science and Cognitive Neuroscience) are now distinct 8 Thinking rationally: "laws of thought" • • • • • • • Aristotle: what are correct arguments/thought processes? Several Greek schools developed various forms of logic: notation and rules of derivation for thoughts; may or may not have proceeded to the idea of mechanization Direct line through mathematics and philosophy to modern AI Problems: 1. 2. Not all intelligent behavior is mediated by logical deliberation What is the purpose of thinking? What thoughts should I have?9 Acting rationally: rational agent • Rational behavior: doing the right thing • • The right thing: that which is expected to maximize goal achievement, given the available information • • Doesn't necessarily involve thinking – e.g., blinking reflex – but thinking should be in the service of rational action 10 Rational agents • An agent is an entity that perceives and acts • This course is about designing rational agents • • Abstractly, an agent is a function from percept histories to actions: • [f: P* A] • For any given class of environments and tasks, we seek the agent (or class of agents) with the best performance • Caveat: computational limitations make perfect rationality unachievable design best program for given machine resources 11 AI prehistory • Philosophy • Mathematics • Economics • Neuroscience • Psychology • Computer engineering • Control theory • Linguistics Logic, methods of reasoning, mind as physical system foundations of learning, language, rationality Formal representation and proof algorithms, computation, (un)decidability, (in)tractability, probability utility, decision theory physical substrate for mental activity phenomena of perception and motor control, experimental techniques building fast computers design systems that maximize an objective function over time knowledge representation, grammar 12 Abridged history of AI • • • • • 1943 1950 1956 1952—69 1950s • 1965 • 1966—73 • • • • • 1969—79 1980-1986-1987-1995-- McCulloch & Pitts: Boolean circuit model of brain Turing's "Computing Machinery and Intelligence" Dartmouth meeting: "Artificial Intelligence" adopted Look, Ma, no hands! Early AI programs, including Samuel's checkers program, Newell & Simon's Logic Theorist, Gelernter's Geometry Engine Robinson's complete algorithm for logical reasoning AI discovers computational complexity Neural network research almost disappears Early development of knowledge-based systems AI becomes an industry Neural networks return to popularity AI becomes a science The emergence of intelligent agents 13 State of the art • Deep Blue defeated the reigning world chess champion Garry Kasparov in 1997 • Proved a mathematical conjecture (Robbins conjecture) unsolved for decades • No hands across America (driving autonomously 98% of the time from Pittsburgh to San Diego) • During the 1991 Gulf War, US forces deployed an AI logistics planning and scheduling program that involved up to 50,000 vehicles, cargo, and people • NASA's on-board autonomous planning program controlled the scheduling of operations for a spacecraft • Proverb solves crossword puzzles better than most humans 14 Intelligent Agents 15 Outline • Agents and environments • Rationality • PEAS (Performance measure, Environment, Actuators, Sensors) • Environment types • Agent types 16 Agents • An agent is anything that can be viewed as perceiving its environment through sensors and acting upon that environment through actuators • • Human agent: eyes, ears, and other organs for sensors; hands, • legs, mouth, and other body parts for actuators • • Robotic agent: cameras and infrared range finders for sensors; • various motors for actuators 17 • Agents and environments • The agent function maps from percept histories to actions: • [f: P* A] • The agent program runs on the physical architecture to produce f 18 Vacuum-cleaner world • Percepts: location and contents, e.g., [A,Dirty] • • Actions: Left, Right, Suck, NoOp • 19 Rational agents • An agent should strive to "do the right thing", based on what it can perceive and the actions it can perform. The right action is the one that will cause the agent to be most successful • • Performance measure: An objective criterion for success of an agent's behavior • • E.g., performance measure of a vacuum-cleaner agent could be amount of dirt cleaned up, amount of time taken, amount of electricity 20 consumed, amount of noise generated, etc. Rational agents • Rational Agent: For each possible percept sequence, a rational agent should select an action that is expected to maximize its performance measure, given the evidence provided by the percept sequence and whatever built-in knowledge the agent has. • 21 Rational agents • Rationality is distinct from omniscience (all-knowing with infinite knowledge) • • Agents can perform actions in order to modify future percepts so as to obtain useful information (information gathering, exploration) • • An agent is autonomous if its behavior is determined by its own experience (with ability to learn and adapt) 22 PEAS • PEAS: Performance measure, Environment, Actuators, Sensors • Must first specify the setting for intelligent agent design • • Consider, e.g., the task of designing an automated taxi driver: • Performance measure • – Environment – Actuators – Sensors 23 PEAS • Must first specify the setting for intelligent agent design • • Consider, e.g., the task of designing an automated taxi driver: • Performance measure: Safe, fast, legal, comfortable trip, maximize profits • – Environment: Roads, other traffic, pedestrians, customers – Actuators: Steering wheel, accelerator, brake, signal, horn – Sensors: Cameras, sonar, speedometer, GPS, odometer, engine sensors, keyboard 24 PEAS • Agent: Medical diagnosis system • Performance measure: Healthy patient, minimize costs, lawsuits • Environment: Patient, hospital, staff • Actuators: Screen display (questions, tests, diagnoses, treatments, referrals) • • Sensors: Keyboard (entry of symptoms, findings, patient's answers) 25 PEAS • Agent: Part-picking robot • Performance measure: Percentage of parts in correct bins • Environment: Conveyor belt with parts, bins • Actuators: Jointed arm and hand • Sensors: Camera, joint angle sensors 26 PEAS • Agent: Interactive English tutor • Performance measure: Maximize student's score on test • Environment: Set of students • Actuators: Screen display (exercises, suggestions, corrections) • Sensors: Keyboard 27 Environment types • Fully observable (vs. partially observable): An agent's sensors give it access to the complete state of the environment at each point in time. • • Deterministic (vs. stochastic): The next state of the environment is completely determined by the current state and the action executed by the agent. (If the environment is deterministic except for the actions of other agents, then the environment is strategic) • • Episodic (vs. sequential): The agent's experience is divided into atomic "episodes" (each episode consists of the agent perceiving and then performing a single action), and the choice of action in each episode 28 depends only on the episode itself. Environment types • Static (vs. dynamic): The environment is unchanged while an agent is deliberating. (The environment is semidynamic if the environment itself does not change with the passage of time but the agent's performance score does) • • Discrete (vs. continuous): A limited number of distinct, clearly defined percepts and actions. • • Single agent (vs. multiagent): An agent operating by itself in an environment. 29 Environment types Fully observable Deterministic Episodic Static Discrete Single agent Chess with a clock Yes Strategic No Semi Yes No Chess without a clock Yes Strategic No Yes Yes No Taxi driving No No No No No No • The environment type largely determines the agent design • • The real world is (of course) partially observable, stochastic, sequential, dynamic, continuous, multi-agent • 30 Agent functions and programs • An agent is completely specified by the agent function mapping percept sequences to actions • One agent function (or a small equivalence class) is rational • • Aim: find a way to implement the rational agent function concisely • 31 Table-lookup agent • Drawbacks: – Huge table – Take a long time to build the table – No autonomy – Even with learning, need a long time to learn the table entries 32 Agent types • Four basic types in order of increasing generality: • • Simple reflex agents • Model-based reflex agents • Goal-based agents • Utility-based agents • Learning agents 33 Simple reflex agents • Simple reflex agents act only on the basis of the current percept. The agent function is based on the condition-action rule: if condition then action. • This agent function only succeeds when the environment is fully observable. Some reflex agents can also contain information on their current state which allows them to disregard conditions whose actuators are 34 already triggered. Simple reflex agents 35 Model-based agents • Model-based agents can handle partially observable environments. Its current state is stored inside the agent maintaining some kind of structure which describes the part of the world which cannot be seen. • This behavior requires information on how the world behaves and works. This additional information completes the “World View” model. • A model-based reflex agent keeps track of the current state of the world using an internal model. It then chooses an action in the same way as the reflex agent. 36 Model-based reflex agents 37 Goal-based agents • Goal-based agents are model-based agents which store information regarding situations that are desirable. • This allows the agent a way to choose among multiple possibilities, selecting the one which reaches a goal state. 38 Goal-based agents 39 Utility-based agents • Goal-based agents only distinguish between goal states and non-goal states. It is possible to define a measure of how desirable a particular state is. • This measure can be obtained through the use of a utility function which maps a state to a measure of the utility of the state. 40 Utility-based agents 41 Learning agents • Learning has an advantage that it allows the agents to initially operate in unknown environments and to become more competent than its initial knowledge alone might allow. 42 Learning agents 43 Other classes of intelligent agents There are some of the sub-agents that may be a part of an Intelligent Agent or a complete Intelligent Agent in themselves are: • • • • • • • • Decision Agents (that are geared to decision making); Input Agents (that process and make sense of sensor inputs - e.g. neural network based agents); Processing Agents (that solve a problem like speech recognition); Spatial Agents (that relate to the physical real-world); World Agents (that incorporate a combination of all the other classes of agents to allow autonomous behaviors). Believable agents - An agent exhibiting a personality via the use of an artificial character (the agent is embedded) for the interaction. Physical Agents - A physical agent is an entity which percepts through sensors and acts through actuators. Temporal Agents - A temporal agent may use time based stored information to offer instructions or data acts to a computer program or human being and takes program inputs percepts to adjust its next behaviors. 44 Multi-Agent System (MAS) • A multi-agent system (MAS) is a system composed of multiple interacting intelligent agents. • Multi-agent systems can be used to solve problems which are difficult or impossible for an individual agent or monolithic system to solve. • Examples of problems which are appropriate to multi-agent systems research include online trading, disaster response, and modelling social structures. 45 Multi-Agent System (MAS) The agents in a multi-agent system have several important characteristics: • Autonomy: the agents are at least partially autonomous • Local views: no agent has a full global view of the system, or the system is too complex for an agent to make practical use of such knowledge • Decentralization: there is no designated controlling agent (or the system is effectively reduced to a monolithic system) • • • Typically multi-agent systems research refers to software agents. However, the agents in a multi-agent system could equally well be robots, humans or human teams. A multi-agent system may contain combined human-agent teams. Multi-agent systems can manifest self-organization and complex behaviors even when the individual strategies of all their agents are simple. Agents can share knowledge using any agreed language, within the constraints of the system's communication protocol. Example languages are Knowledge Query Manipulation Language (KQML) or FIPA's Agent 46 Communication Language (ACL). Solving problems by searching 47 Outline • • • • • Problem-solving agents Problem types Problem formulation Example problems Basic search algorithms 48 Problem-solving agents 49 Example: Romania • On holiday in Romania; currently in Arad. • Flight leaves tomorrow from Bucharest • • Formulate goal: – be in Bucharest – • Formulate problem: – states: various cities – actions: drive between cities – • Find solution: – sequence of cities, e.g., Arad, Sibiu, Fagaras, Bucharest 50 Example: Romania 51 Problem types • Deterministic, fully observable single-state problem – Agent knows exactly which state it will be in; solution is a sequence – • Non-observable sensorless problem (conformant problem) – Agent may have no idea where it is; solution is a sequence – • Nondeterministic and/or partially observable contingency problem – percepts provide new information about current state – often interleave} search, execution – • Unknown state space exploration problem 52 Example: vacuum world • Single-state, start in #5. Solution? • 53 Example: vacuum world • Single-state, start in #5. Solution? [Right, Suck] • • Sensorless, start in {1,2,3,4,5,6,7,8} e.g., Right goes to {2,4,6,8} Solution? • 54 Example: vacuum world • Sensorless, start in {1,2,3,4,5,6,7,8} e.g., Right goes to {2,4,6,8} Solution? [Right,Suck,Left,Suck] • • Contingency – Nondeterministic: Suck may dirty a clean carpet – Partially observable: location, dirt at current location. – Percept: [L, Clean], i.e., start in #5 or #7 Solution? 55 Example: vacuum world • Sensorless, start in {1,2,3,4,5,6,7,8} e.g., Right goes to {2,4,6,8} Solution? [Right,Suck,Left,Suck] • • Contingency – Nondeterministic: Suck may dirty a clean carpet – Partially observable: location, dirt at current location. – Percept: [L, Clean], i.e., start in #5 or #7 Solution? [Right, if dirt then Suck] 56 Single-state problem formulation A problem is defined by four items: 1. initial state e.g., "at Arad" 2. actions or successor function S(x) = set of action–state pairs – e.g., S(Arad) = {<Arad Zerind, Zerind>, … } – 3. goal test, can be – explicit, e.g., x = "at Bucharest" – implicit, e.g., Checkmate(x) – 4. path cost (additive) – e.g., sum of distances, number of actions executed, etc. – c(x,a,y) is the step cost, assumed to be ≥ 0 – • A solution is a sequence of actions leading from the initial state to a 57 goal state Selecting a state space • Real world is absurdly complex state space must be abstracted for problem solving • (Abstract) state = set of real states • (Abstract) action = complex combination of real actions – e.g., "Arad Zerind" represents a complex set of possible routes, detours, rest stops, etc. • For guaranteed realizability, any real state "in Arad“ must get to some real state "in Zerind" • (Abstract) solution = – set of real paths that are solutions in the real world • Each abstract action should be "easier" than the original problem 58 Vacuum world state space graph • • • • • states? actions? goal test? path cost? 59 Vacuum world state space graph • • • • states? integer dirt and robot location actions? Left, Right, Suck goal test? no dirt at all locations path cost? 1 per action 60 Example: The 8-puzzle • • • • states? actions? goal test? path cost? 61 Example: The 8-puzzle • • • • • states? locations of tiles actions? move blank left, right, up, down goal test? = goal state (given) path cost? 1 per move [Note: optimal solution of n-Puzzle family is NP-hard] 62 Example: robotic assembly • states?: real-valued coordinates of robot joint angles parts of the object to be assembled • • actions?: continuous motions of robot joints • goal test?: complete assembly • path cost?: time to execute 63 Tree search algorithms • Basic idea: – offline, simulated exploration of state space by generating successors of already-explored states (a.k.a.~expanding states) – 64 Tree search example 65 Tree search example 66 Tree search example 67 Implementation: general tree search 68 Implementation: states vs. nodes • A state is a (representation of) a physical configuration • A 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. • 69 Search strategies • A search strategy is defined by picking the order of node expansion • Strategies are evaluated along the following dimensions: – – – – – completeness: does it always find a solution if one exists? time complexity: number of nodes generated space complexity: maximum number of nodes in memory optimality: does it always find a least-cost solution? • Time and space complexity are measured in terms of – b: maximum branching factor of the search tree – d: depth of the least-cost solution – m: maximum depth of the state space (may be ∞) – 70 Uninformed search strategies • Uninformed search strategies use only the information available in the problem definition: – Breadth-first search – Uniform-cost search – Depth-first search – Depth-limited search – Iterative deepening search 71 Breadth-first search • Expand shallowest unexpanded node • Implementation: – fringe is a FIFO queue, i.e., new successors go at end – 72 Breadth-first search • Expand shallowest unexpanded node • Implementation: – fringe is a FIFO queue, i.e., new successors go at end – 73 Breadth-first search • Expand shallowest unexpanded node • • Implementation: – fringe is a FIFO queue, i.e., new successors go at end – 74 Breadth-first search • Expand shallowest unexpanded node • Implementation: – fringe is a FIFO queue, i.e., new successors go at end – 75 Properties of breadth-first search • • • • • • • • Complete? Yes (if b is finite) Time? 1+b+b2+b3+… +bd + b(bd-1) = O(bd+1) Space? O(bd+1) (keeps every node in memory) Optimal? Yes (if cost = 1 per step) • Space is the bigger problem (more than time) 76 Uniform-cost search • Expand least-cost unexpanded node • • Implementation: – fringe = queue ordered by path cost • Equivalent to breadth-first if step costs all equal • • Complete? Yes, if step cost ≥ ε • Time? # of nodes with g ≤ cost of optimal solution, O(bceiling(C*/ ε)) where C* is the cost of the optimal solution • Space? # of nodes with g ≤ cost of optimal solution, O(bceiling(C*/ ε)) • Optimal? Yes – nodes expanded in increasing order of g(n) 77 • Depth-first search • Expand deepest unexpanded node • Implementation: – fringe = LIFO queue, i.e., put successors at front – 78 Depth-first search • Expand deepest unexpanded node • • Implementation: – fringe = LIFO queue, i.e., put successors at front – 79 Depth-first search • Expand deepest unexpanded node • Implementation: – fringe = LIFO queue, i.e., put successors at front – 80 Depth-first search • Expand deepest unexpanded node • Implementation: – fringe = LIFO queue, i.e., put successors at front – 81 Depth-first search • Expand deepest unexpanded node • Implementation: – fringe = LIFO queue, i.e., put successors at front – 82 Depth-first search • Expand deepest unexpanded node • Implementation: – fringe = LIFO queue, i.e., put successors at front – 83 Depth-first search • Expand deepest unexpanded node • Implementation: – fringe = LIFO queue, i.e., put successors at front – 84 Depth-first search • Expand deepest unexpanded node • Implementation: – fringe = LIFO queue, i.e., put successors at front – 85 Depth-first search • Expand deepest unexpanded node • Implementation: – fringe = LIFO queue, i.e., put successors at front – 86 Depth-first search • Expand deepest unexpanded node • Implementation: – fringe = LIFO queue, i.e., put successors at front – 87 Depth-first search • Expand deepest unexpanded node • Implementation: – fringe = LIFO queue, i.e., put successors at front – 88 Depth-first search • Expand deepest unexpanded node • Implementation: – fringe = LIFO queue, i.e., put successors at front – 89 Properties of depth-first search • Complete? No: fails in infinite-depth spaces, spaces with loops – Modify to avoid repeated states along path – complete in finite spaces • Time? O(bm): terrible if m is much larger than d – but if solutions are dense, may be much faster than breadth-first • Space? O(bm), i.e., linear space! • Optimal? No 90 Depth-limited search = depth-first search with depth limit l, i.e., nodes at depth l have no successors • Recursive implementation: 91 Iterative deepening search 92 Iterative deepening search l =0 93 Iterative deepening search l =1 94 Iterative deepening search l =2 95 Iterative deepening search l =3 96 Iterative deepening search • Number of nodes generated in a depth-limited search to depth d with branching factor b: NDLS = b0 + b1 + b2 + … + bd-2 + bd-1 + bd • Number of nodes generated in an iterative deepening search to depth d with branching factor b: NIDS = (d+1)b0 + d b^1 + (d-1)b^2 + … + 3bd-2 +2bd-1 + 1bd • For b = 10, d = 5, – NDLS = 1 + 10 + 100 + 1,000 + 10,000 + 100,000 = 111,111 – – NIDS = 6 + 50 + 400 + 3,000 + 20,000 + 100,000 = 123,456 – • Overhead = (123,456 - 111,111)/111,111 = 11% 97 Properties of iterative deepening search • Complete? Yes • • Time? (d+1)b0 + d b1 + (d-1)b2 + … + bd = O(bd) • • Space? O(bd) • • Optimal? Yes, if step cost = 1 98 Summary of algorithms 99 Repeated states • Failure to detect repeated states can turn a linear problem into an exponential one! • 100 Summary • Problem formulation usually requires abstracting away real-world details to define a state space that can feasibly be explored • • Variety of uninformed search strategies • • Iterative deepening search uses only linear space and not much more time than other uninformed algorithms • 101