Class ImmutableNeatCombination

java.lang.Object
net.bmahe.genetics4j.neat.spec.combination.ImmutableNeatCombination
All Implemented Interfaces:
CombinationPolicy, NeatCombination

@Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableNeatCombination extends Object implements NeatCombination
Immutable implementation of NeatCombination.

Use the builder to create immutable instances: new NeatCombination.Builder().

  • Field Details

    • inheritanceThresold

      private final double inheritanceThresold
    • reenableGeneInheritanceThresold

      private final double reenableGeneInheritanceThresold
    • parentComparisonPolicy

      private final ParentComparisonPolicy parentComparisonPolicy
    • STAGE_INITIALIZING

      private static final byte STAGE_INITIALIZING
      See Also:
    • STAGE_UNINITIALIZED

      private static final byte STAGE_UNINITIALIZED
      See Also:
    • STAGE_INITIALIZED

      private static final byte STAGE_INITIALIZED
      See Also:
    • initShim

      private transient volatile ImmutableNeatCombination.InitShim initShim
  • Constructor Details

    • ImmutableNeatCombination

      private ImmutableNeatCombination(ImmutableNeatCombination.Builder builder)
    • ImmutableNeatCombination

      private ImmutableNeatCombination(double inheritanceThresold, double reenableGeneInheritanceThresold, ParentComparisonPolicy parentComparisonPolicy)
  • Method Details

    • inheritanceThresoldInitialize

      private double inheritanceThresoldInitialize()
    • reenableGeneInheritanceThresoldInitialize

      private double reenableGeneInheritanceThresoldInitialize()
    • parentComparisonPolicyInitialize

      private ParentComparisonPolicy parentComparisonPolicyInitialize()
    • inheritanceThresold

      public double inheritanceThresold()
      Matching, excess and disjoint genes may be chosen randomly between the parents. By default the selection is unbiased toward any parent. This threshold can be adjusted towards the better individual or the lesser one.
      Acceptable values are between 0 and 1 (inclusive), and higher values will favor the better individual
      Specified by:
      inheritanceThresold in interface NeatCombination
      Returns:
    • reenableGeneInheritanceThresold

      public double reenableGeneInheritanceThresold()
      Returns If a gene is disabled in either parent, there is a chance it will get re-enabled if it is enabled in either parent.
      This setting configures that threshold.
      Specified by:
      reenableGeneInheritanceThresold in interface NeatCombination
      Returns:
      If a gene is disabled in either parent, there is a chance it will get re-enabled if it is enabled in either parent.
      This setting configures that threshold
    • parentComparisonPolicy

      public ParentComparisonPolicy parentComparisonPolicy()
      Returns The policy used to compare parents. Defaults to fitness comparison..
      Specified by:
      parentComparisonPolicy in interface NeatCombination
      Returns:
      The policy used to compare parents. Defaults to fitness comparison.
    • withInheritanceThresold

      public final ImmutableNeatCombination withInheritanceThresold(double value)
      Copy the current immutable object by setting a value for the inheritanceThresold attribute. A value strict bits equality used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for inheritanceThresold
      Returns:
      A modified copy of the this object
    • withReenableGeneInheritanceThresold

      public final ImmutableNeatCombination withReenableGeneInheritanceThresold(double value)
      Copy the current immutable object by setting a value for the reenableGeneInheritanceThresold attribute. A value strict bits equality used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for reenableGeneInheritanceThresold
      Returns:
      A modified copy of the this object
    • withParentComparisonPolicy

      public final ImmutableNeatCombination withParentComparisonPolicy(ParentComparisonPolicy value)
      Copy the current immutable object by setting a value for the parentComparisonPolicy attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for parentComparisonPolicy
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableNeatCombination that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • equalTo

      private boolean equalTo(int synthetic, ImmutableNeatCombination another)
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: inheritanceThresold, reenableGeneInheritanceThresold, parentComparisonPolicy.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value NeatCombination with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • validate

      private static ImmutableNeatCombination validate(ImmutableNeatCombination instance)
    • copyOf

      public static ImmutableNeatCombination copyOf(NeatCombination instance)
      Creates an immutable copy of a NeatCombination value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable NeatCombination instance