Week5 6
Week5 6
Intelligence
Dr.
Qaiser
Abbas
Department
of
Computer
Science
&
IT
University
of
Sargodha
[email protected]
• Test
whether
this
is
a
goal
state.
(Clearly
it
is
not,
but
it
is
important
to
check
so
that
we
can
solve
trick
problems
like
“starOng
in
Arad,
get
to
Arad.”)
• Suppose
we
choose
Sibiu
first.
We
check
to
see
whether
it
is
a
goal
state
(it
is
not)
and
then
expand
it
to
get
In(Arad),
In(Fagaras),
In(Oradea),
and
In(RimnicuVilcea).
• We
can
then
choose
any
of
these
four
or
go
back
and
choose
Timisoara
or
Zerind.
• Algorithms
that
forget
their
history
are
doomed
to
repeat
it.
• Explored
set
to
remember
every
expanded
node.
• Newly
generated
nodes
that
match
with
ones
in
the
explored
set
or
the
fronOer
can
be
discarded.
Wednesday
20
March
19
24
3.3
SEARCHING
FOR
SOLUTIONS
• Route-‐
finding
on
a
rectangular
grid
in
Figure
3.9
is
a
parOcularly
important
example
in
computer
games.
Output:
IteraOon
1:
ES=S,
[SàRV,
80],
[SàF,
99]
IteraOon
2:
ES=S+RV,
[SàRVàP,
177],
[SàF,
99]
IteraOon
3:
ES=S+RV+F,
[SàRVàP,
177],
[SàFàB,
310]
IteraOon
4:
ES=S+RV+F+P,
[SàRVàPàB,
278],
[SàFàB,
310]
Wednesday
20
March
19
31
3.4.2
Uniform-‐cost
search
(UCS)
• Goal
test
is
applied
when
it
is
selected
for
expansion
(as
in
the
graph-‐search
algorithm)
rather
than
when
it
is
first
generated.
The
reason
is
that
the
first
goal
node
that
is
generated
may
be
on
a
subopOmal
path.
• Equivalent
to
breadth-‐first
search,
if
all
step
costs
are
equal.