/* * File: FitnessFunction.java * Author: Justin Basilico * Course: PO CS 152: Neural Networks * Assignment: Final Project * Updated: 2001.12.18 * Created: 2001.12.06 * * Description: * * This file contains the FitnessFunction interface, which is just an * interface that should be used by any Objects that are a FitnessFunction. * * Copyright: Justin Basilico (2001). */ /** * FitnessFunction interface * * This interface is to be implemented by any Objects that are to be used to * calculate the fitness of Chromosome Objects. The fitness value of a * Chromosome is a measure as to how good the Chromosome is at a given task. * The method for calculating the fitness of a Chromosome is * calculateFitness(Chromosome), which needs to be implemented by any classes * that implement this interface. * * This interface is used along with the Genome class, which stores a * Chromosome and its fitness so that the Chromosomes can be organized * according to their fitness. * * @author Justin Basilico * @version 2001.12.18 * @see Chromosome * @see Genome */ public interface FitnessFunction { /** * calculateFitness * * This method takes a Chromosome and returns the fitness value for that * Chromosome, as specified by the specific implementation. The fitness of * a Chromosome is just a number that specifies how good or bad the * Chromosome is at whatever task it is being evolved to do. There should * be a difference in the values that are returned by good Chromosomes and * bad Chromosomes when passed to this Method. * * @param chromosome The Chromosome to calculate the fitness value of. * @return The fitness value of the given Chromosome, calculated as per * the specific implementation, as a double. * @see Chromosome */ public double calculateFitness( Chromosome chromosome); // Chromosome to calculate. }