David Kauchak CS51A – Spring 2019

Slides:



Advertisements
Similar presentations
Artificial Intelligence By Mr. Ejaz CIIT Sahiwal.
Advertisements

Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2007.
Searching Algorithms Finding what you are looking for.
SEARCH ALGORITHMS David Kauchak CS30 – Spring 2015.
Announcements Assignment #4 is due tonight. Last lab program is going to be assigned this Wednesday. ◦ A backtracking problem.
SEARCH APPLICATIONS David Kauchak CS30 – Spring 2015.
Backtracking COP Backtracking  Backtracking is a technique used to solve problems with a large search space, by systematically trying and eliminating.

1 Solving problems by searching This Lecture Chapters 3.1 to 3.4 Next Lecture Chapter 3.5 to 3.7 (Please read lecture topic material before and after each.
SEARCH David Kauchak CS30 – Spring Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre.
“Planning is bringing the future into the present so that you can do something about it now.” – Alan Lakein Thought for the Day.
Breadth-first and depth-first traversal CS1114
SEARCH David Kauchak CS30 – Spring Admin Assignment 6 graded Assignment 7  1 extra day: Due 3/26 at 6pm  If you turn it in by the original due.
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
Artificial Intelligence Solving problems by searching.
Simple Search Algorithm
Data Structures & Algorithm Analysis lec(8):Graph T. Souad alonazi
Lecture 3: Uninformed Search
CSG3F3/ Desain dan Analisis Algoritma
ARTIFICIAL INTELLIGENCE
Uninformed search Lirong Xia Spring, Uninformed search Lirong Xia Spring, 2017.
BackTracking CS255.
Breadth First and Depth First
Data Structures Graphs - Terminology
CSCI 104 Backtracking Search
Introduction to Artificial Intelligence
David Kauchak CS52 – Spring 2016
Problem Solving by Searching
Uninformed Search Strategies
Artificial Intelligence (CS 370D)
CS 188: Artificial Intelligence
Using a Stack Chapter 6 introduces the stack data type.
Breadth-First Searches
Games with Chance Other Search Algorithms
هوش مصنوعی فصل سوم: حل مسئله با جستجو
Uninformed Search Introduction to Artificial Intelligence
CSE373: Data Structures & Algorithms Lecture 10: Disjoint Sets and the Union-Find ADT Linda Shapiro Spring 2016.
Solving problems by searching
Spanning Trees Longin Jan Latecki Temple University based on slides by
CS Fall 2016 (Shavlik©), Lecture 8, Week 5
CSE 421: Introduction to Algorithms
Back Tracking.
Data Structures – Stacks and Queus
Using a Stack Chapter 6 introduces the stack data type.
Search Related Algorithms
Searching for Solutions
Depth-First Searches Introduction to AI.
adapted from Recursive Backtracking by Mike Scott, UT Austin
Using a Stack Chapter 6 introduces the stack data type.
Artificial Intelligence
Using a Stack Chapter 6 introduces the stack data type.
Graph Algorithms "A charlatan makes obscure what is clear; a thinker makes clear what is obscure. " - Hugh Kingsmill CLRS, Sections 22.2 – 22.4.
Backtracking and Branch-and-Bound
CPSC 322 Introduction to Artificial Intelligence
Solving problems by searching
Spanning Trees Longin Jan Latecki Temple University based on slides by
Problem Spaces & Search
State-Space Searches.
State-Space Searches.
Search.
David Kauchak CS51A – Spring 2019
State-Space Searches.
Announcements Assignment #4 is due tonight. Last lab program is going to be assigned this Wednesday. ◦ A backtracking problem.
CS51A David Kauchak Spring 2019
David Kauchak CS51A – Spring 2019
CS51A David Kauchak Spring 2019
CS440/ECE 448 Lecture 4: Search Intro
Supplemental slides for CSE 327 Prof. Jeff Heflin
Solving problems by searching
Depth-First Searches.
Presentation transcript:

David Kauchak CS51A – Spring 2019 Search David Kauchak CS51A – Spring 2019

Admin Assignment 8

Act like a human Turing Test What is AI? Think like a human Cognitive Modeling Think rationally Logic-based Systems Act like a human Turing Test Act rationally Rational Agents "knowledge" “reasoning” “emotions” perception “learning” language motor skills Next couple of weeks

Solve the maze!

Solve the maze!

Solve the maze!

Solve the maze! How did you figure it out?

One approach What now?

One approach Three choices

One approach Pick one! What now?

One approach Still three options! Which would you explore/pick?

One approach Most people go down a single path until they realize that it’s wrong

One approach Keep exploring

One approach Keep exploring

One approach What now?

One approach Are we stuck? No. Red positions are just possible options we haven’t explored

One approach How do we know not to go left?

One approach Have to be careful and keep track of where we’ve been if we can loop

One approach Now what?

One approach Now what?

One approach

Search problems What information do we need to figure out a solution?

Search problems Where to start Where to finish (goal) What the “world” (in this case a maze) looks like We’ll define the world as a collection of discrete states States are connected if we can get from one state to another by taking a particular action This is called the “state space”

State space example

State space example … … …

State space example For a given problem, still could have different state-spaces How many more states are there?

State space example

Solving the maze

Solving the maze

Solving the maze How what?

Solving the maze

Solving the maze How what?

Solving the maze How what?

Solving the maze Could we have found it any other way?

Search algorithm Keep track of a list of states that we could visit, we’ll call it “to_visit” General idea: take a state off the to_visit list if it’s the goal state we’re done! if it’s not the goal state Add all of the successive states to the to_visit list repeat

1 4 2 3 9 8 6 7 13 5 12 10 11 15 14 to_visit - take a state off the to_visit list - if it’s the goal state we’re done! - if it’s not the goal state Add all of the successive states to the to_visit list repeat How do we start?

- take a state off the to_visit list - if it’s the goal state 1 4 2 3 9 8 6 7 13 5 12 10 11 15 14 to_visit - take a state off the to_visit list - if it’s the goal state we’re done! - if it’s not the goal state Add all of the successive states to the to_visit list repeat 1 Add start not to to_visit

1 4 2 3 9 8 6 7 13 5 12 10 11 15 14 to_visit - take a state off the to_visit list - if it’s the goal state we’re done! - if it’s not the goal state Add all of the successive states to the to_visit list repeat Add start not to to_visit

1 4 2 3 9 8 6 7 13 5 12 10 11 15 14 to_visit - take a state off the to_visit list - if it’s the goal state we’re done! - if it’s not the goal state Add all of the successive states to the to_visit list repeat Is it a goal state?

1 4 2 3 9 8 6 7 13 5 12 10 11 15 14 to_visit - take a state off the to_visit list - if it’s the goal state we’re done! - if it’s not the goal state Add all of the successive states to the to_visit list repeat 2 3 4

1 4 2 3 9 8 6 7 13 5 12 10 11 15 14 to_visit - take a state off the to_visit list - if it’s the goal state we’re done! - if it’s not the goal state Add all of the successive states to the to_visit list repeat 2 3 4 Which one?

1 4 2 3 9 8 6 7 13 5 12 10 11 15 14 to_visit - take a state off the to_visit list - if it’s the goal state we’re done! - if it’s not the goal state Add all of the successive states to the to_visit list repeat 3 4 Is it a goal state?

1 4 2 3 9 8 6 7 13 5 12 10 11 15 14 to_visit - take a state off the to_visit list - if it’s the goal state we’re done! - if it’s not the goal state Add all of the successive states to the to_visit list repeat 3 4 Where should we add them in the list?

1 4 2 3 9 8 6 7 13 5 12 10 11 15 14 to_visit - take a state off the to_visit list - if it’s the goal state we’re done! - if it’s not the goal state Add all of the successive states to the to_visit list repeat 5 3 4 Let’s add them to the front

1 4 2 3 9 8 6 7 13 5 12 10 11 15 14 to_visit - take a state off the to_visit list - if it’s the goal state we’re done! - if it’s not the goal state Add all of the successive states to the to_visit list repeat 3 4

1 4 2 3 9 8 6 7 13 5 12 10 11 15 14 to_visit - take a state off the to_visit list - if it’s the goal state we’re done! - if it’s not the goal state Add all of the successive states to the to_visit list repeat 3 4 What do we do here?

1 4 2 3 9 8 6 7 13 5 12 10 11 15 14 to_visit - take a state off the to_visit list - if it’s the goal state we’re done! - if it’s not the goal state Add all of the successive states to the to_visit list repeat 3 4 list keeps track of where to go next, i.e. the states we know about but haven’t explored

1 4 2 3 9 8 6 7 13 5 12 10 11 15 14 to_visit - take a state off the to_visit list - if it’s the goal state we’re done! - if it’s not the goal state Add all of the successive states to the to_visit list repeat 4

1 4 2 3 9 8 6 7 13 5 12 10 11 15 14 to_visit - take a state off the to_visit list - if it’s the goal state we’re done! - if it’s not the goal state Add all of the successive states to the to_visit list repeat 6 7 4

1 4 2 3 9 8 6 7 13 5 12 10 11 15 14 to_visit - take a state off the to_visit list - if it’s the goal state we’re done! - if it’s not the goal state Add all of the successive states to the to_visit list repeat 7 4

1 4 2 3 9 8 6 7 13 5 12 10 11 15 14 to_visit - take a state off the to_visit list - if it’s the goal state we’re done! - if it’s not the goal state Add all of the successive states to the to_visit list repeat 4

1 4 2 3 9 8 6 7 13 5 12 10 11 15 14 to_visit - take a state off the to_visit list - if it’s the goal state we’re done! - if it’s not the goal state Add all of the successive states to the to_visit list repeat 5 3 4 What type of structure/list is the to_visit list? It’s a stack!!! (LIFO)

- take a state off the to_visit list - if it’s the goal state 1 4 2 3 9 8 6 7 13 5 12 10 11 15 14 to_visit - take a state off the to_visit list - if it’s the goal state we’re done! - if it’s not the goal state Add all of the successive states to the to_visit list repeat 1 What would happen if it was a queue?

Search algorithms add the start state to to_visit Repeat take a state off the to_visit list if it’s the goal state we’re done! if it’s not the goal state Add all of the successive states to the to_visit list

Search algorithms add the start state to to_visit Repeat take a state off the to_visit list if it’s the goal state we’re done! if it’s not the goal state Add all of the successive states to the to_visit list Depth first search (DFS): to_visit is a stack Breadth first search (BFS): to_visit is a queue

N-queens problem Place N queens on an N by N chess board such that none of the N queens are attacking any other queen. Solution(s)?

N-queens problem Place N queens on an N by N chess board such that none of the N queens are attacking any other queen.

N-queens problem Place N queens on an N by N chess board such that none of the N queens are attacking any other queen. Solution(s)?

N-queens problem Place N queens on an N by N chess board such that none of the N queens are attacking any other queen. How do we solve this with search: What is a state? What is the start state? What is the goal? How do we transition from one state to the next?

Search algorithm add the start state to to_visit Repeat take a state off the to_visit list if it’s the goal state we’re done! if it’s not the goal state Add all of the successive states to the to_visit list Is this a goal state? What states can I get to from the current state? Any problem that we can define these three things can be plugged into the search algorithm!

N queens problem http://en.wikipedia.org/wiki/Eight_queens_puzzle