Class BitFlip
java.lang.Object
org.moeaframework.core.operator.binary.BitFlip
- All Implemented Interfaces:
Configurable
,Mutation
,Variation
Bit flip mutation operator. Each bit is flipped (switched from a
0
to a 1
, or vice versa) using
the specified probability.
This operator is type-safe.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetName()
Returns the name of this variation operator.double
Returns the probability of flipping a bit.Mutates the given parent to produce an offspring.static void
mutate
(BinaryVariable variable, double probability) Mutates the specified variable using bit flip mutation.void
setProbability
(double probability) Sets the probability of flipping a bit.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.moeaframework.core.configuration.Configurable
applyConfiguration, getConfiguration
-
Constructor Details
-
BitFlip
public BitFlip()Constructs a bit flip operator with the default settings. -
BitFlip
public BitFlip(double probability) Constructs a bit flip operator.- Parameters:
probability
- the probability of flipping a bit
-
-
Method Details
-
getName
Description copied from interface:Variation
Returns the name of this variation operator. This name should also be used as the prefix for any parameters. As such, the name should only contain alphanumeric characters, avoid using whitespace and other symbols. -
getProbability
public double getProbability()Returns the probability of flipping a bit.- Returns:
- the probability of flipping a bit
-
setProbability
public void setProbability(double probability) Sets the probability of flipping a bit.- Parameters:
probability
- the probability of flipping a bit
-
mutate
Description copied from interface:Mutation
Mutates the given parent to produce an offspring. -
mutate
Mutates the specified variable using bit flip mutation.- Parameters:
variable
- the variable to be mutatedprobability
- the probability of flipping a bit
-