computer simulation (1). 8 a (8) initial state 44 goal state b (5) c (3) a (8) b (5) c (3) step 1...

26
Computer Simulation (1)

Post on 20-Dec-2015

222 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Computer Simulation (1). 8 A (8) Initial State 44 Goal State B (5) C (3) A (8) B (5) C (3) Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7

Computer Simulation (1)

Page 2: Computer Simulation (1). 8 A (8) Initial State 44 Goal State B (5) C (3) A (8) B (5) C (3) Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7

8

A(8)

Initial State

4 4

Goal State

B(5)

C(3)

A(8)

B(5)

C(3)

Step 1

Step 2

Step 3

Step 4

Step 5

Step 6

Step 7

Page 3: Computer Simulation (1). 8 A (8) Initial State 44 Goal State B (5) C (3) A (8) B (5) C (3) Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7

Some fun (and difficult!) games

• Theseus and the Minotaur:– http://www.logicmazes.com/theseus.html

• More special mazes– http://www.logicmazes.com/

Page 4: Computer Simulation (1). 8 A (8) Initial State 44 Goal State B (5) C (3) A (8) B (5) C (3) Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7

Tower of Hanoi

INITIAL STATE GOAL STATE

?

Play the game: http://www.mazeworks.com/hanoi/

Page 5: Computer Simulation (1). 8 A (8) Initial State 44 Goal State B (5) C (3) A (8) B (5) C (3) Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7

Role of Computer Simulation

• Cognitive Science:– Simulate human behavior– Make vague terms concrete (e.g., ‘goals’, ‘memory’,

‘problem solving’)– Simulations help to think through the implications of a

complicated theory

• Artificial Intelligence:– Simulate intelligent behavior - not necessarily human

behavior – Example: chess playing programs

Page 6: Computer Simulation (1). 8 A (8) Initial State 44 Goal State B (5) C (3) A (8) B (5) C (3) Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7

Newell & Simon (1972)

• Collected verbal protocols = a record of verbalized thought processes.

• Explored computer programs for solving problems in a human way

• Refined their computer programs to be closer to protocols

Page 7: Computer Simulation (1). 8 A (8) Initial State 44 Goal State B (5) C (3) A (8) B (5) C (3) Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7

Problem solving as a search problem

Goals are often metaphorical spatial locations:– “Searching for a way to reach the goal”– “Getting around roadblocks”– “getting lost” in the middle of a solution– “hitting a dead end” and being forced to “back-track”– “Approaching the problem from a different angle”

Page 8: Computer Simulation (1). 8 A (8) Initial State 44 Goal State B (5) C (3) A (8) B (5) C (3) Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7

Representation of Problem

1) initial state

2) goal state

3) a set of legal operators

4) evaluation function: how far away is each state from goal state

Page 9: Computer Simulation (1). 8 A (8) Initial State 44 Goal State B (5) C (3) A (8) B (5) C (3) Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7

Definitions

• Search space (Problem space): the set of all states that potentially be reached by applying available operators.

• Solution: a sequence of operators that transform initial state into goal state

• A problem solving method: a procedure for finding a solution

Page 10: Computer Simulation (1). 8 A (8) Initial State 44 Goal State B (5) C (3) A (8) B (5) C (3) Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7

Problem Solving is a search problem

Initial state

Goalstate

Search Space(Problem space)

Solution

Page 11: Computer Simulation (1). 8 A (8) Initial State 44 Goal State B (5) C (3) A (8) B (5) C (3) Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7

Search spaces can be large

#DISCS #STATES

3 33 = 274 34 = 815 35 = 2436 36 = 729

Page 12: Computer Simulation (1). 8 A (8) Initial State 44 Goal State B (5) C (3) A (8) B (5) C (3) Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7

Search Strategies

• Trial and Error• Hill Climbing• Means-End Analysis

Page 13: Computer Simulation (1). 8 A (8) Initial State 44 Goal State B (5) C (3) A (8) B (5) C (3) Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7

Trial & Error

Reach goal after large number of random steps

many wasted moves

But there is a role for randomness in problem solving – when getting stuck

Page 14: Computer Simulation (1). 8 A (8) Initial State 44 Goal State B (5) C (3) A (8) B (5) C (3) Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7

Hill Climbing

At each state, assign a score – here, lower is better

At each step, choose a next state with better score

(strictly speaking, we are descending from a hill as lower scores are better in this particular example)

Initial State

Goal State

12

12

3

4 3 2

34

Page 15: Computer Simulation (1). 8 A (8) Initial State 44 Goal State B (5) C (3) A (8) B (5) C (3) Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7

Hill Climbing

Problem:

getting stuck when each next move leads to worse score

Initial State

Goal State

12

12

3

4 3 2

34

Page 16: Computer Simulation (1). 8 A (8) Initial State 44 Goal State B (5) C (3) A (8) B (5) C (3) Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7

Hill climbing

• Problem: depending on initial state, may get stuck in local maximum

Page 17: Computer Simulation (1). 8 A (8) Initial State 44 Goal State B (5) C (3) A (8) B (5) C (3) Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7

Hill Climbing

Each state has an associated score – e.g., #discs on peg 3

higher = better

From current state, go to next best state (highest score)

0

1

1

0

1

1

2

3

0

10

2

12

2

1

0

2

1

1 1

0 2

Page 18: Computer Simulation (1). 8 A (8) Initial State 44 Goal State B (5) C (3) A (8) B (5) C (3) Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7

Hill Climbing

Problem: ‘local high’

a state from which any next step is worse

solution: make some random steps to get out of the “local high”

randomness in problem-solving can be good at times

0

1

1

0

1

1

2

3

0

10

2

12

2

1

0

2

1

1 1

0 2

Page 19: Computer Simulation (1). 8 A (8) Initial State 44 Goal State B (5) C (3) A (8) B (5) C (3) Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7

Most subjects choose this path

initially, it seems closer to the goal-state

Hill-climbing describes part of human behavior – no global planning

Page 20: Computer Simulation (1). 8 A (8) Initial State 44 Goal State B (5) C (3) A (8) B (5) C (3) Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7

Means-end Analysis

• No planning involved in trial & error and hillclimbing

• Means-end analyses distinguishes between planning a move vs. executing moves by setting goals

• Means-end analysis was first proposed as part of the General Problem Solver (GPS)(Newell and Simon (1972):

Page 21: Computer Simulation (1). 8 A (8) Initial State 44 Goal State B (5) C (3) A (8) B (5) C (3) Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7

Means-end Analysis

Search is guided by detection of differences between current state and goal state

1) compare current state to goal state and identify difference

2) select an operator to reduce difference

3) if the operator can be applied, do so; if not, set a new subgoal of reaching a state at which the operator could be applied. Means-ends analysis is then applied to this new subgoal.

4) return to 1

Page 22: Computer Simulation (1). 8 A (8) Initial State 44 Goal State B (5) C (3) A (8) B (5) C (3) Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7

A simple example

• Painting your house• Apply paint• Need paint and brush• Go to hardware store• Find car keys

Page 23: Computer Simulation (1). 8 A (8) Initial State 44 Goal State B (5) C (3) A (8) B (5) C (3) Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7

Goal Stack

• Painting your house (GOAL 1)• Apply paint (SUBGOAL 2)

• Need paint and brush (SUBGOAL 3)• Go to hardware store (SUBGOAL 4)

• Went to hardware store (SUBGOAL 4)• Got paint and brush (SUBGOAL 3)• Apply paint (SUBGOAL 2)• Paint the house (GOAL 1)

Page 24: Computer Simulation (1). 8 A (8) Initial State 44 Goal State B (5) C (3) A (8) B (5) C (3) Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7

G1

Goal Stack

G1G2

G1G2G3

G1G2G3G4

Push Goal 1

on Stack

G1G2G3

G4

Push Goal 2

on Stack

Push Goal 3

on Stack

Push Goal 4

on Stack

Solved Goal 4:Pop-off Stack

Page 25: Computer Simulation (1). 8 A (8) Initial State 44 Goal State B (5) C (3) A (8) B (5) C (3) Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7

Production Systems

A set of production rules (if-then rules)

IF you have a paint rollerAnd you have paintAnd you have a surface ready to paint onAnd the surface is largeAnd your goal is to paint the surface

THEN roll the paint onto the surfaceAnd expect the surface to be painted

Page 26: Computer Simulation (1). 8 A (8) Initial State 44 Goal State B (5) C (3) A (8) B (5) C (3) Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7

Applying production systems

1) conditions of rules are matched against the currently active contents of working memory

2) if more than one rule is matched, apply procedures for conflict resolution

3) the selected rule is fired

4) return to 1

Anderson’s ACT* model: human cognition is based on production systems