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()
.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Builds instances of typeImmutableNeatCombination
.private final class
-
Field Summary
Modifier and TypeFieldDescriptionprivate final double
private final ParentComparisonPolicy
private final double
private static final byte
private static final byte
private static final byte
Fields inherited from interface net.bmahe.genetics4j.neat.spec.combination.NeatCombination
DEFAULT_INHERITANCE_THRESHOLD, DEFAULT_REENABLE_GENE_INHERITANCE_THRESHOLD
-
Constructor Summary
ModifierConstructorDescriptionprivate
ImmutableNeatCombination
(double inheritanceThresold, double reenableGeneInheritanceThresold, ParentComparisonPolicy parentComparisonPolicy) private
-
Method Summary
Modifier and TypeMethodDescriptionstatic ImmutableNeatCombination
copyOf
(NeatCombination instance) Creates an immutable copy of aNeatCombination
value.boolean
This instance is equal to all instances ofImmutableNeatCombination
that have equal attribute values.private boolean
equalTo
(int synthetic, ImmutableNeatCombination another) int
hashCode()
Computes a hash code from attributes:inheritanceThresold
,reenableGeneInheritanceThresold
,parentComparisonPolicy
.double
Matching, excess and disjoint genes may be chosen randomly between the parents.private double
Returns The policy used to compare parents. Defaults to fitness comparison..private ParentComparisonPolicy
double
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.private double
toString()
Prints the immutable valueNeatCombination
with attribute values.private static ImmutableNeatCombination
validate
(ImmutableNeatCombination instance) final ImmutableNeatCombination
withInheritanceThresold
(double value) Copy the current immutable object by setting a value for theinheritanceThresold
attribute.final ImmutableNeatCombination
Copy the current immutable object by setting a value for theparentComparisonPolicy
attribute.final ImmutableNeatCombination
withReenableGeneInheritanceThresold
(double value) Copy the current immutable object by setting a value for thereenableGeneInheritanceThresold
attribute.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.bmahe.genetics4j.neat.spec.combination.NeatCombination
check
-
Field Details
-
inheritanceThresold
private final double inheritanceThresold -
reenableGeneInheritanceThresold
private final double reenableGeneInheritanceThresold -
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
-
-
Constructor Details
-
ImmutableNeatCombination
-
ImmutableNeatCombination
private ImmutableNeatCombination(double inheritanceThresold, double reenableGeneInheritanceThresold, ParentComparisonPolicy parentComparisonPolicy)
-
-
Method Details
-
inheritanceThresoldInitialize
private double inheritanceThresoldInitialize() -
reenableGeneInheritanceThresoldInitialize
private double reenableGeneInheritanceThresoldInitialize() -
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 interfaceNeatCombination
- 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 interfaceNeatCombination
- 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
Returns The policy used to compare parents. Defaults to fitness comparison..- Specified by:
parentComparisonPolicy
in interfaceNeatCombination
- Returns:
- The policy used to compare parents. Defaults to fitness comparison.
-
withInheritanceThresold
Copy the current immutable object by setting a value for theinheritanceThresold
attribute. A value strict bits equality used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for inheritanceThresold- Returns:
- A modified copy of the
this
object
-
withReenableGeneInheritanceThresold
Copy the current immutable object by setting a value for thereenableGeneInheritanceThresold
attribute. A value strict bits equality used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for reenableGeneInheritanceThresold- Returns:
- A modified copy of the
this
object
-
withParentComparisonPolicy
Copy the current immutable object by setting a value for theparentComparisonPolicy
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for parentComparisonPolicy- Returns:
- A modified copy of the
this
object
-
equals
This instance is equal to all instances ofImmutableNeatCombination
that have equal attribute values. -
equalTo
-
hashCode
public int hashCode()Computes a hash code from attributes:inheritanceThresold
,reenableGeneInheritanceThresold
,parentComparisonPolicy
. -
toString
Prints the immutable valueNeatCombination
with attribute values. -
validate
-
copyOf
Creates an immutable copy of aNeatCombination
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
-