i've got all my final projects - harvey mudd collegedodds/ist338/slides/lec11_15_ist338.pdf ·...

37
I've got all my eyes on this view! IST 338 in April – big picture Final Projects Picobot vPool TextID CS Practice E11 finale! The view from here…

Upload: others

Post on 30-Apr-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

I've got all my

eyes on this view!

IST 338 in April – big picture

Final ProjectsPicobot

vPool

TextID

CS Practice

E11 finale!

The view

from here…

Page 2: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

CS Foundations

robots and

other fun

stuff (today…)

feature-based

modeling +

classification

circuits and memory

data: classes and objects

graphics /

media /

games ...

is over

here:

functions

loopsvariablesrecursion

population

analysis +

algorithms

I've got all my

eyes on this view!

What can be computed...

... and how efficiently?

CS Applications

CS 5

CS Theory

Final ProjectsPicobot

vPool

TextID

CS in practice

The view

from here…

IST 338 in April – big picture

Page 3: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

CS Foundations

robots and

computer

vision

search and

the web

circuits and memory

data: classes and objects

graphics

media

games ...

functions

loopsvariablesrecursion

biological

analysis +

algorithms

What can be computed...

... and how efficiently?

CS Applications

CS 5

CS Theory

Final ProjectsPicobot

vPool

TextClouds

CS5 in Dec. ~ Big picture

CS Foundations

Page 4: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

The next two weeks in IST338…

CS Foundations

(1) define "computer" precisely

(2) define "compute" precisely

(3) see what computers provably can't compute

(4) go to step (1) and define things better…

(5) … or, time will run out.

Page 5: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

Unifying idea: State

0 NEWx -> S 1

previous state

next statenext

stepexternal

input

The state of a computation is

all the internal information

needed to take the next stepand for Picobot,

next step is taken

literally!

Page 6: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

states as subtasks

0 x*** -> N 0

0 N*** -> X 1

1 ***x -> S 1

1 ***S -> X 0

state pattern -> move new state

N***

x***

transitions move from state to state

each circle represents a

different robot state

starting

funnel state 0 state 1

the "go North" state the "go South" state

***S

***x

Page 7: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

Computation is a deliberate

sequence of state-changes

01101101010

11010010001

01101101010

00000001110

bits before bits after

Page 8: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

A model of computation: FSMFinite State Machine

s0 s1

start stateaccepting statestransitions

1

0

1

0

“input funnel” “where to go” double circled

Example

FSM

labeled by input !

Example input

100101input sequenceread left-to-right

Page 9: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

FSM: Finite state machine

State 0

transition on 0

0010111another input

sequence

What does each state MEAN ?

State 1

What does this FSM do overall?

transition on 0

transition on 1

transition on 1

always left-to-right

Page 10: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

JFLAP !graphical state-machine

builder for hw12

Page 11: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

Try it!

List three different inputs that this FSM accepts:

s0

s1

01

s2

10

List three different inputs that this FSM rejects:

In general, what English phrase

describes the accepted inputs?

What does each state say about the

current state of the input?!?

s0 means…

s1 means…

s2 means…

This machine accepts strings that…

1

0

1

s3

s3 means…

Could you get the same behavior with fewer states?

What's the minimum # possible? How do you know?

Hint: find a string

that has to be in

each state!

Extra!

0

Page 12: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

Quiz!

List three different inputs that this FSM accepts:

s0

s1

01

s2

10

List three different inputs that this FSM rejects:

In general, what English phrase

describes the accepted inputs?

What does each state say about the

current state of the input?!?

s0 means…

s1 means…

s2 means…

This machine accepts strings that…

1

0

1

s3

s3 means…

Could you get the same behavior with fewer states?

What's the minimum # possible? How do you know?

Hint: find a string

that has to be in

each state!

Extra!

0

Try this on the back page first…

Page 13: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

s0

s1

01

s2

10 1

0

1

s3

0

State ~ fateStrings with different possible

fates must be in different states.

Can we find three strings – all with different possible fates? (4?)

If so, then three states (or 4) are necessary! If not, fewer will be OK.

Page 14: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

Build-your-own FSMs

Minimum possible # of states?

Draw a FSM that accepts strings that don't

contain the pattern 110 anywhere.

Draw a FSM accepting strings in which the

number of zeros (0s) is a multiple of 3, so

there are 0, 3, 6, … zeros. 1s don't matter.

Draw a FSM accepting strings in which the

third digit (from the left) is a 1.

Draw a FSM accepting strings whose

third-to-last digit (from the right) is a 1.

Accepted: 110101110, 11, 0000010

Rejected: 101, 0000, 111011101111

Accepted: 1010001 Rejected: 11000100 and 11 Accepted: 0100 and 01101 Rejected: 101001 and 11

Hint: modify this

starter FSM:

Hint: modify the

first FSM we

considered!

Accepted: 1010001 Rejected: 101001100

Requires at least 4 states

Minimum possible # of states? Minimum possible # of states?

Page 15: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

No occurrences of 110

Minimum number of states?

Draw a FSM accepting strings that do NOT anywhere contain the pattern 110

1

0

1 0

start end w/1 end w/11 fail!

Page 16: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

No occurrences of 110?

Why doesn't this machine work?

1

0

0

1 0,1

Could we prove 4 states are required?

Page 17: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

Number of 0s is div. by 3

Draw a FSM accepting strings in which the

number of zeros (0s) is a multiple of 3, so

there are 0, 3, 6, … zeros. 1s don't matter.

Accepted: 110101110, 11, 0000010

Rejected: 101, 0000, 111011101111

Minimum number of states?

Page 18: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

Third character is a 1

Minimum number of states?

Draw a FSM accepting strings in which the

third digit (from the left) is a 1.

Accepted: 1010001

Rejected: 11000100 and 11

Page 19: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

Third-to-last character is a 1?

Draw a FSM accepting strings whose

third-to-last digit (from the right) is a 1.

Accepted: 0100 and 01101

Rejected: 101001 and 11

Minimum number of states?

Page 20: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

Third-to-last character is a 1?

Draw a FSM accepting strings whose

third-to-last digit (from the right) is a 1.

Accepted: 0100 and 01101

Rejected: 101001 and 11

Minimum number of states?

Page 21: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

Third-to-last character is a 1

Proof that we need 15 states?

s∅

s0 s1

s11

s111

s10s01s00

s000 s001 s010 s011 s100 s101 s110

1 1

1

1 1

1

10

0

0 0 0

0

0

Something seems

missing here…

Page 22: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

Third-to-last character is a 1

The minimum possible number of states?

Draw a FSM accepting strings whose

third-to-last digit (from the right) is a 1.

s∅

s0 s1

s11

s111

s10s01s00

s000 s001 s010 s011 s100 s101 s110

1 1

1

1 1

1

10

0

0 0 0

0

0

Something seems missing… I don't accept this solution!

Page 23: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

Third-to-last character is a 1

s111s000 s001 s010 s011 s100 s101 s110

8 states? How could we prove that 8

states are required?

Page 24: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

FSMs are everywhere!

qstart

q1 q2 q3 q4 q5

q12 q13 q14 q15 q23

q12,3 q12,4 q12,5

q12,5,34

Locks

12

5

34

Page 25: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

qstart

q5 cents q10 cents q25 cents

penny, fifty cent piece,silver dollar, Canadiancurrency, Euro, ….

quarterdime

nickel

nickel

q15 cents q20 cents

nickeldime

nickel

(some transitions not shown)

FSMs are everywhere!

mechanical

vending

machinenickel

Page 26: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

FSM ~ Game AI

The state-machine that controls

Quake's Shambler monsters…

I'm Quaking in

my AstroBoots

Page 27: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

Towel-folding states!

Page 28: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

All robots use FSM control

50x

Page 29: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

Towel-

folding?

singled out as a questionable

use of dollars...

Page 30: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

All robots use FSM control

… send me your FSM so that I can show it off in 2015!

Page 31: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

An autonomous vehicle's FSM

Page 32: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

FSMs driving robots...

MIT's car,

Talos

Page 33: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

FSMs driving robots...

MIT's car,

Talos - and

its sensor

suite

Page 34: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

State-machine limits?

Are there limits to what FSMs can do?

But are there any binary-string problems

that FSMs can't solve?

they can't necessarily drive safely...

Page 35: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

State-machine limits?

Let's build a FSM that accepts bit strings with the

SAME NUMBER of 0s as 1s

011001

01100

0110

01110

accepted

rejected

10

0100

λ

000

this last string is empty

Page 36: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

State-machines are limited.

We need a more powerful model than FSMs...

FSMs can't count

at least not arbitrarily high...

What do we need to add?

Page 37: I've got all my Final Projects - Harvey Mudd Collegedodds/IST338/SLIDES/Lec11_15_ist338.pdf · I've got all my eyes on this view! IST 338 in April –big picture Final Projects Picobot

Next time: Turing Machines

state machines + memory!