001    package org.jaga.definitions;
002    
003    /**
004     * Basis for all aglowithms whichevaluate the fitness of an individual.
005     *
006     * <p><u>Project:</u> JAGA - Java API for Genetic Algorithms.</p>
007     *
008     * <p><u>Company:</u> University College London and JAGA.Org
009     *    (<a href="http://www.jaga.org" target="_blank">http://www.jaga.org</a>).
010     * </p>
011     *
012     * <p><u>Copyright:</u> (c) 2004 by G. Paperin.<br/>
013     *    This program is free software; you can redistribute it and/or modify
014     *    it under the terms of the GNU General Public License as published by
015     *    the Free Software Foundation, ONLY if you include a note of the original
016     *    author(s) in any redistributed/modified copy.<br/>
017     *    This program is distributed in the hope that it will be useful,
018     *    but WITHOUT ANY WARRANTY; without even the implied warranty of
019     *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
020     *    GNU General Public License for more details.<br/>
021     *    You should have received a copy of the GNU General Public License
022     *    along with this program; if not, write to the Free Software
023     *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
024     *    or see http://www.gnu.org/licenses/gpl.html</p>
025     *
026     * @author Greg Paperin (greg@jaga.org)
027     *
028     * @version JAGA public release 1.0 beta
029     */
030    
031    public interface FitnessEvaluationAlgorithm {
032    
033            /**
034             * Returns the class of individuals handled by this selection algorithm.
035             *
036             * @return The required type the individual passed to the
037             * method <code>evaluateFitness</code>.
038             */
039            public Class getApplicableClass();
040    
041            /**
042             * Evaluates the fitness of a spscified individual.
043             *
044             * @param individual The Individual to be evaluated.
045             * @param age The generation of the individual and its population.
046             * @param population The population from which the individual was drawn.
047             * @param params The experiment-parameters
048             *
049             * @return The fitness of the specified individual
050             *
051             * @throws ClassCastException If this algorithm cannot handle individuals of
052             * the type of <code>individual</code>, i.e. the actual class of
053             * <code>individual</code> is not the same of a subclass of the class
054             * returned by <code>getApplicableClass()</code>.
055             */
056            public Fitness evaluateFitness(Individual individual, int age,
057                                                                       Population population, GAParameterSet params)
058                                                                                                                    throws ClassCastException;
059    
060    }