001/*
002 * BioJava development code This code may be freely distributed and modified
003 * under the terms of the GNU Lesser General Public Licence. This should be
004 * distributed with the code. If you do not have a copy, see:
005 * http://www.gnu.org/copyleft/lesser.html Copyright for this code is held
006 * jointly by the individual authors. These should be listed in @author doc
007 * comments. For more information on the BioJava project and its aims, or to
008 * join the biojava-l mailing list, visit the home page at:
009 * http://www.biojava.org/
010 */
011
012package org.biojavax.ga.functions;
013
014import org.biojavax.ga.GeneticAlgorithm;
015import org.biojavax.ga.Organism;
016import org.biojavax.ga.Population;
017
018/**
019 * Calculates the fitness of an <code>Organism</code> in a
020 * <code>Population</code> of <code>Organisms</code>
021 *
022 * @author Mark Schreiber
023 * @author Susanne Merz
024 * @author Andreas Dr&auml;ger
025 * @version 1.1
026 * @since 1.5
027 */
028
029public interface FitnessFunction {
030
031        /**
032         * Calculates the fitness of <code>org</code>. This can be done
033         * independently of the Population pop (by ignoring the argument in your
034         * implementation) or dependent on the other members of the
035         * <code>Population pop</code>. Every implementation of this function
036         * should assign the fitness value computed in this function to the given
037         * organism. This is important so that the organism knows its current fitness.
038         * Note that for simple problems this fitness array will contain only one
039         * single value. However, to enable multi-objective fitness functions this has
040         * to be an array.
041         *
042         * @param org
043         *          The <code>Organism</code> to score
044         * @param pop
045         *          The <code>Population</code> to consider
046         * @param genAlg
047         *          the parent<code>GeneticAlgorithm</code>
048         * @return the fitness score.
049         */
050        public double[] fitness(Organism org, Population pop, GeneticAlgorithm genAlg);
051}