Class ExpressionFitnessFunction

  • All Implemented Interfaces:
    Serializable, IFitnessFunction

    public class ExpressionFitnessFunction
    extends IGPFitnessFunction
    Implementation of our custom FitnessFunction. As we're using the DeltaFitnessEvaluator higher fitness values mean the individual is less fit! ReImplementation on ExcutionEngine

    FIXME fix QualityMeasures to work on Mappings!

    Author:
    Klaus Lyko, Tommaso Soru (tsoru@informatik.uni-leipzig.de)
    See Also:
    Serialized Form
    • Method Detail

      • evaluate

        protected double evaluate​(org.jgap.gp.IGPProgram a_subject)
        Specified by:
        evaluate in class org.jgap.gp.GPFitnessFunction
      • calculateRawFitness

        public double calculateRawFitness​(org.jgap.gp.IGPProgram p)
        Calculates the fitness of the given GPProgram p. This is done as follows: 1.1 get the Metric Expression by executing (as object) the first chromosome. 1.2 get the mapping links with these settings 2. Calculate either recall, precision or f-score and return 1 minus it. The evolution could produce non wanted individuals especially those who compare properties which are not part of the PropertyMapping (set in the ExpressionConfiguration). In such cases setp 1.1 throws an IllegalStateException. As a result the fitness value would be set to rather bad one.
        Parameters:
        p - GPProgram fitness is calculated for.
        Returns:
        Double value. The closer to 0 the better.
      • calculateRawMeasure

        public double calculateRawMeasure​(org.jgap.gp.IGPProgram p)
      • getSourceCache

        public ACache getSourceCache()
        Get full caches used by this learner.
        Returns:
        HybridCache of the source endpoint.
      • getTargetCache

        public ACache getTargetCache()
        Get full caches used by this learner.
        Returns:
        HybridCache of the target endpoint.
      • destroy

        public void destroy()
      • trimKnowledgeBases

        public void trimKnowledgeBases​(AMapping trainingData)
        Method to scale down caches according to given training data.
        Parameters:
        trainingData - Mapping holding data instances a user has evaluated. That may include non-matches.
      • setUseFullCaches

        public void setUseFullCaches​(boolean value)
        If we want to use Full Caches instead.
        Parameters:
        value -
      • getReferenceMapping

        public AMapping getReferenceMapping()
      • setReferenceMapping

        public void setReferenceMapping​(AMapping referenceData)
        As we assume referenceData only holding matches. Learner may have to set it separately.
        Parameters:
        referenceData - A Mapping holding all matches.
      • addToReference

        public void addToReference​(AMapping m)
        Method to add instances to reference?.
        Specified by:
        addToReference in class IGPFitnessFunction
        Parameters:
        m - Mapping of matches, designated as such by an oracle.
      • setCaches

        public void setCaches​(ACache sC,
                              ACache tC)