Documentation of 'org.jgap.IChromosome' Java class
IChromosome
org.jgap

Interface IChromosome

  • All Superinterfaces:
    java.lang.Cloneable, java.lang.Comparable, ICloneable, IUniqueKey, java.io.Serializable
    All Known Implementing Classes:
    BaseChromosome, Chromosome


    public interface IChromosome
    extends java.lang.Comparable, ICloneable, java.io.Serializable, IUniqueKey
    Interface for chromosomes. Normally, you would start using BaseChromosome which implements this interface to build your own chromosome classes.
    Since:
    2.6
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String CVS_REVISION
      String containing the CVS revision.
      static java.lang.String S_ALLELES 
      static java.lang.String S_APPLICATION_DATA 
      static java.lang.String S_FITNESS_VALUE
      Constants for toString()
      static java.lang.String S_SIZE 
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      void cleanup()
      Invoked when this Chromosome is no longer needed and should perform any necessary cleanup.
      int getAge() 
      java.lang.Object getApplicationData()
      Retrieves the application-specific data that is attached to this Chromosome.
      Configuration getConfiguration() 
      double getFitnessValue()
      Retrieves the fitness value of this Chromosome, as determined by the active fitness function.
      double getFitnessValueDirectly() 
      Gene getGene(int a_desiredLocus)
      Returns the Gene at the given index (locus) within the Chromosome.
      Gene[] getGenes()
      Retrieves the set of genes that make up this Chromosome.
      void increaseAge()
      Increases the number of evolutionary rounds of chromosome in which it has not been changed by one.
      void increaseOperatedOn()
      Increase information of number of genetic operations performed on chromosome in current evolution round.
      boolean isSelectedForNextGeneration()
      Retrieves whether this Chromosome has been selected by the natural selector to continue to the next generation.
      int operatedOn() 
      void resetAge()
      Reset age of chromosome because it has been changed.
      void resetOperatedOn()
      Resets the information of how many genetic operators have been performed on the chromosome in the current round of evolution.
      void setAge(int a_age) 
      void setApplicationData(java.lang.Object a_newData)
      This sets the application-specific data that is attached to this Chromosome.
      void setConstraintChecker(IGeneConstraintChecker a_constraintChecker)
      Sets the constraint checker to be used for this gene whenever method setAllele(Object) is called.
      void setFitnessValue(double a_newFitnessValue)
      Sets the fitness value of this Chromosome.
      void setFitnessValueDirectly(double a_newFitnessValue)
      Sets the fitness value of this Chromosome directly without any constraint checks, conversions or checks.
      void setGenes(Gene[] a_genes)
      Sets the genes for the chromosome.
      void setIsSelectedForNextGeneration(boolean a_isSelected)
      Sets whether this Chromosome has been selected by the natural selector to continue to the next generation or manually (e.g.
      int size()
      Returns the size of this Chromosome (the number of genes it contains).
      • Methods inherited from interface java.lang.Comparable

        compareTo
    • Method Detail

      • getGene

        Gene getGene(int a_desiredLocus)
        Returns the Gene at the given index (locus) within the Chromosome. The first gene is at index zero and the last gene is at the index equal to the size of this Chromosome - 1.
        Parameters:
        a_desiredLocus - index of the gene value to be returned
        Returns:
        Gene at the given index
        Since:
        2.6
      • getGenes

        Gene[] getGenes()
        Retrieves the set of genes that make up this Chromosome. This method exists primarily for the benefit of GeneticOperators that require the ability to manipulate Chromosomes at a low level.
        Returns:
        an array of the Genes contained within this Chromosome
        Since:
        2.6
      • size

        int size()
        Returns the size of this Chromosome (the number of genes it contains). A Chromosome's size is constant and will not change, until setGenes(...) is used.
        Returns:
        number of genes contained within this Chromosome instance
        Since:
        2.6
      • setFitnessValue

        void setFitnessValue(double a_newFitnessValue)
        Sets the fitness value of this Chromosome. This method is for use by bulk fitness functions and should not be invokved from anything else (except test cases).
        Parameters:
        a_newFitnessValue - a positive integer representing the fitness of this Chromosome
        Since:
        2.6
      • setFitnessValueDirectly

        void setFitnessValueDirectly(double a_newFitnessValue)
        Sets the fitness value of this Chromosome directly without any constraint checks, conversions or checks. Only use if you know what you do.
        Parameters:
        a_newFitnessValue - a positive integer representing the fitness of this Chromosome
        Since:
        2.6
      • getFitnessValue

        double getFitnessValue()
        Retrieves the fitness value of this Chromosome, as determined by the active fitness function. If a bulk fitness function is in use and has not yet assigned a fitness value to this Chromosome, then -1 is returned.

        Attention: should not be called from toString() as the fitness value would be computed if it was initial!

        Returns:
        a positive double value representing the fitness of this Chromosome, or -1 if a bulk fitness function is in use and has not yet assigned a fitness value to this Chromosome
        Since:
        2.6
      • getFitnessValueDirectly

        double getFitnessValueDirectly()
        Returns:
        the lastly computed fitness value, or FitnessFunction.NO_FITNESS_VALUE in case no value has been computed yet.
        Since:
        2.6
      • setIsSelectedForNextGeneration

        void setIsSelectedForNextGeneration(boolean a_isSelected)
        Sets whether this Chromosome has been selected by the natural selector to continue to the next generation or manually (e.g. via an add-method).
        Parameters:
        a_isSelected - true if this Chromosome has been selected, false otherwise
        Since:
        2.6
      • isSelectedForNextGeneration

        boolean isSelectedForNextGeneration()
        Retrieves whether this Chromosome has been selected by the natural selector to continue to the next generation.
        Returns:
        true if this Chromosome has been selected, false otherwise
        Since:
        2.6
      • setApplicationData

        void setApplicationData(java.lang.Object a_newData)
        This sets the application-specific data that is attached to this Chromosome. Attaching application-specific data may be useful for some applications when it comes time to evaluate this Chromosome in the fitness function.
        Parameters:
        a_newData - the new application-specific data to attach to this Chromosome. Should be an instance of IApplicationData
        Since:
        2.6
      • getApplicationData

        java.lang.Object getApplicationData()
        Retrieves the application-specific data that is attached to this Chromosome. Attaching application-specific data may be useful for some applications when it comes time to evaluate this Chromosome in the fitness function. JGAP ignores this data functionally.
        Returns:
        the application-specific data previously attached to this Chromosome, or null if there is no data attached
        Since:
        2.6
      • cleanup

        void cleanup()
        Invoked when this Chromosome is no longer needed and should perform any necessary cleanup. Note that this method will attempt to release this Chromosome instance to the active ChromosomePool, if any.
        Since:
        2.6
      • getConfiguration

        Configuration getConfiguration()
        Returns:
        the configuration set
        Since:
        3.0
      • increaseAge

        void increaseAge()
        Increases the number of evolutionary rounds of chromosome in which it has not been changed by one.
        Since:
        3.2
      • resetAge

        void resetAge()
        Reset age of chromosome because it has been changed.
        Since:
        3.2
      • setAge

        void setAge(int a_age)
        Parameters:
        a_age - set the age of the chromosome, see BestChromosomesSelector for a use-case
        Since:
        3.3.3
      • getAge

        int getAge()
        Returns:
        0: Chromosome newly created in this generation. This means it does not need being crossed over with another newly created one
        Since:
        3.2
      • increaseOperatedOn

        void increaseOperatedOn()
        Increase information of number of genetic operations performed on chromosome in current evolution round.
        Since:
        3.2
      • resetOperatedOn

        void resetOperatedOn()
        Resets the information of how many genetic operators have been performed on the chromosome in the current round of evolution.
        Since:
        3.2
      • operatedOn

        int operatedOn()
        Returns:
        number of genetic operations performed on chromosome in current evolution round
        Since:
        3.2

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.