Package org.opt4j.operator.mutate
Class AdaptiveMutationRate
- java.lang.Object
-
- org.opt4j.operator.mutate.AdaptiveMutationRate
-
- All Implemented Interfaces:
IndividualStateListener
,MutationRate
public class AdaptiveMutationRate extends Object implements MutationRate, IndividualStateListener
Self adaptiveMutationRate
that uses the size of the genotype (size
) to estimate a rate. The calculated rate is 1/size
.
-
-
Field Summary
Fields Modifier and Type Field Description protected IndividualFactory
individualFactory
protected boolean
isInit
protected double
rate
-
Constructor Summary
Constructors Constructor Description AdaptiveMutationRate(IndividualFactory individualFactory)
Constructs anAdaptiveMutationRate
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
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 Detail
-
isInit
protected boolean isInit
-
rate
protected double rate
-
individualFactory
protected final IndividualFactory individualFactory
-
-
Constructor Detail
-
AdaptiveMutationRate
@Inject public AdaptiveMutationRate(IndividualFactory individualFactory)
Constructs anAdaptiveMutationRate
.- Parameters:
individualFactory
- the individual creator
-
-
Method Detail
-
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
public void inidividualStateChanged(Individual individual)
Description copied from interface:IndividualStateListener
Invoked if theIndividual
changes its state.- Specified by:
inidividualStateChanged
in interfaceIndividualStateListener
- Parameters:
individual
- the individual that changes the state
-
-