/*
 * CommonString.java
 *
 * Created on November 2, 2005, 5:23 PM
 *
 * To change this template, choose Tools | Options and locate the template under
 * the Source Creation and Management node. Right-click the template and choose
 * Open. You can then make changes to the template in the Source Editor.
 */

package cz.pcland.ga;

/**
 *
 * @author petr
 */
import java.util.*;

abstract public class BaseIndividual {
        /**
         * Length of individual
         */
	protected int strLen;
        
        /**
         * Fitness is used as a value, which express individual's chances to appear in the next generation.
         */
	protected double fitness;
        
        /**
         * Rank based on individual's fitness. It is commonly used by Rank Roulette selection.
         */
        protected double fitnessRank;
        
        /**
         * Express evaluation of individual and is computed by Fitness function.
         */
        protected double evaluation;
        
	/**
         * Provides mutation operator
         * @param mutationProb Probability of mutation
         */
	abstract void mutation(double mutationProb);
        
        
        /**
         * Returns exact copy of individual
         */
        public abstract BaseIndividual copy();
		
	/**
         * Returns fitness of individual
         */
	public double getFitness(){
		return fitness;
	}
	
        /**
         * Sets fitness of individual
         * @param f value
         */
	public void setFitness(double f) {
		fitness = f;
	}
        
        /**
         * Returns evaluation of individual
         */
        public double getEvaluation(){
		return evaluation;
	}
        
        /**
         * Sets evaluation of individual
         * @param r Evaluation value
         */
        public void setEvaluation(double r) {
		evaluation = r;
	}
        
        /**
         * Returns fitnessRank of individual
         */
        public double getFitnessRank(){
		return fitnessRank;
	}
        
        /**
         * Sets fitnessRank of individual
         * @param f Rank value
         */
        public void setFitnessRank(double f) {
		fitnessRank = f;
	}
        
	
        /**
         * Constructor 
         */
	public BaseIndividual() {
	
	}
	
        /**
         * Constructor, sets lenght of individual
         * @param stringLen Length of individual
         */
	public BaseIndividual(int stringLen) {
		strLen = stringLen;
	
	}

}
