Class ImmutableNeatConnectionWeight.Builder
java.lang.Object
net.bmahe.genetics4j.neat.spec.mutation.ImmutableNeatConnectionWeight.Builder
- Direct Known Subclasses:
NeatConnectionWeight.Builder
- Enclosing class:
ImmutableNeatConnectionWeight
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 Summary
Modifier and TypeFieldDescriptionprivate Distribution
private static final long
private static final long
private long
private Distribution
private double
private double
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a newImmutableNeatConnectionWeight
.from
(NeatConnectionWeight instance) Fill a builder with attribute values from the providedNeatConnectionWeight
instance.newValuesDistribution
(Distribution newValuesDistribution) Initializes the value for thenewValuesDistribution
attribute.perturbationDistribution
(Distribution perturbationDistribution) Initializes the value for theperturbationDistribution
attribute.perturbationRatio
(double perturbationRatio) Initializes the value for theperturbationRatio
attribute.private boolean
populationMutationProbability
(double populationMutationProbability) Initializes the value for thepopulationMutationProbability
attribute.private boolean
-
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
-
newValuesDistribution
-
-
Constructor Details
-
Builder
public Builder()Creates a builder forImmutableNeatConnectionWeight
instances.new NeatConnectionWeight.Builder() .populationMutationProbability(double) // optional
populationMutationProbability
.perturbationRatio(double) // optionalperturbationRatio
.perturbationDistribution(net.bmahe.genetics4j.core.spec.statistics.distributions.Distribution) // optionalperturbationDistribution
.newValuesDistribution(net.bmahe.genetics4j.core.spec.statistics.distributions.Distribution) // optionalnewValuesDistribution
.build();
-
-
Method Details
-
from
Fill a builder with attribute values from the providedNeatConnectionWeight
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 thepopulationMutationProbability
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
Initializes the value for theperturbationRatio
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 theperturbationDistribution
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
Initializes the value for thenewValuesDistribution
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
Builds a newImmutableNeatConnectionWeight
.- Returns:
- An immutable instance of NeatConnectionWeight
- Throws:
IllegalStateException
- if any required attributes are missing
-
populationMutationProbabilityIsSet
private boolean populationMutationProbabilityIsSet() -
perturbationRatioIsSet
private boolean perturbationRatioIsSet()
-