Package org.opt4j.operator.mutate
Class AdaptiveMutationRate
java.lang.Object
org.opt4j.operator.mutate.AdaptiveMutationRate
- All Implemented Interfaces:
IndividualStateListener
,MutationRate
Self adaptive
MutationRate
that uses the size of the genotype (
size
) to estimate a rate. The calculated rate is 1/size
.-
Field Summary
Modifier and TypeFieldDescriptionprotected final IndividualFactory
protected boolean
protected double
-
Constructor Summary
ConstructorDescriptionAdaptiveMutationRate
(IndividualFactory individualFactory) Constructs anAdaptiveMutationRate
. -
Method Summary
Modifier and TypeMethodDescriptiondouble
get()
Returns the mutation rate as a double value.void
inidividualStateChanged
(Individual individual) Invoked if theIndividual
changes its state.void
init()
Initializes the listeners.void
set
(double value) Sets the mutation to a double value.
-
Field Details
-
isInit
protected boolean isInit -
rate
protected double rate -
individualFactory
-
-
Constructor Details
-
AdaptiveMutationRate
Constructs anAdaptiveMutationRate
.- Parameters:
individualFactory
- the individual creator
-
-
Method Details
-
init
@Inject public void init()Initializes the listeners. -
get
public double get()Description copied from interface:MutationRate
Returns the mutation rate as a double value.- Specified by:
get
in interfaceMutationRate
- Returns:
- the mutation rate
-
set
public void set(double value) Description copied from interface:MutationRate
Sets the mutation to a double value.- Specified by:
set
in interfaceMutationRate
- Parameters:
value
- the new muation rate
-
inidividualStateChanged
Description copied from interface:IndividualStateListener
Invoked if theIndividual
changes its state.- Specified by:
inidividualStateChanged
in interfaceIndividualStateListener
- Parameters:
individual
- the individual that changes the state
-