Documentation of 'org.jgap.distr.Culture' Java class
Culture
org.jgap.distr

Class Culture

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable


    public class Culture
    extends java.lang.Object
    implements java.io.Serializable, java.lang.Comparable
    Culture is a memory not being bound to a generation, but possibly persistent during the whole history of a genotype (over all generations). See GPConfiguration for current support of culture with Genetic Programming.

    Also see http://cs.gmu.edu/~sean/papers/culture-gp96.pdf

    Since:
    2.3
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      Culture(int a_size)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void clear()
      Clears the memory.
      int compareTo(java.lang.Object a_other)
      The compareTo-method.
      boolean contains(java.lang.String a_name)
      Checks if a memory cell with the given name exists.
      boolean equals(java.lang.Object a_other)
      The equals-method.
      CultureMemoryCell get(int a_index)
      Retrieves the memory cell at the given index.
      CultureMemoryCell get(java.lang.String a_name)
      Retrieves the memory cell at the given index.
      CultureMemoryCell getMatrix(int a_x, int a_y)
      Reads a value from the matrix memory that was previously stored with setMatrix(...).
      java.util.List getMemoryNames() 
      CultureMemoryCell set(int a_index, double a_value, int a_historySize, java.lang.String a_name)
      Sets a memory cell with a given value.
      CultureMemoryCell set(int a_index, java.lang.Object a_value, int a_historySize, java.lang.String a_infotext)
      Sets a memory cell with a given value.
      CultureMemoryCell set(java.lang.String a_name, java.lang.Object a_value, int a_historySize)
      Sets a memory cell with a given value.
      CultureMemoryCell setMatrix(int a_x, int a_y, java.lang.Object a_value)
      Stores a value in the matrix memory.
      void setMatrixWidth(int a_width)
      Sets the width of the matrix memory.
      int size() 
      java.lang.String toString() 
      • Methods inherited from class java.lang.Object

        getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Culture

        public Culture(int a_size)
        Constructor.
        Parameters:
        a_size - the size of the memory in cells (CultureMemoryCell instances)
        Since:
        2.3
    • Method Detail

      • set

        public CultureMemoryCell set(int a_index,
                                     double a_value,
                                     int a_historySize,
                                     java.lang.String a_name)
        Sets a memory cell with a given value. The memory cell will be newly created for that.
        Parameters:
        a_index - index of the memory cell
        a_value - value to set in the memory
        a_historySize - size of history to use, or less than 1 for turning history off
        a_name - informative name of the memory cell
        Returns:
        newly created memory cell set with the given value
        Since:
        2.3
      • set

        public CultureMemoryCell set(int a_index,
                                     java.lang.Object a_value,
                                     int a_historySize,
                                     java.lang.String a_infotext)
        Sets a memory cell with a given value. The memory cell will be newly created for that.
        Parameters:
        a_index - index of the memory cell
        a_value - value to set in the memory
        a_historySize - size of history to use, or less than 1 for turning history off
        a_infotext - informative name of the memory cell
        Returns:
        newly created memory cell set with the given value
        Since:
        3.0
      • set

        public CultureMemoryCell set(java.lang.String a_name,
                                     java.lang.Object a_value,
                                     int a_historySize)
        Sets a memory cell with a given value. The memory cell will be newly created for that.
        Parameters:
        a_name - named index of the memory cell
        a_value - value to set in the memory
        a_historySize - size of history to use, or less than 1 for turning history off
        Returns:
        newly created memory cell set with the given value
        Since:
        3.0
      • get

        public CultureMemoryCell get(int a_index)
        Retrieves the memory cell at the given index.
        Parameters:
        a_index - index of the memory cell to read out
        Returns:
        stored memory cell at given index
        Since:
        2.3
      • get

        public CultureMemoryCell get(java.lang.String a_name)
        Retrieves the memory cell at the given index.
        Parameters:
        a_name - name of the memory cell to read out
        Returns:
        stored memory cell for given name, or null if name unknown
        Since:
        3.0
      • contains

        public boolean contains(java.lang.String a_name)
        Checks if a memory cell with the given name exists.
        Parameters:
        a_name - the name of the cell to check
        Returns:
        true: cell excists
        Since:
        3.2
      • size

        public int size()
        Returns:
        size of the memory
        Since:
        2.3
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Returns:
        String representation of the cultural memory
        Since:
        2.3
      • clear

        public void clear()
        Clears the memory.
        Since:
        3.0
      • getMemoryNames

        public java.util.List getMemoryNames()
        Returns:
        cloned list of symbolic memory names
        Since:
        3.0
      • equals

        public boolean equals(java.lang.Object a_other)
        The equals-method.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        a_other - the other object to compare
        Returns:
        true if the objects are regarded as equal
        Since:
        3.0
      • compareTo

        public int compareTo(java.lang.Object a_other)
        The compareTo-method.
        Specified by:
        compareTo in interface java.lang.Comparable
        Parameters:
        a_other - the other object to compare
        Returns:
        -1, 0, 1
        Since:
        3.0
      • setMatrixWidth

        public void setMatrixWidth(int a_width)
        Sets the width of the matrix memory. Important to call before using setMatrix/getMatrix!
        Parameters:
        a_width - the width the matrix should have
        Since:
        3.2
      • setMatrix

        public CultureMemoryCell setMatrix(int a_x,
                                           int a_y,
                                           java.lang.Object a_value)
        Stores a value in the matrix memory. Use setMatrixWidth(int) beforehand!
        Parameters:
        a_x - the first coordinate of the matrix (width)
        a_y - the second coordinate of the matrix (height)
        a_value - the value to store
        Returns:
        created or used memory cell
        Since:
        3.2
      • getMatrix

        public CultureMemoryCell getMatrix(int a_x,
                                           int a_y)
        Reads a value from the matrix memory that was previously stored with setMatrix(...).
        Parameters:
        a_x - the first coordinate of the matrix (width)
        a_y - the second coordinate of the matrix (height)
        Returns:
        read value
        Since:
        3.2

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.