This assignment is due at the beginning of the lecture on Friday, October 22nd.
You may work with (at most) one other person on this assignment. If you work with a partner, submit one solution with both of your names on it.
You must solve this problem by implementing the genetic algorithm that is described on page 119 (with one minor modification) of the course textbook. The minor modification is to retain the best individual from the previous generation in the current generation. This is known as elitism. The implementation must be in Common Lisp and/or CLOS.
A variety of problems (mostly resource allocation) can be described in terms of precedence or ordering constraints, e.g., A > B means "A comes before B" or "A is more important/preferred over B". This is inherently a decision problem: Given a list of tasks and a list of constraints, is there a total ordering of tasks that preserves the constraints? This is called finding a feasible solution. It can also be re-phrased as an optimization problem: Given a list of tasks and a list of constraints, what ordering of tasks violates the fewest constraints? For purposes of this class, we will be treating this as an optimization problem.
You must define a function named evolve-solution. The function has five parameters that appear in the order below.
(evolve-solution 5 '((0 1)(0 3)(2 1)(1 3)(4 3)) 20 50 1.5)
The evolve-solution function should return the ordering of the tasks that it finds with the smallest number of constraint violations. For example, '(0 2 1 4 3) below. In addition, match the output format below:
Constraint Satisfaction ----------------------- Number of tasks: 5 Constraints: '((0 1)(0 3)(2 1)(1 3)(4 3)) Population Size: 20 Number of Generations: 50 Mutation Rate: 1.5 The number of constraint violations is 0 The ordering of the tasks is '(0 2 1 4 3)