Class AbstractHypothesis<T extends AbstractHypothesis>

java.lang.Object
de.sfuhrm.genetic.AbstractHypothesis<T>
Type Parameters:
T - the parameter needs to have the concrete type of the hypothesis class for the methods to return the correct subtype.

public abstract class AbstractHypothesis<T extends AbstractHypothesis>
extends java.lang.Object
Hypothesis base class.
Author:
Stephan Fuhrmann
  • Constructor Summary

    Constructors 
    Constructor Description
    AbstractHypothesis()  
  • Method Summary

    Modifier and Type Method Description
    protected abstract double calculateFitness()
    Calculates the fitness of this hypothesis.
    protected abstract java.util.List<T> crossOver​(T other)
    Returns a two-element crossover offspring of this and the other hypothesis.
    protected abstract void mutate()
    Implements the mutation operator.
    protected abstract T randomInit()
    Randomly initialize the hypothesis.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • randomInit

      protected abstract T randomInit()
      Randomly initialize the hypothesis.
      Returns:
      returns this hypothesis after a random initialization.
    • crossOver

      protected abstract java.util.List<T> crossOver​(T other)
      Returns a two-element crossover offspring of this and the other hypothesis.
      Parameters:
      other - the other hypothesis to cross-over with.
      Returns:
      a two-element List of the offsprings.
    • calculateFitness

      protected abstract double calculateFitness()
      Calculates the fitness of this hypothesis.
      Returns:
      a fitness where a bigger number means more fitness. Please be advised that negative numbers will be problematic for the algorithm.
    • mutate

      protected abstract void mutate()
      Implements the mutation operator. The mutation operator flips one bit of the genome of the hypothesis.