/* ITI 1121/1521 - Assignment 1 * Marcel Turcotte (turcotte@site.uottawa.ca) */ /** * A Population is a collection of chromosomes (each one * representing a candidate solution for the folding problem). To * facilitate the implementation of the various methods, the * chromosomes will always be kept in increasing value of fitness. *

*

*/ public class Population { /** * A constructor of arity 2 to initialize the Population. * * @param size is the size of the population, the number of chromosomes to be * created * @param chain is the chain for which a fold is sought */ public Population(int initialSize, String chain) { // REPLACE THE BODY OF THIS METHOD WITH YOUR OWN IMPLEMENTATION. } /** * A constructor of arity 1 to initialize the Population. The * population has the default size. * * @param chain is the chain for which a fold is sought */ public Population(String chain) { // REPLACE THE BODY OF THIS METHOD WITH YOUR OWN IMPLEMENTATION. } /** * The method evolve selects parent chromosomes. An offspring is then * created from the two parents, using the method crossover. The * offspring is mutated, and then inserted into the population. As a * result, the least fitted individual will be eliminated from the * population. Remember that the population is kept in increasing * order of fitness. For the selection of the parents, you can experiment * with different scenarios. A possible scenario is to randomly select two * parents. Another possible one would be to select the fittest, and a * randomly selected one. Or else, select the two most fitted individuals. */ public void evolve() { // REPLACE THE BODY OF THIS METHOD WITH YOUR OWN IMPLEMENTATION. } /** * The instance method public Chromosome getFittest() returns the * "best" individual of the population, i.e. the one that has the smallest * fitness value. * * @return returns the currently best solution */ public Chromosome getFittest() { // REPLACE THE BODY OF THIS METHOD WITH YOUR OWN IMPLEMENTATION. return null; } /** * Returns a String representation of this Population. * * @return the String representation of this Population */ public String toString() { // REPLACE THE BODY OF THIS METHOD WITH YOUR OWN IMPLEMENTATION. return null; } }