The ProblemA genetic algorithm consists of a population of individuals, where each individual is a bit string (i.e., a list of 0s and 1s). For example, 0010101010 could be a genetic algorithm individual. A tness function interprets an individual and assigns it a tness that represents how good or bad the solution is. One simple tness function is counting ones, where an individuals tness is simply the number of ones in the bit string. For example, the bit string 011100 would have a tness of 3. Your Task 1. Create one random individual. The individual should be a list of length 100. Each bit should be assigned randomly to a 0 or a 1. (Hint: Check out the random package for python.) 2. Write a counting ones tness function. Your function should accept an individual as input and return the number of ones as output. 1
Programming
[Solved] SOLVED:Honors Lab 1 solution
$25
File Name: SOLVED:Honors_Lab_1_solution.zip
File Size: 263.76 KB
Only logged in customers who have purchased this product may leave a review.
Reviews
There are no reviews yet.