search david kauchak cs30 – spring 2015. admin assignment 7 due tomorrow assignment 8 out soon...
TRANSCRIPT
![Page 1: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/1.jpg)
SEARCHDavid Kauchak
CS30 – Spring 2015
![Page 2: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/2.jpg)
Admin
Assignment 7 due tomorrow
Assignment 8 out soon
Talk today4:15 in Rose Hills Theatre
![Page 3: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/3.jpg)
A few last things about classesLook at rectangle3.py code
Taking objects of the same type as parameters (e.g. equals)
Calling methods inside the class
Instance variables do NOT have to be the same thing as the parameters for the constructor
![Page 4: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/4.jpg)
Assignment 7 comments
Think about how you want to use the objects (i.e. your program) and let that motivate the class design, i.e. the methods, etc.
Class names should be capitalized CamelCase class names that are multiple words
class PomonaStudent class WalkieTalkie class StarWarsCreature
“pass”
![Page 5: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/5.jpg)
Assignment 7 comments
If your program requires a file to work (i.e. to read data from):
create a folder: first-last-assign7 put both the .py file and the .txt file in there zip of the folder and submit that
Be careful about filenames! files have extensions (that are sometimes hidden by the
OS). On mac, you can do CMD+i to get information about the file, including the full filename
We’re only reading .txt file (other files have formatting information!) Wing saves files just as text files automatically (though you’ll
need to make sure to include the .txt extension) TextEdit: Format -> Make Plain Text Windows: Use notepad (or in Word, “Save as…” and select .txt
![Page 6: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/6.jpg)
Other ways of reading from a filereader = open(“myfile.txt”, “r”)
Read the whole file:
next_line = reader.readline()
Read one line of the file:
for line in reader:# do something with each line of the file
Do dictionary example!
![Page 7: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/7.jpg)
Think like a human Cognitive Modeling
Think rationallyLogic-based Systems
Act like a humanTuring Test
Act rationallyRational Agents
What is AI?
Rest of the semester
![Page 8: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/8.jpg)
Think like a human Cognitive Modeling
Think rationallyLogic-based Systems
Act like a humanTuring Test
Act rationallyRational Agents
What is AI?
Next couple of weeks
![Page 9: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/9.jpg)
Solve the maze!
![Page 10: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/10.jpg)
Solve the maze!
![Page 11: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/11.jpg)
Solve the maze!
![Page 12: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/12.jpg)
Solve the maze!
How did you figure it out?
![Page 13: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/13.jpg)
One approach
What now?
![Page 14: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/14.jpg)
One approach
Three choices
![Page 15: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/15.jpg)
One approach
What now?
Pick one!
![Page 16: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/16.jpg)
One approach
Still three options!Which would you explore/pick?
![Page 17: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/17.jpg)
One approach
Most people go down a single path until they realize that it’s wrong
![Page 18: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/18.jpg)
One approach
Keep exploring
![Page 19: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/19.jpg)
One approach
Keep exploring
![Page 20: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/20.jpg)
One approach
What now?
![Page 21: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/21.jpg)
One approach
Are we stuck?No. Red positions are just possible options we haven’t explored
![Page 22: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/22.jpg)
One approach
How do we know not to go left?
![Page 23: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/23.jpg)
One approach
Have to be careful and keep track of where we’ve been if we can loop
![Page 24: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/24.jpg)
One approach
Now what?
![Page 25: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/25.jpg)
One approach
Now what?
![Page 26: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/26.jpg)
One approach
Now what?
![Page 27: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/27.jpg)
One approach
![Page 28: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/28.jpg)
Search problems
What information do we need to know to figure out a solution?
![Page 29: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/29.jpg)
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”
![Page 30: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/30.jpg)
State space example
![Page 31: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/31.jpg)
State space example
… … …
![Page 32: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/32.jpg)
State space example
For a given problem, still could have different state-spaces
How many more states are there?
![Page 33: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/33.jpg)
State space example
![Page 34: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/34.jpg)
Solving the maze
![Page 35: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/35.jpg)
Solving the maze
![Page 36: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/36.jpg)
Solving the maze
How what?
![Page 37: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/37.jpg)
Solving the maze
![Page 38: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/38.jpg)
Solving the maze
How what?
![Page 39: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/39.jpg)
Solving the maze
How what?
![Page 40: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/40.jpg)
Solving the maze
Could we have found it any other way?
![Page 41: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/41.jpg)
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
![Page 42: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/42.jpg)
to_visit
1
2 3
4
5 6 7
8
9
10 11
12 13
14 15
- 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 listrepeat
How do we start?
![Page 43: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/43.jpg)
to_visit
1
2 3
4
5 6 7
8
9
10 11
12 13
14 15
- 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 listrepeat
Add start not to to_visit
1
![Page 44: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/44.jpg)
to_visit
1
2 3
4
5 6 7
8
9
10 11
12 13
14 15
- 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 listrepeat
Add start not to to_visit
![Page 45: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/45.jpg)
to_visit
1
2 3
4
5 6 7
8
9
10 11
12 13
14 15
- 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 listrepeat
Is it a goal state?
![Page 46: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/46.jpg)
to_visit
1
2 3
4
5 6 7
8
9
10 11
12 13
14 15
- 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 listrepeat
234
![Page 47: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/47.jpg)
to_visit
1
2 3
4
5 6 7
8
9
10 11
12 13
14 15
- 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 listrepeat
234 Which one?
![Page 48: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/48.jpg)
to_visit
1
2 3
4
5 6 7
8
9
10 11
12 13
14 15
- 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 listrepeat
34
Is it a goal state?
![Page 49: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/49.jpg)
to_visit
1
2 3
4
5 6 7
8
9
10 11
12 13
14 15
- 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 listrepeat
34
Where should we add them in the list?
![Page 50: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/50.jpg)
to_visit
1
2 3
4
5 6 7
8
9
10 11
12 13
14 15
- 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 listrepeat
534 Let’s add them to
the front
![Page 51: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/51.jpg)
to_visit
1
2 3
4
5 6 7
8
9
10 11
12 13
14 15
- 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 listrepeat
34
![Page 52: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/52.jpg)
to_visit
1
2 3
4
5 6 7
8
9
10 11
12 13
14 15
- 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 listrepeat
34
What do we do here?
![Page 53: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/53.jpg)
to_visit
1
2 3
4
5 6 7
8
9
10 11
12 13
14 15
- 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 listrepeat
34 list keeps track of
where to go next (and the states we know about but haven’t explored
![Page 54: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/54.jpg)
to_visit
1
2 3
4
5 6 7
8
9
10 11
12 13
14 15
- 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 listrepeat
4
![Page 55: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/55.jpg)
to_visit
1
2 3
4
5 6 7
8
9
10 11
12 13
14 15
- 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 listrepeat
674
![Page 56: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/56.jpg)
to_visit
1
2 3
4
5 6 7
8
9
10 11
12 13
14 15
- 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 listrepeat
74
![Page 57: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/57.jpg)
to_visit
1
2 3
4
5 6 7
8
9
10 11
12 13
14 15
- 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 listrepeat
4
![Page 58: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/58.jpg)
to_visit
1
2 3
4
5 6 7
8
9
10 11
12 13
14 15
- 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 listrepeat
534
What type of structure/list is the to_visit list?
It’s a stack!!! (LIFO)
![Page 59: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/59.jpg)
to_visit
1
2 3
4
5 6 7
8
9
10 11
12 13
14 15
- 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 listrepeat
What would happen if it was a queue?
1
![Page 60: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/60.jpg)
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
![Page 61: SEARCH David Kauchak CS30 – Spring 2015. Admin Assignment 7 due tomorrow Assignment 8 out soon Talk today 4:15 in Rose Hills Theatre](https://reader036.vdocuments.net/reader036/viewer/2022062517/56649ede5503460f94bef21c/html5/thumbnails/61.jpg)
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 stackBreadth first search (BFS): to_visit is a queue