[JGAP Home]

The problem

In some tasks, you may have several closely dependent genes that cannot mutate in arbitrary way. Instead, the valid set of values for each gene-component depends from the current value of the related genes - part of the same system. Such group of the related genes can make only part of the whole genome. Using default JGAP mechanism means that a mutation, breaking the internal rules of the interdependent gene group, will lead to discarding the whole such chromosome. This finally slows the evolution, reducing the system performance.

The solution: Supergenes

In biology, Supergene represents several genes, which control closely related aspects of the phenotype. The living cell is a complex machinery, and the problem of gene dependency is frequent. For example, part of the plant photosynthetic system is a so-called ATP synthase. This is a complex formation, consisting of several proteins - components. If some components mutate, becoming useless, the ATP synthase cannot longer be created. The most surprising is that the other proteins that have not been touched by mutation, are also suppressed. Probably having a damaged ATP synthase is worse than having no ATP synthase at all. So, the gene group, responsible for ATP synthase, mutates as a single unit: ATP synthase absent/ATP synthase present.

It is possible to suggest an example from mathematics. Imagine that we use JGAP to find the values a, b, c and d, fitting the experimental data into real function

If we only restrict x > 0, we must also restrict a >= b, but c and d are not dependent from this condition. So a and b can be placed in a supergene, setting validity condition a >= b.

The old MinimizeMakeChange example can also be extended to make supergenes useful: lets suppose that the number of pennies and nickels must be both even or both odd.

JGAP Supergene mutates only in such way, that the allele combination remains valid. Mutations, that make allele combination invalid, are rejected inside the method, responsible for creating the mutated version. For the efficient use, you must combine several genes and supergenes inside the same chromosome. Supergene components can also be a Supergenes, creating the tree-like structures in this way.

Using the supergenes with JGAP

For better understanding of this chapter, we recommend to read about the MinimizeMakeChange example first.

In JGAP, the supergene support is implemented in package org.jgap.supergenes. The simpliest way to create a supergene is to derive it from the abstractSupergene class, overriding isValid() method. For example, if we need a supergene, holding the two IntegerGenes (nickels and pennies) and ensuring condition nickels mod 2 = pennies mod 2:

import org.jgap.impl.IntegerGene;
import org.jgap.supergenes.abstractSupergene;
import org.jgap.Gene;

/** Supergene to hold quarters and nickels. Valid if the number of
 * nickels and pennies is either both odd or both even. */

public class NickelsPenniesSupergene extends abstractSupergene {
    /* It is important to provide these two constructors: */
    public NickelsPenniesSupergene() {}
    public NickelsPenniesSupergene( Gene[] a_genes )

     /* Now just check nickels mod 2 = pennies mod 2: */
    public boolean isValid(Gene [] genes, Supergene s)
         IntegerGene nickels = (IntegerGene)  genes[0];
         IntegerGene pennies  = (IntegerGene) genes[1];
         boolean valid = nickels.intValue() % 2 == pennies.intValue() % 2;
         return valid;

Now, the sample gene array, consisting of one supergene and two ordinary genes for quarters and dimes, is created in the following way:

Gene[] sampleGenes = new Gene[3];
sampleGenes[DIMES]    = getDimesGene ();
sampleGenes[QUARTERS] = getQuartersGene ();
sampleGenes[2] = new NickelsPenniesSupergene(
  new Gene[] { getNickelsGene (), getPenniesGene (),

Compare this with the non-supergene version:

Gene[] sampleGenes = new Gene[4];
sampleGenes[DIMES] = getDimesGene();
sampleGenes[NICKELS] = getNickelsGene();
sampleGenes[QUARTERS] = getQuartersGene();
sampleGenes[PENNIES] = getPenniesGene();

It is trivial to create a chromosome from the gene array and to get a solution of the task (see example class org.jgap.supergenes.SupergeneSampleApplicationTest included with the tests in the JGAP distribution).

Are supergenes useful?

In other words, can they increase the application performance in a real JGAP applications? Maybe this conception is interesting just from the point of theoretical biology? To answer this question, we did performance tests. From these tests we concluded the following:

The supergene conception can significantly (up to 3 times in the most boundary cases) increase the evolution speed. It can also increase the accuracy of solution for the small populations. However these effects are dependent from the chosen population size and maximal number of iterations. While in some cases the use of supergenes can be definitely sensible, we would recommend to try both supergene and non-supergene versions for your specific task.

[Documentation Index]

SourceForge Logo