INTELLIGENT Systems

Preview:

DESCRIPTION

INTELLIGENT Systems. Prof. Magdy M. Aboul-Ela Information Systems Department Faculty of Management and Information Systems French University in Egypt Email: Magdy.aboulela@ufe.edu.eg maboulela@gmail.com maboulela@link.net. Textbook. - PowerPoint PPT Presentation

Citation preview

1

INTELLIGENT SYSTEMS

Prof. Magdy M. Aboul-ElaInformation Systems Department

Faculty of Management and Information Systems

French University in EgyptEmail: Magdy.aboulela@ufe.edu.eg

maboulela@gmail.commaboulela@link.net

2

Textbook

S. Russell and P. Norvig Artificial Intelligence: A Modern Approach Prentice Hall, 2003, Second Edition

3

Outline

• Course overview

• What is AI?

• A brief history

• The state of the art

4

Course overview

• Introduction and Agents • Search• Knowledge Representation• Symbolic Logic• Prolog• Applications

5

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.

6

What is AI?

Views of AI fall into four categories:

Thinking humanly Thinking rationally

Acting humanly Acting rationally

7

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

••

8

Thinking humanly: cognitive modeling

• 1960s "cognitive revolution": information-processing 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 from AI•

9

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. Not all intelligent behavior is mediated by logical deliberation2. What is the purpose of thinking? What thoughts should I

have?

••

10

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

11

Rational agents• An agent is an entity that perceives and acts• Abstractly, an agent is a function from percept

histories to actions: design best program for given machine resources

–• [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

• This course is about designing rational agents•

12

AI prehistory• Philosophy Logic, methods of reasoning, mind as physical

system foundations of learning, language,rationality

• Mathematics Formal representation and proof algorithms,computation, (un)decidability, (in)tractability,probability

• Economics utility, decision theory • Neuroscience physical substrate for mental activity• Psychology phenomena of perception and motor control,

experimental techniques• Computer building fast computers

engineering• Control theory design systems that maximize an objective

function over time • Linguistics knowledge representation, grammar

13

Abridged history of AI• 1943 McCulloch & Pitts: Boolean circuit model of brain• 1950 Turing's "Computing Machinery and Intelligence"• 1956 Dartmouth meeting: "Artificial Intelligence" adopted• 1952—69 Look, Ma, no hands! • 1950s Early AI programs, including Samuel's checkers

program, Newell & Simon's Logic Theorist, Gelernter's Geometry Engine

• 1965 Robinson's complete algorithm for logical reasoning• 1966—73 AI discovers computational complexity

Neural network research almost disappears• 1969—79 Early development of knowledge-based systems• 1980-- AI becomes an industry • 1986-- Neural networks return to popularity• 1987-- AI becomes a science • 1995-- The emergence of intelligent agents

14

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

15

Intelligent Agents

16

Outline

• Agents and environments

• Rationality

• PEAS (Performance measure, Environment, Actuators, Sensors)

• Environment types

• Agent types

17

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

••

18

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• agent = architecture + program

19

Vacuum-cleaner world

• Percepts: location and contents, e.g., [A,Dirty]

• Actions: Left, Right, Suck, NoOp

20

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 consumed, amount of noise generated, etc.

••

21

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.

22

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)

••

23

PEAS

• PEAS: Performance measure, Environment, Actuators, Sensors

• Must first specify the setting for intelligent agent design

•– Environment– Actuators– Sensors

• Consider, e.g., the task of designing an automated taxi driver:

• Performance measure•

24

PEAS

• Must first specify the setting for intelligent agent design

• Consider, e.g., the task of designing an automated taxi driver:– Environment: Roads, other traffic, pedestrians,

customers– Actuators: Steering wheel, accelerator,

brake, signal, horn– Sensors: Cameras, sonar,

speedometer, GPS, odometer, engine sensors, keyboard

• Performance measure: Safe, fast, legal, comfortable trip, maximize profits

25

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)

26

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

27

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

28

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 depends only on the episode itself.

••

29

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.

30

Environment typesChess with Chess without Taxi

driving a clock a clock

Fully observable Yes Yes No Deterministic Strategic Strategic No Episodic No No No Static Semi Yes No Discrete Yes Yes NoSingle agent 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

••

31

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

32

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

33

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

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 already triggered. 34

35

Simple reflex agents

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

37

Model-based reflex agents

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

39

Goal-based agents

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

41

Utility-based agents

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

43

Learning agents

Other classes of intelligent agentsThere 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 Communication Language (ACL).

46

47

Solving problems by searching

48

Outline

• Problem-solving agents

• Problem types

• Problem formulation

• Example problems

• Basic search algorithms

49

Problem-solving agents

50

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

––

–•

51

Example: Romania

52

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

––

53

Example: vacuum world

• Single-state, start in #5. Solution?

54

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?

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?

56

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]

57

Single-state problem formulationA 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 goal state

––

58

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

59

Vacuum world state space graph

• states?• actions?• goal test?• path cost?

60

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

61

Example: The 8-puzzle

• states?• actions?• goal test?• path cost?

62

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]

••

63

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•

64

Tree search algorithms

• Basic idea:– offline, simulated exploration of state space by

generating successors of already-explored states (a.k.a.~expanding states)

65

Tree search example

66

Tree search example

67

Tree search example

68

Implementation: general tree search

69

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.

70

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 ∞)

––

71

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

72

Breadth-first search

• Expand shallowest unexpanded node– fringe is a FIFO queue, i.e., new successors

go at end

• Implementation:

73

Breadth-first search

• Expand shallowest unexpanded node– fringe is a FIFO queue, i.e., new successors

go at end

• Implementation:

74

Breadth-first search

• Expand shallowest unexpanded node

• Implementation:– fringe is a FIFO queue, i.e., new successors

go at end

75

Breadth-first search

• Expand shallowest unexpanded node– fringe is a FIFO queue, i.e., new successors

go at end

• Implementation:

76

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)

•••

77

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 ≥ ε• Space? # of nodes with g ≤ cost of optimal solution,

O(bceiling(C*/ ε))• Optimal? Yes – nodes expanded in increasing order of

g(n)

•• Time? # of nodes with g ≤ cost of optimal

solution, O(bceiling(C*/ ε)) where C* is the cost of the optimal solution

78

Depth-first search

• Expand deepest unexpanded node– fringe = LIFO queue, i.e., put successors at front

• Implementation:

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– fringe = LIFO queue, i.e., put successors at front

• Implementation:

81

Depth-first search

• Expand deepest unexpanded node– fringe = LIFO queue, i.e., put successors at front

• Implementation:

82

Depth-first search

• Expand deepest unexpanded node– fringe = LIFO queue, i.e., put successors at front

• Implementation:

83

Depth-first search

• Expand deepest unexpanded node– fringe = LIFO queue, i.e., put successors at front

• Implementation:

84

Depth-first search

• Expand deepest unexpanded node– fringe = LIFO queue, i.e., put successors at front

• Implementation:

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– fringe = LIFO queue, i.e., put successors at front

• Implementation:

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

Depth-first search

• Expand deepest unexpanded node• Implementation:

– fringe = LIFO queue, i.e., put successors at front

90

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

91

Depth-limited search

= depth-first search with depth limit l,

i.e., nodes at depth l have no successors

• Recursive implementation:

92

Iterative deepening search

93

Iterative deepening search l =0

94

Iterative deepening search l =1

95

Iterative deepening search l =2

96

Iterative deepening search l =3

97

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%

98

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

99

Summary of algorithms

100

Repeated states

• Failure to detect repeated states can turn a linear problem into an exponential one!

101

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

Recommended