Class AbstractHypothesis<T extends AbstractHypothesis>

  • 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 Object
    Hypothesis base class.
    Author:
    Stephan Fuhrmann
    • Constructor Detail

      • AbstractHypothesis

        public AbstractHypothesis()
    • Method Detail

      • randomInit

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

        protected abstract 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.