Question: 2 . A - Applying Algorithms In this step, you will apply the three uninformed search algorithms to 1 0 0 different instances of the

2.A - Applying Algorithms
In this step, you will apply the three uninformed search algorithms to 100 different instances of the Route Planning environment, recording various metrics for each algorithm/environment pair. Starter code has been provided for you in the cell below.
The outer loop in the cell below will execute 100 times. Each time it runs, it creates a new Route Planning environment with 800 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 =['DFS','BFS', 'UCS']
lengths ={alg:[] for alg in algorithms}
costs ={alg:[] for alg in algorithms}
times ={alg:[] for alg in algorithms}
for i in tqdm(range(100)):
state = RoutePlanning(num_sites=800, random_state=i)
for alg in algorithms:
soln, log = general_search(root=state, alg=alg, display_results=False)
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
lengths[alg].append(len(p))
costs[alg].append(c)
times[alg].append(t)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!