Documentation of 'org.encog.ml.ea.train.basic.BasicEA' Java class
BasicEA
org.encog.ml.ea.train.basic

Class BasicEA

    • Constructor Detail

      • BasicEA

        public BasicEA(Population thePopulation,
                       CalculateScore theScoreFunction)
        Construct an EA.
        Parameters:
        thePopulation - The population.
        theScoreFunction - The score function.
    • Method Detail

      • calculateScoreAdjustment

        public static void calculateScoreAdjustment(Genome genome,
                                                    java.util.List<AdjustScore> adjusters)
        Calculate the score adjustment, based on adjusters.
        Parameters:
        genome - The genome to adjust.
        adjusters - The score adjusters.
      • addChild

        public boolean addChild(Genome genome)
        Add a child to the next iteration.
        Parameters:
        genome - The child.
        Returns:
        True, if the child was added successfully.
      • addScoreAdjuster

        public void addScoreAdjuster(AdjustScore scoreAdjust)
        Add a score adjuster. Score adjusters are used to adjust the adjusted score of a genome. This allows bonuses and penalties to be applied for desirable or undesirable traits.
        Specified by:
        addScoreAdjuster in interface EvolutionaryAlgorithm
        Parameters:
        scoreAdjust - The score adjustor to add.
      • calculateScore

        public void calculateScore(Genome g)
        Calculate the score for a genome.
        Specified by:
        calculateScore in interface EvolutionaryAlgorithm
        Parameters:
        g - The genome to calculate the score for.
      • finishTraining

        public void finishTraining()
        Called when training is finished. This allows the EA to properly shut down.
        Specified by:
        finishTraining in interface EvolutionaryAlgorithm
      • getBestComparator

        public GenomeComparator getBestComparator()
        Get the comparator that is used to choose the "true best" genome. This uses the real score, and not the adjusted score.
        Specified by:
        getBestComparator in interface EvolutionaryAlgorithm
        Returns:
        The best comparator.
      • getEliteRate

        public double getEliteRate()
        Returns:
        the eliteRate
      • getError

        public double getError()
        Specified by:
        getError in interface EvolutionaryAlgorithm
        Returns:
        The current score. This value should either be minimized or maximized, depending on the score function.
      • getIteration

        public int getIteration()
        Specified by:
        getIteration in interface EvolutionaryAlgorithm
        Returns:
        The current iteration number. Also sometimes referred to as generation or epoch.
      • getMaxIndividualSize

        public int getMaxIndividualSize()
        Specified by:
        getMaxIndividualSize in interface EvolutionaryAlgorithm
        Returns:
        The maximum size an individual genome can be. This is an arbitrary number defined by the genome. Lower numbers are less complex.
      • getMaxTries

        public int getMaxTries()
        Specified by:
        getMaxTries in interface EvolutionaryAlgorithm
        Returns:
        The maximum number to try certain genetic operations. This prevents endless loops.
      • getOldBestGenome

        public Genome getOldBestGenome()
        Returns:
        the oldBestGenome
      • getRandomNumberFactory

        public RandomFactory getRandomNumberFactory()
        Returns:
        the randomNumberFactory
      • getScoreAdjusters

        public java.util.List<AdjustScore> getScoreAdjusters()
        Specified by:
        getScoreAdjusters in interface EvolutionaryAlgorithm
        Returns:
        The score adjusters. This allows bonuses and penalties to be applied for desirable or undesirable traits.
      • getSelectionComparator

        public GenomeComparator getSelectionComparator()
        Get the comparator that is used to choose the "best" genome for selection, as opposed to the "true best". This uses the adjusted score, and not the score.
        Specified by:
        getSelectionComparator in interface EvolutionaryAlgorithm
        Returns:
        The selection comparator.
      • getShouldIgnoreExceptions

        public boolean getShouldIgnoreExceptions()
        Specified by:
        getShouldIgnoreExceptions in interface EvolutionaryAlgorithm
        Returns:
        True if exceptions that occur during genetic operations should be ignored.
      • getThreadCount

        public int getThreadCount()
        Specified by:
        getThreadCount in interface MultiThreadable
        Returns:
        The number of threads to use, 0 to automatically determine based on core count.
      • iteration

        public void iteration()
        Perform a training iteration. Also called generations or epochs.
        Specified by:
        iteration in interface EvolutionaryAlgorithm
      • reportError

        public void reportError(java.lang.Throwable t)
        Called by a thread to report an error.
        Parameters:
        t - The error reported.
      • setChampMutation

        public void setChampMutation(EvolutionaryOperator champMutation)
        Parameters:
        champMutation - the champMutation to set
      • setCODEC

        public void setCODEC(GeneticCODEC theCodec)
        Set the CODEC to use.
        Parameters:
        theCodec - The CODEC to use.
      • setEliteRate

        public void setEliteRate(double eliteRate)
        Parameters:
        eliteRate - the eliteRate to set
      • setIteration

        public void setIteration(int iteration)
        Set the current iteration number.
        Parameters:
        iteration - The iteration number.
      • setMaxTries

        public void setMaxTries(int maxTries)
        Parameters:
        maxTries - the maxTries to set
      • setRandomNumberFactory

        public void setRandomNumberFactory(RandomFactory randomNumberFactory)
        Parameters:
        randomNumberFactory - the randomNumberFactory to set
      • setSelectionComparator

        public void setSelectionComparator(GenomeComparator theComparator)
        Set the comparator that is used to choose the "best" genome for selection, as opposed to the "true best". This uses the adjusted score, and not the score.
        Specified by:
        setSelectionComparator in interface EvolutionaryAlgorithm
        Parameters:
        theComparator - The selection comparator.
      • setShouldIgnoreExceptions

        public void setShouldIgnoreExceptions(boolean b)
        Determines if genetic operator exceptions should be ignored.
        Specified by:
        setShouldIgnoreExceptions in interface EvolutionaryAlgorithm
        Parameters:
        b - True if exceptions should be ignored.
      • setThreadCount

        public void setThreadCount(int numThreads)
        Set the number of threads to use.
        Specified by:
        setThreadCount in interface MultiThreadable
        Parameters:
        numThreads - The number of threads to use, or zero to automatically determine based on core count.
      • setValidationMode

        public void setValidationMode(boolean validationMode)
        Determine if the genomes should be validated. This takes more time but can help isolate a problem.
        Specified by:
        setValidationMode in interface EvolutionaryAlgorithm
        Parameters:
        validationMode - True, if validation mode is enabled.
      • getMaxOperationErrors

        public int getMaxOperationErrors()
        Returns:
        the maxOperationErrors
      • setMaxOperationErrors

        public void setMaxOperationErrors(int maxOperationErrors)
        Parameters:
        maxOperationErrors - the maxOperationErrors to set

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.