$25
Lab 3 – Beyond Classical Search
Overview
You may want to review the code for search.py, in the aima-python repository for additional context.
Code Exploration
Download the genetic_search_example.py file from the D2L dropbox. This requires the following Python libraries (some of which you may need to install using pip install).
os
operator
math
random
time
copy à deepcopy
Genetic Algorithm Understanding
Run the code and examine it to explain each of the following. In your explanation, also note why the particular strategy might make sense for this problem.
Initialization Strategy
Selection Strategy
Reproduction Strategy
Mutation Strategy
Given the field sizes of 10x10, 20x20, and 30x30, what are the minimum possible fitness value? (Always assume the upper left is the starting location and the lower right is the ending location).
Code Performance
Alter the code to run the GA with the varying parameters, and fill in the following table. Try to get the best possible results. Note that the start location is always 0,0, but the end location should be (SIZE-1, SIZE-1).
Field Size
# Generations
Population Size
Mutation Rate
Lowest Fitness
Generation
Lowest
Fitness
Reached
Method Timing
10x10
20x20
30x30
CSCI 5260 – Artificial Intelligence P a g e 1 Show which runs found the optimal solution. Updated Code
Update the following within the code:Change the GA selection strategy to be purely random.
Change the GA reproduction strategy to a different method (I suggest multipoint crossover).
Given your changes to the strategy, rerun the code as necessary to fill in the following table:
Field Size
# Generations
Population Size
Mutation Rate
Lowest Fitness
Generation
Lowest
Fitness
Reached
Method Timing
10x10
20x20
30x30