CS 4700: Foundations of Artificial Intelligence · CS 4700: Foundations of Artificial Intelligence...

Post on 28-Jun-2020

4 views 0 download

Transcript of CS 4700: Foundations of Artificial Intelligence · CS 4700: Foundations of Artificial Intelligence...

CS 4700:Foundations of

Artificial Intelligence

Spring 2020Prof. Haym Hirsh

Lecture 2January 24, 2020

Reminder:

If you’re not enrolled,get on the waitlist

(There’s a small checkbox that’s easy to miss)

I’m optimistic about people getting in

Reminder: Homework 1

• Due: Friday, Jan 31, 11:59pm

• No late submissions!

• Tests background material

• Graded in time for add deadline

CS 4701:Practicum in

Artificial Intelligence

Organizational Meeting:Fri, Jan 25, 4:30pm, Gates G01

Makeup time likely to be Monday at 9am or 4:30pm(see website http://www.cs.cornell.edu/courses/cs4701/)

Email: FAI-Practicum-l@cornell.edu

Reminder:First Karma Lecture

The Principal-Agent Value Alignment Problemin Artificial Intelligence

Dylan Hadfield-MenellUC Berkeley

Jan 28 11:40am-12:40pmGates G01

Readings

• Skim Chapters 1 and 2• Chapter 1: broad overview of AI complementary to this lecture

• History

• Relationship to other fields

• Chapter 2: frames how the textbook presents subjects

ArtificialIntelligence

NaturalLanguage

Understanding

ComputerVision

RoboticsMachineLearning

GamesPlanning/

AutomatedReasoning

Chapter 2

Defines an “Agent”:

a (typically software) entity interacting with some environment

• Perceive by receiving “percepts” from“sensors” (pixels, audio signal, radar, …)

• Acts in environment via “actions” using“actuators”

• Goal: Act “rationally” – maximizes some“performance measure” (either explicitlyor embedded within it)

Chapter 2

Chapter 2

AI

Reminder:First Karma Lecture

The Principal-Agent Value Alignment Problemin Artificial Intelligence

Dylan Hadfield-MenellUC Berkeley

Jan 28 11:40am-12:40pmGates G01

Reminder:First Karma Lecture

The Principal-Agent Value Alignment Problemin Artificial Intelligence

Dylan Hadfield-MenellUC Berkeley

Jan 28 11:40am-12:40pmGates G01

Key idea in AI: Search

Key idea in AI: Search

Formulating a problem so that a computer

can find a sequence of steps to solve it

http://www.willowgarage.com/blog/2009/09/04/robot-comics-path-planning

Machine Learning

8 Queens Problem

Place 8 queens on an 8x8 chessboard so that no queen attacks any other

http://wikistack.com/wp-content/uploads/2015/03/8queen.jpeg

N Queens Problem

Place N queens on an NxN chessboard so that no queen attacks any other

http://wikistack.com/wp-content/uploads/2015/03/8queen.jpeg

Rubik’s Cube

Today:

Sections 3.1-3.4

ArtificialIntelligence

NaturalLanguage

Understanding

ComputerVision

RoboticsMachineLearning

GamesPlanning/

AutomatedReasoning

ArtificialIntelligence

NaturalLanguage

Understanding

ComputerVision

RoboticsMachineLearning

GamesPlanning/

AutomatedReasoning

ArtificialIntelligence

NaturalLanguage

Understanding

ComputerVision

RoboticsMachineLearning

GamesPlanning/

AutomatedReasoning

Example

Tiling mxn rectangles with L “trominoes”

Example

Tiling 2x3 rectangles with L “trominoes”

Example

Tiling 2x3 rectangles with L “trominoes”

Example

Tiling a 5x6 rectangle with L “trominoes”?

Formalizing a ProblemKey Idea: “State Space Search”

• States:• The range of situations that can be considered (Rubik’s cube configurations, locations of robot)

• Initial State: Starting point (messed up cube, current robot location)

• Goal State/Condition:

• Desired end state (solved cube)

• State satisfying goal condition (robot recharged)

Formalizing a ProblemKey Idea: “State Space Search”

• States:• The range of situations that can be considered (Rubik’s cube configurations, locations of robot)

• Initial State: Starting point (messed up cube, current robot location)

• Goal State/Condition:

• Desired end state (solved cube)

• State satisfying goal condition (robot recharged)

• Actions (aka Operators):• Take you from one state to another (turning a Rubik’s cube)

• May have different costs (energy costs of robot actions)

Formalizing a ProblemKey Idea: “State Space Search”

States + Actions = Graph

Formalizing a ProblemKey Idea: “State Space Search”

States + Actions = Graph

Solving a problem=

Finding paths in the graphfrom Initial State to Goal

Formalizing a ProblemKey Idea: “State Space Search”

States + Actions = Graph

Solving a problem=

Finding paths in the graphfrom Initial State to Goal

=“Search”

Formalizing a ProblemKey Idea: “State Space Search”

Finding paths in the graphfrom Initial State to Goal

Which path?

Any

Formalizing a ProblemKey Idea: “State Space Search”

Finding paths in the graphfrom Initial State to Goal

Which path?

Shortest

Formalizing a ProblemKey Idea: “State Space Search”

Finding paths in the graphfrom Initial State to Goal

Which path?

Shortest?

Formalizing a ProblemKey Idea: “State Space Search”

Finding paths in the graphfrom Initial State to Goal

Which path?

Shortest

Formalizing a ProblemKey Idea: “State Space Search”

Finding paths in the graphfrom Initial State to Goal

Which path?

Least cost(ex: least energy)

Formalizing a ProblemKey Idea: “State Space Search”

Finding paths in the graphfrom Initial State to Goal

Which path?

Any – and just want goal state(don’t care about the path)

Search Algorithms vs Graph Algorithms

Search problem = algorithm on a graph

Search Algorithms vs Graph Algorithms

Search problem = algorithm on a graph

Differences:• Graph isn’t given to us but is implicitly defined by the initial

state s0 and the actions A• Instead of complexity as a function of |V| and |E|, often in

terms of |A| (“branching factor”, b) and distance to a goal state (d) – for example O(bd)

Missionaries and Cannibals

Missionaries and Cannibals

Boat can hold 1-2 peopleCannot have cannibals outnumbering missionaries on either bank

Boat must be piloted by a personStart with 3 missionaries and 3 cannibals on left side, with a boat

End with all 6 on the right side

Missionaries and Cannibals

States: (M,C,Side)M = # of missionaries on left side of river

C = # of cannibals on left side of riverSide = canoe on L(eft) or R(ight) side of river

Missionaries and Cannibals

States: (M,C,Side)M = # of missionaries on left side of river

C = # of cannibals on left side of riverSide = canoe on L(eft) or R(ight) side of river

Initial State = (3,3,L)

Missionaries and Cannibals

States: (M,C,Side)M = # of missionaries on left side of river

C = # of cannibals on left side of riverSide = canoe on L(eft) or R(ight) side of river

Initial State = (3,3,L)

Goal Condition = (0,0,?)

Missionaries and Cannibals

States: (M,C,Side)M = # of missionaries on left side of river

C = # of cannibals on left side of riverSide = canoe on L(eft) or R(ight) side of river

Initial State = (3,3,L)

Goal Condition = (0,0,?)

Actions: M, C, MM, MC, CC takes canoe across river

Missionaries and Cannibals

Actions:M: one missionary takes boat across

C: one cannibal takes boat acrossMM: two missionaries take boat across

CC: two cannibals take boat acrossMC: one of each takes boat across

Missionaries and Cannibals

(3,3,L) sample search process

Missionaries and Cannibals

(3,3,L)

(2,3,R)

(1,3,R)

(3,2,R)

(3,1,R)

(2,2,R)

M

MMC

MC

CC

Missionaries and Cannibals

(3,3,L)

(2,3,R) – terminal node, no successors, cannibals eat missionary

(1,3,R)

(3,2,R)

(3,1,R)

(2,2,R)

M

MMC

MC

CC

Missionaries and Cannibals

(3,3,L)

(2,3,R)

(1,3,R) – terminal node, no successors, cannibals eat missionary

(3,2,R)

(3,1,R)

(2,2,R)

M

MMC

MC

CC

Missionaries and Cannibals

(3,3,L)

(2,3,R)

(1,3,R)

(3,2,R) – not a goal state, generate successors

(3,1,R)

(2,2,R)

M

MMC

CC

MC

Missionaries and Cannibals

(3,3,L)

(2,3,R)

(1,3,R)

(3,2,R)

(3,1,R)

(2,2,R)

M

MMC

CCC

MC

Missionaries and Cannibals

(3,3,L)

(2,3,R)

(1,3,R)

(3,2,R) – no new successors

(3,1,R)

(2,2,R)

M

MMC

CCC

MC

Missionaries and Cannibals

(3,3,L)

(2,3,R)

(1,3,R)

(3,2,R)

(3,1,R) – not a goal, generate successors

(2,2,R)

M

MMC

CCC

MC

Missionaries and Cannibals

(3,3,L)

(2,3,R)

(1,3,R)

(3,2,R)

(3,1,R)

(2,2,R)

(3,2,L)

M

MMC

CCC

CC C

MC

Missionaries and Cannibals

(3,3,L)

(2,3,R)

(1,3,R)

(3,2,R)

(3,1,R)

(2,2,R)

(3,2,L) – not a goal, generate successors

M

MMC

CCC

CC C

MC

Missionaries and Cannibals

(3,3,L)

(2,3,R)

(1,3,R)

(3,2,R)

(3,1,R)

(2,2,R)

(3,2,L)

(3,0,R)

(2,2,R)

(1,2,R)

M

MMC

CCC

CC C

C

CC

M

MMMC

Missionaries and Cannibals

(3,3,L)

(2,3,R)

(1,3,R)

(3,2,R)

(3,1,R)

(2,2,R)

(3,2,L)

(3,0,R)

(2,2,R)

(1,2,R)

You get the idea

M

MMC

CCC

CC C

C

CC

M

MMMC

Missionaries and Cannibals

(3,3,L)

(2,3,R)

(1,3,R)

(3,2,R)

(3,1,R)

(2,2,R)

(3,2,L)

(3,0,R)

(2,2,R)

(1,2,R)

You get the idea

State Space= GraphM

MMC

CCC

CC C

C

CC

M

MMMC

State Space = Graph

What algorithms might we use?