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

Class BaseChromosome

    • Field Detail

      • GENE_DELIMITER

        public static final java.lang.String GENE_DELIMITER
        This field separates gene class name from the gene persistent representation string. '*' does not work properly with URLEncoder!
        See Also:
        Constant Field Values
      • GENE_DELIMITER_HEADING

        public static final java.lang.String GENE_DELIMITER_HEADING
        Represents the heading delimiter that is used to separate genes in the persistent representation of Chromosome instances.
        See Also:
        Constant Field Values
      • GENE_DELIMITER_CLOSING

        public static final java.lang.String GENE_DELIMITER_CLOSING
        Represents the closing delimiter that is used to separate genes in the persistent representation of Chromosome instances.
        See Also:
        Constant Field Values
      • CHROM_DELIMITER

        public static final java.lang.String CHROM_DELIMITER
        Separates chromosome-related information.
        See Also:
        Constant Field Values
    • Method Detail

      • getUniqueID

        public java.lang.String getUniqueID()
        Specified by:
        getUniqueID in interface IUniqueKey
        Returns:
        unique ID of the chromosome, which allows to distinct this instance from others, in the best case worldwide
        Since:
        3.5
      • setUniqueIDTemplate

        public void setUniqueIDTemplate(java.lang.String a_templateID,
                                        int a_index)
        A template is a chromosome that is the logical predecessor of the current chromosome. A template can occur in mutation or crossing over. In the latter case can be at least two template chromosomes. This is why in this setter method the parameter a_index exists.
        Specified by:
        setUniqueIDTemplate in interface IUniqueKey
        Parameters:
        a_templateID - the unique ID of the template
        a_index - the index of the template, e.g. in crossing over for the second candidate chromosome this is 2
        Since:
        3.5
      • getUniqueIDTemplate

        public java.lang.String getUniqueIDTemplate(int a_index)
        Specified by:
        getUniqueIDTemplate in interface IUniqueKey
        Parameters:
        a_index - the index of the template to retrieve the key for
        Returns:
        String
        Since:
        3.5
      • clone

        public abstract java.lang.Object clone()
        Creates and returns a copy of this object.
        Specified by:
        clone in interface ICloneable
        Overrides:
        clone in class java.lang.Object
        Returns:
        a clone of this instance
        Throws:
        java.lang.IllegalStateException - instead of CloneNotSupportedException
        Since:
        3.0
      • increaseAge

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

        public void resetAge()
        Reset age of chromosome because it has been changed.
        Specified by:
        resetAge in interface IChromosome
        Since:
        3.2
      • getAge

        public int getAge()
        Specified by:
        getAge in interface IChromosome
        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
      • setAge

        public void setAge(int a_age)
        Specified by:
        setAge in interface IChromosome
        Parameters:
        a_age - set the age of the chromosome, see BestChromosomesSelector for a use-case
        Since:
        3.3.3
      • increaseOperatedOn

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

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

        public int operatedOn()
        Specified by:
        operatedOn in interface IChromosome
        Returns:
        number of genetic operations performed on chromosome in current evolution round
        Since:
        3.2
      • getGenes

        public 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.
        Specified by:
        getGenes in interface IChromosome
        Returns:
        an array of the Genes contained within this Chromosome
        Since:
        1.0
      • getGene

        public 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.
        Specified by:
        getGene in interface IChromosome
        Parameters:
        a_desiredLocus - index of the gene value to be returned
        Returns:
        Gene at the given index
        Since:
        1.0
      • setGene

        public void setGene(int a_index,
                            Gene a_gene)
      • size

        public 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.
        Specified by:
        size in interface IChromosome
        Returns:
        number of genes contained within this Chromosome instance
        Since:
        1.0
      • getPersistentRepresentation

        public java.lang.String getPersistentRepresentation()
        Returns a persistent representation of this chromosome, see interface Gene for description. Similar to CompositeGene's routine. But does not include all information of the chromosome (yet).
        Specified by:
        getPersistentRepresentation in interface IPersistentRepresentation
        Returns:
        string representation of this Chromosome's relevant parts of its current state
        Throws:
        java.lang.UnsupportedOperationException
        Since:
        3.2
      • getGenesPersistentRepresentation

        public java.lang.StringBuffer getGenesPersistentRepresentation()
        Returns:
        the persistent representation of the chromosome by considering its genes.
      • getBusinessKey

        public java.lang.String getBusinessKey()
        Specified by:
        getBusinessKey in interface IBusinessKey
        Returns:
        business key of the chromosome
        Since:
        3.2
      • getGenesPersistentRepresentation

        public void getGenesPersistentRepresentation(java.lang.StringBuffer a_buffer)
        Retrieves the persistent representation of the chromosome by considering its genes.
        Parameters:
        a_buffer - the variable to store the persistent representation in

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.