Manual (40 points) ------ * Check that Population.nextGeneration() sorts the new generation of individuals. - 5 points * Check that Evolution.getBest() delegates to Population.getBest() (as opposed to using population's fields directly). - 5 points * Check that Evolution.evolve() is simple: stops if getBest().isIdeal(), or if maximum number of generations reached, otherwise calls population's nextGeneration() method. - 15 points. * Check that SubsetSumIndividual.mutate() and SubsetSumIndividual.crossover() look like being implemented correctly - 15 points. Automatic (60 points) --------- * Check that KnapsackIndividual does not override clone(), and overrides evaluate() - 10 points * Subclass Individual, and check that evaluate() is called exactly once per multiple calls to getFitness() - 5 points. * Using same subclass, check that isIdeal() returns true iff evaluate returned 0 - 5 points * Subclass SubsetSumIndividual, and create two Individuals that return different values in evaluate(). Check that compareTo() is correct on freshly created individuals i1 and i2 both for i1.compareTo(i2) and for i2.compareTo(i1). Individuals should be freshly created for both compareTo()'s! This checks that compareTo() uses getFitness(), and does not access the fitness field directly (which may be uninitialized). - 10 points * Check tournament selection, as follows: + subclass SubsetSumIndividual, to gain access to protected evaluate() + create 10 SubsetSumIndividual2's (in an array) + mutate each 1000 times (ind = ind.mutate()) - this assures that their bits are random + create TournamentSelection with some probabilities, and call reproduce on this "population" 1000 times. + each time, check that all individuals in population still return same values in evaluate() (checks that clone() deep-copies the booleans array), and also check that the returned individuals are instanceof SubsetSumIndividual2 (checks that clone() is implemented correctly). + each time, also count how many individuals are == to some individual in the original population, and check that the final count is approximately (1 - p_cross) * (1 - p_mut) - 15 points (3 tests) * Run the program on a medium size test (20 times) and check that: + the program does not throw any exception + the output is different on some of the Runs. 15 points