Class ImmutableNeatConnectionWeight.Builder

java.lang.Object
net.bmahe.genetics4j.neat.spec.mutation.ImmutableNeatConnectionWeight.Builder
Direct Known Subclasses:
NeatConnectionWeight.Builder
Enclosing class:
ImmutableNeatConnectionWeight

public static class ImmutableNeatConnectionWeight.Builder extends Object
Builds instances of type ImmutableNeatConnectionWeight. Initialize attributes and then invoke the build() method to create an immutable instance.

Builder is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.

  • Field Details

    • OPT_BIT_POPULATION_MUTATION_PROBABILITY

      private static final long OPT_BIT_POPULATION_MUTATION_PROBABILITY
      See Also:
    • OPT_BIT_PERTURBATION_RATIO

      private static final long OPT_BIT_PERTURBATION_RATIO
      See Also:
    • optBits

      private long optBits
    • populationMutationProbability

      private double populationMutationProbability
    • perturbationRatio

      private double perturbationRatio
    • perturbationDistribution

      private Distribution perturbationDistribution
    • newValuesDistribution

      private Distribution newValuesDistribution
  • Constructor Details

  • Method Details

    • from

      public final NeatConnectionWeight.Builder from(NeatConnectionWeight instance)
      Fill a builder with attribute values from the provided NeatConnectionWeight instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • populationMutationProbability

      public final NeatConnectionWeight.Builder populationMutationProbability(double populationMutationProbability)
      Initializes the value for the populationMutationProbability attribute.

      If not set, this attribute will have a default value as returned by the initializer of populationMutationProbability.

      Parameters:
      populationMutationProbability - The value for populationMutationProbability
      Returns:
      this builder for use in a chained invocation
    • perturbationRatio

      public final NeatConnectionWeight.Builder perturbationRatio(double perturbationRatio)
      Initializes the value for the perturbationRatio attribute.

      If not set, this attribute will have a default value as returned by the initializer of perturbationRatio.

      Parameters:
      perturbationRatio - The value for perturbationRatio
      Returns:
      this builder for use in a chained invocation
    • perturbationDistribution

      public final NeatConnectionWeight.Builder perturbationDistribution(Distribution perturbationDistribution)
      Initializes the value for the perturbationDistribution attribute.

      If not set, this attribute will have a default value as returned by the initializer of perturbationDistribution.

      Parameters:
      perturbationDistribution - The value for perturbationDistribution
      Returns:
      this builder for use in a chained invocation
    • newValuesDistribution

      public final NeatConnectionWeight.Builder newValuesDistribution(Distribution newValuesDistribution)
      Initializes the value for the newValuesDistribution attribute.

      If not set, this attribute will have a default value as returned by the initializer of newValuesDistribution.

      Parameters:
      newValuesDistribution - The value for newValuesDistribution
      Returns:
      this builder for use in a chained invocation
    • build

      Returns:
      An immutable instance of NeatConnectionWeight
      Throws:
      IllegalStateException - if any required attributes are missing
    • populationMutationProbabilityIsSet

      private boolean populationMutationProbabilityIsSet()
    • perturbationRatioIsSet

      private boolean perturbationRatioIsSet()