Evaluating Individuals

This section describes individual evaluation in Evolvica. All related classes and interfaces can be found in the package org.evolvica.core.evaluation.

Scores and Fitnesses

Evaluating individuals means assigning a fitness value to an individual. When examining the interface for an individual in Evolvica one thing catches the eye: there are two interfaces called IScore and IFitness. What's the difference between them?
A score a another term for the target objective value of an evaluation function. The evaluation function may return a value of different types, i.e. integer, float or something else. In multi-objective problems the score of an individual is composed out of several values, one for each criterion. In contrast the fitness value in Evolvica is defined as a positive float value mapping the scores to a non-negative range of values. The mapping of scores to fitness values is also refered to as fitness scaling. Although most algorithms do not use fitness scaling this scheme has been included in Evolvica. For most cases using only the scores will do.
Scores and fitness values are defined by the the interface org.evolvica.core.IScore and org.evolvica.core.IFitness. These interfaces only specify a method for accessing the actual value. Implementations can found in the package org.evolvica.core.eval. There are scores of type integer, float, long and double, which should be sufficient for most application cases. The default implementation for a fitness value can also be found in this package.

Evaluators

Evaluators are operators which assign a score and/or a fitness value to an individual. The evaluation always needs to be implemented by the user. All he has to do is to derive a class from the base class org.evolvica.core.eval.AbstractEvaluator. This base class specifies one single method which must be implemented by the user: evaluate( IIndividual i ). In this method a user the genotype of the individual is read, a score value is calculated and a new score object is attached to the individual.

Comparing Individuals

Another important issue related to scores and fitness values is the comparison of individuals. In Evolvica individuals are compared be individual comparators (org.evolvica.core.IIndividualComparator). The comparator looks on the score or on the fitness of individuals and compares them. Now there's a problem: How to know which score is a better one? Imagine two individuals I0 and I1. I0 has a score of value 10 and I1 a score of value 20. In a problem where the score should be maximized I1 is the better one while in a problem where the score should be minimized I0 is the better one. For this reason there are predefined comparators: Default, Reverse and Convergent. In the first example a default comparator will do because default comparators assume that a higher score is a better one. Because the score is of type integer org.evolvica.core.eval.DefaultIntegerScoreComparator will do the job here. In the second case an instance of class org.evolvica.core.eval.ReverseIntegerScoreComparator is appropriate. There's a third case: there may be problems where the score should be next to some particular value, i.e. 12. For that case we would use org.evolvica.core.eval.ConvergentIntegerScoreComparator with the best value set to 12. This comparator would return I0 as the better individual.