Sei sulla pagina 1di 4

AI Search: Lions and Gazelles

Student Resource:
Session 1:
Artificial Intelligence (AI) has roots in simple puzzle solving. You may be familiar with AI in movies
and video games, and have heard that it is used in Internet search; to genome mapping and
creating genetically modified food. Computer Scientists who are AI researcher often start with
simple puzzles because it helps them focus on how to represent the important parts of a problem,
and how to create algorithms or rules of logic to solve a problem. The data that an AI program
manipulates is called the state. The algorithm is often called search.

In the first half of this activity you will create skits to understand the solution to a basic math
problem that involves crossing a river. The reason AI researchers love this particular puzzle is that
it sometimes requires undoing what youve already done to solve the problem. Your job is to
create a skit that successfully gets all of the animals across the river. Here is the story:

Three lions and three gazelles meet on one side of a river. All of them need to
cross to the other side of the river. The current is too strong for any of them to
swim across alone. None of the animals can cross without gripping a tree branch to
help them float. A single branch lies on their side of the river. Only one or two
animals at the most can use the branch at one time to get across, or they will sink.
At least one animal must grip the branch to get it across (it cant simply be tossed
back). If more lions than gazelles are on one side of the river, the lions will eat the
gazelles. The animals holding onto the branch count toward those who will attack
or be eaten when the branch is on either riverbank.

Worksheet 1 helps you create the skit that you will perform at the end of the first session.

Session 2:
Your skit gives you insight into the problem, but didnt give you a way to describe to others how to
get to the solution. You may have used trial and error, or had to decide what to do at each step. AI
researchers try to find ways to instruct computers on how to figure out a solution. The researchers
do not solve the problem. The computer program they write solves the problem. In the 1950s and
1960 a simple strategy called state-space search was created. Here is some vocabulary:

State-space: Is a diagram of how a problem can be described as the paths from a start state to a
goal state, with possibly dead-ends and loops. Sometimes the state-space is thought of as all of
the possible states, even ones that that cant be reached from other states.

State (or state description): Is a way of using the least amount of information needed to keep
track of a problem. In the Lions and Gazelles puzzle this would be which riverbank the branch is
on, and how many lions and gazelles are on each bank.

State change rules: Every state-space has rules to get you from one state to the next possible
states. For example, a lion grips the branch, gazelle lets go of the branch, the branch is moved
across the river.

AI Search: Lions and Gazelles Page 1 of 4


Developed by IEEE as part of TryEngineering
www.tryengineering.org
Depth first search: Given a state, pick a rule, apply it to create a new state, then, apply a rule to
that state. If it is a dead end, back up the path and explore another rule.

Breadth first search: Given a state, apply all possible rules for that state to create all of the
possible next states. Mark dead-ends. Expand all possible states that are not dead-ends.

AI Search: Lions and Gazelles


Student Worksheet 1
The Skit:

Create your stage: using materials given to you, create the two edges of the stream. Make sure
all of your players know how to grab onto and let go of the prop that is your tree branch.

The Players:

Lion 1: ____________________________ Gazelle 1: _________________________

Lion 2: ____________________________ Gazelle 2: _________________________

Lion 3: ____________________________ Gazelle 3: _________________________

Production Crew: (who else has a role, and what is it?)

________________________________________________________________

Script Instructions: Using the space below write a draft of your script that moves all
the Lions and Gazelles across the river. Rehearse your script so that everyone knows
what to do and when. If you have time, use a computer or tablet to write up your script
with stage directions.

AI Search: Lions and Gazelles Page 2 of 4


Developed by IEEE as part of TryEngineering
www.tryengineering.org
AI Search: Lions and Gazelles
Student Worksheet 2
State-Space Search:
Please refer to the student resource page for definitions. The diagram shows the start of a
state-space for the Lions and Gazelles problem with a possible way to describe states.
Your job is to (1) come up with a notation that is easier for you to write, but doesnt lose
any information, (2) add missing rules, (3) using your clearer notation, create a
reasonably complete state-space, including dead ends and reverse moves. Reverse
moves occur when you go back to a previous state, undoing your forward progress.
Identify your start state and goal state(s).

State notation: LLL, GGG, B|| ---,---,-


This means there are 3 Lions and 3 Gazelles on the left bank with the tree Branch, and
nothing on the right bank that is important to the puzzle.

Some rules: Lion grips branch, Gazelle lets go of branch, move branch across river.
Hints:
1) Notice that two or three rules are applied before drawing the next state. You could
expand out the intermediate states, but it gets tedious. A good state space
diagram captures just the essential information with creating clutter.
2) A reversing rule is shown. These may move you back more than one state!
3) Remember that your job is to find any, and perhaps all, of the possible solutions.

Questions:
1) As you created a state-space diagram, did you use depth- or breadth-first search?

AI Search: Lions and Gazelles Page 3 of 4


Developed by IEEE as part of TryEngineering
www.tryengineering.org
2) One strategy is guaranteed to find the best solution. Which one is it?
3) When you solved the puzzle for your skit, did you use breadth- or depth-first
search, or another combination?

AI Search: Lions and Gazelles Page 4 of 4


Developed by IEEE as part of TryEngineering
www.tryengineering.org

Potrebbero piacerti anche