Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2 . A - Applying Algorithms In this step, you will apply the three uninformed search algorithms to 1 0 0 different instances of the
A Applying Algorithms
In this step, you will apply the three uninformed search algorithms to different instances of the Route Planning environment, recording various metrics for each algorithmenvironment pair. Starter code has been provided for you in the cell below.
The outer loop in the cell below will execute times. Each time it runs, it creates a new Route Planning environment with sites. Each time the inner loop executes, a different search algorithm will be applied to the current environment. After applying the algorithm, the path length, path cost, and search time for that search should each be recorded in the appropriate dictionaries.
Complete the cell below by filling in the blanks to defined the variables p c and t as described in the comments below.
algorithms DFSBFS 'UCS'
lengths alg: for alg in algorithms
costs alg: for alg in algorithms
times alg: for alg in algorithms
for i in tqdmrange:
state RoutePlanningnumsites randomstatei
for alg in algorithms:
soln, log generalsearchrootstate, algalg, displayresultsFalse
p # p should be set to the path for the solution found.
c # c should be set to the path cost for the solution.
t # t should be the runtime for the algorithm
lengthsalgappendlenp
costsalgappendc
timesalgappendt
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started