last time: summary

28
1 Last time: Summary Definition of AI? Definition of AI? Turing Test? Intelligent Agents: Anything that can be viewed as perceiving its environment through sensors and acting upon that environment 1 acting upon that environment through its effectors to maximize progress towards its goals. PAGE (Percepts, Actions, Goals, Environment) Described as a Perception (sequence) to Action Mapping: f : P* A Using look-up-table, closed form, etc. Last time: Summary Agent Types: Reflex, state-based, goal- based, utility-based Rational Action: The action that 2 Rational Action: The action that maximizes the expected value of the performance measure given the percept sequence to date

Upload: others

Post on 18-Dec-2021

4 views

Category:

Documents


0 download

TRANSCRIPT

1

Last time: SummaryDefinition of AI?Definition of AI?Turing Test?Intelligent Agents:

Anything that can be viewed asperceiving its environment

through sensors and acting upon that environment

1

acting upon that environment through its effectors to maximize progress towards its goals. PAGE (Percepts, Actions, Goals, Environment)

Described as a Perception (sequence) to Action Mapping: f : P* → AUsing look-up-table, closed form, etc.

Last time: Summary

Agent Types: Reflex, state-based, goal-based, utility-based

Rational Action: The action that

2

Rational Action: The action that maximizes the expected value of the performance measure given the percept sequence to date

2

Outline: Problem solving and search

Introduction to Problem SolvingIntroduction to Problem Solving

Complexity

Uninformed search

3

Uninformed searchProblem formulationSearch strategies: depth-first, breadth-first

Outline: Problem solving and search

Informed searchSearch strategies: best-first, A*Heuristic functions

4

3

Example: Measuring problem!

3 l 5 l9 l

5

Problem: Using these three buckets, measure 7 liters of water.

Problem-Solving Agenttion

//From LA to San Diego (given current state)//e.g. Gas usage

//What is the current state?

6

Note: This is offline problem-solving. Online problem-solving involves acting w/o complete knowledge of the problem and environment

//If fails to reach goal, update

4

Example: Buckets

Measure 7 liters of water using a 3 liter a 5Measure 7 liters of water using a 3 liter, a 5 liter, and a 9 liter bucket.Formulate goal: Have 7 liters of water in 9-liter bucketFormulate problem:

St t t f t i th b k t

7

States: amount of water in the bucketsOperators: Fill bucket from source, empty bucket

Find solution: sequence of operators that bring you from current state to the goal state

Remember (lecture 2): Environment types

Environment Accessibl Deterministi Episodic Static Discretee c

Operating System

Yes Yes No No Yes

Virtual Reality Yes Yes Yes/No No Yes/No

Office Environment

No No No No No

8

Mars No Semi No Semi NoThe environment types largely determine the agent design.

•Accessible: The complete states of the environment is accessible.

•Deterministic: The next state is determinable from the current state and the action.

5

Problem types

Single state problem: deterministicSingle-state problem: deterministic, accessible

Agent knows everything about world (the exact state), Can calculate optimal action sequence to reach goal state.

9

state.E.g. playing chess. Any action will result in an exact state

Problem typesMultiple-state problem: deterministic,Multiple state problem: deterministic, inaccessible

Agent does not know the exact state (could be in any of the possible states)

May not have sensor at all

Assume states while working towards goal state.

10

E.g. walking in a dark roomIf you are at the door, going straight will lead you to the kitchenIf you are at the kitchen, turning left leads you to the bedroom…

6

Problem typesContingency problem:Contingency problem:

nondeterministic, inaccessibleMust use sensors during executionSolution is a tree or policyOften interleave search and execution

k

11

E.g. A new skater in an arenaSliding problem.Many skaters around

Problem types

E l ti bl kExploration problem: unknown state spaceDiscover and learn about environment while taking actions.

E.g. Maze

12

E.g. Maze

7

Example: Vacuum worldSimplified world: 2 locations, each may or not contain dirt,p y

each may or not contain vacuuming agent.Goal of agent: clean up the dirt.

13

Example: RomaniaFormulate problem:Formulate problem:states: various citiesoperators: drive between cities

Find solution:

14

Find solution:sequence of cities, such that total driving distance is minimized.

8

Example: Traveling from Arad To Bucharest

15

Problem formulation

16

9

Selecting a state space

Real world is absurdly complex;Real world is absurdly complex;

17

Example: 8-puzzle

State:

start state goal state

18

State: Operators:Goal test:Path cost:

10

Example: 8-puzzle

start state goal state

Why search algorithms?

19

Back to Vacuum World

20

11

Example: Robotic Assembly

21

& w

ire c

ross

ing

cs;

bout

pla

cem

ent

&

22Ente

r sc

hem

ati

do n

ot w

orry

ab

12

23

Real-life example: VLSI LayoutQ: How to put these chips and connectionQ: How to put these chips and connection on a board?

24

13

Real-life example: VLSI Layout“optimal way”??p y

minimize surface areaminimize number of signal layersminimize number of vias (connections from one layer to another)

25

to another)minimize length of some signal lines (e.g., clock line)distribute heat throughout boardetc.

ompo

nent

sd

tool

s to

pla

ce c

ong

.

26Use

aut

omat

edan

d ro

ute

wiri

n

14

27

Search algorithms

Basic idea:

offline, systematic exploration of simulated state-space by generating successors of explored states (expanding)

28

15

Search algorithmsFunction General-Search(problem, strategy) returns a

solution, or failurei iti li th h t i th i iti l t t blinitialize the search tree using the initial state problemloop do

if there are no candidates for expansion then return failure

choose a leaf node for expansion according to strategy

29

gyif the node contains a goal state then return the

corresponding solutionelse expand the node and add resulting nodes to

the search treeend

Example: Traveling from Arad To Bucharest

30

16

From problem space to search tree

Some material in this and following slides is fromSome material in this and following slides is fromhttp://www.cs.kuleuven.ac.be/~dannyd/FAI/ check it out!

AA BB CC33 44 44

Problem space

31

DD EE FFGGSS

4444

55 553322

From problem space to search tree

AA BB CC33 44 44

DD EE FFGGSS

4444

55 553322

SSAA DD

BB DD EEAA

33

22

2244

44 44

44

44

5555

55 55

Problem space

Associated

32

CC EE EE BB BB FF

DD FF BB FF CC EE AA CC GG

GG CC GG FF

GG

33 33

33

33

22

22

44

4444

44

4444

44

4444

44

55 55

5555loop-freesearch tree

17

Paths in search trees

SSDenotes:Denotes: SSAA DD

BB DD EEAA

CC EE EE BB BB FF

DD FF BB FF CC EE AA CC GG

Denotes:Denotes:SASA Denotes:Denotes:SDASDA

33

DD FF BB FF CC EE AA CC GG

GG CC GG FF

GG

Denotes:Denotes:SDEBASDEBA

General search example

34

18

General search example

35

General search example

36

19

General search example

37

Implementation of search algorithms

Function General-Search(problem Queuing-Fn) returns aFunction General Search(problem, Queuing Fn) returns a solution, or failurenodes make-queue(make-node(initial-state[problem]))loop do

if nodes is empty then return failurenode Remove-Front(nodes)

38

if Goal-Test[problem] applied to State(node)succeeds then return node

nodes Queuing-Fn(nodes, Expand(node, Operators[problem]))end

20

Encapsulating stateinformation in nodes

39

Evaluation of search strategiesA search strategy is defined by picking the order gy y p gof node expansion.

Four evaluation criteria:Completeness:

40

Time complexity:

Space complexity:

Optimality:

21

Evaluation of search strategiesTime and space complexity are measuredTime and space complexity are measured in terms of:

b – max branching factor of the search treed – depth of the least-cost solutionm – max depth of the search tree (may be i fi i )

41

infinity)

Binary Tree ExampleDepth = 0 root

N1 N2

N3 N5

Depth = 0

Depth = 1

D h 2

42

N3 N4 N5 N6

Number of nodes: n = ?Number of levels (max depth) = ?

Depth = 2

22

Complexity

Why worry about complexity ofWhy worry about complexity of algorithms?

43

Complexity: Tower of Honoi

44

23

Complexity: Tower of Honoi

3 Disk problem: 23 1 7 moves• 3 Disk problem: 23- 1 = 7 moves• 64 disk problem: 264 - 1.

• 210 = 1024 ≈ 1000 = 103,• 264 = 24 * 260 ≈ 24 * 1018 =

19

45

1.6 * 1019

• One year ≈ 3.2 * 107. “

Complexity

How can we evaluate the complexity ofHow can we evaluate the complexity of algorithms?

through asymptotic analysis, i.e., estimate time (or number of operations) necessary

46

time (or number of operations) necessary to solve an instance of size n of a problem when n tends towards infinity

See AIMA, Appendix A.

24

Complexity example: Traveling Salesman Problem

• There are n cities with a road of length L• There are n cities, with a road of length Lijjoining city i to city j.

• Visit all cities considering:• each city is visited only once, and• the total route is as short as possible.

47

Why is exponential complexity “hard”?

It means that the number of operations necessaryIt means that the number of operations necessary to compute the exact solution of the problem grows exponentially with the size of the problem (here, the number of cities).

(1) 2 72

48

exp(1) = 2.72exp(10) = 2.20 104 (daily salesman trip)

25

Why is exponential complexity “hard”?

exp(1) = 2.72

exp(10) = 2.20 104 (daily salesman trip)

exp(100) = 2.69 1043 (monthly salesman planning)

exp(500) = 1.40 10217 (music band worldwide tour)

49

exp(250,000) = 10108,573 (fedex, postal services)

Fastest computer = 1012 operations/second

So…

In general, exponential-complexity bl t b l d f

50

problems cannot be solved for any but the smallest instances!

26

Complexity

Polynomial time (P) problems:Polynomial-time (P) problems:

Example: sort n numbers into increasing

51

order:poor algorithms have n^2 complexity, better ones have n log(n) complexity.

Complexity

Question: Are there algorithms that requireQuestion: Are there algorithms that require more than polynomial time?Yes

52

In particular, exponential-time algorithms are believed to be NP.

27

Note on NP-hard problems

The formal definition of NP problems:The formal definition of NP problems:

A problem is nondeterministic polynomialif there exists some algorithm that can guess a solution and then verify whether or not the guess is correct in

53

whether or not the guess is correct in polynomial time.

Complexity and the human brain

Current computer chip (CPU):10^3 inputs (pins)10^7 processing elements (gates)

54

2 inputs per processing element (fan-in = 2)processing elements compute boolean logic (OR, AND, NOT, etc)

28

Complexity and the human brain

Typical human brain:10^7 inputs (sensors)10^10 processing elements (neurons)fan-in = 10^3

55

processing elements compute complicated functions

Still a lot of improvement needed for computers; butcomputer clusters come close!