Genes and Individuals

This section introduces the genetic representation used in Evolvica. All related classes and interfaces can be found in the package org.evolvica.core.

Genes

All classes representing a gene must implement the org.evolvica.core.IGenotype. There's not much in this interface: genes must be able to create a copy of themself and return a string representation. In addition they have to return their datatype. This is important for checking the validity of an algorithm and allows the GUI to raise an error message when a user tries to connect an initializer that creates genotypes thta contain an array of integers and an evaluator that relies on genes of type string. There's a class org.evolvica.core.GenotypeID that implements the IGenotype interface. Instances of this class can be used to indicate the type of genes.
There are several predefined genotypes already available: int, float, long, double, string, bit string, int[], float[], double[] and long[]. Please consult the API documentation for finding the appropriate classes.

Individuals

Individuals are specified by the interface org.evolvica.core.IIndividual. Individuals support getting and setting of their genotypes, score and fitness value. A default implementation is available in org.evolvica.core.DefaultIndividual. Each individual contains exactly ONE genotype. The genotype object can be arbitrarily complex, but it is important that there's only one genotype per individual. For creating a new genotype that contains for instance a string, two integers and two float values a new genotype class must be created by the user.