Enum set_genome::Mutations [−][src]
pub enum Mutations { ChangeWeights { chance: f64, percent_perturbed: f64, }, ChangeActivation { chance: f64, activation_pool: Vec<Activation>, }, AddNode { chance: f64, activation_pool: Vec<Activation>, }, AddConnection { chance: f64, }, AddRecurrentConnection { chance: f64, }, RemoveNode { chance: f64, }, }
Lists all possible mutations with their corresponding parameters.
Each mutation acts as a self-contained unit and has to be listed in the crate::Parameters::mutations
field in order to take effect when calling crate::Genome::mutate_with_context
.
Variants
Show fields
Fields of ChangeActivation
chance: f64
activation_pool: Vec<Activation>
See Mutations::add_node
.
Show fields
Fields of AddNode
chance: f64
activation_pool: Vec<Activation>
Show fields
Fields of AddConnection
chance: f64
Show fields
Fields of AddRecurrentConnection
chance: f64
Show fields
Fields of RemoveNode
chance: f64
Implementations
impl Mutations
[src]
impl Mutations
[src]pub fn add_connection(
genome: &mut Genome,
rng: &mut GenomeRng
) -> Result<(), &'static str>
[src]
genome: &mut Genome,
rng: &mut GenomeRng
) -> Result<(), &'static str>
This mutation adds a new feed-forward connection to the genome, should it be possible. It is possible when any two nodes1 are not yet connected with a recurrent connection.
“any two nodes” is technically not correct as the start node for the connection has to come from the intersection of input and hidden nodes and the end node has to come from the intersection of the hidden and output nodes. ↩
impl Mutations
[src]
impl Mutations
[src]pub fn add_node(
activation_pool: &[Activation],
genome: &mut Genome,
rng: &mut GenomeRng,
id_gen: &mut IdGenerator
)
[src]
activation_pool: &[Activation],
genome: &mut Genome,
rng: &mut GenomeRng,
id_gen: &mut IdGenerator
)
This mutation adds a new node to the genome by “splitting” an existing connection, i.e. the existing connection gets “re-routed” via the new node and the weight of the split connection is set to zero. The connection leading into the new node is of weight 1.0 and the connection originating from the new node has the same weight as the split connection (before it is zeroed).
impl Mutations
[src]
impl Mutations
[src]pub fn add_recurrent_connection(
genome: &mut Genome,
rng: &mut GenomeRng
) -> Result<(), &'static str>
[src]
genome: &mut Genome,
rng: &mut GenomeRng
) -> Result<(), &'static str>
This mutation adds a recurrent connection to the genome
when possible.
It is possible when any two nodes 1 are not yet connected with a recurrent connection.
“any two nodes” is technically not correct as the start node for the connection has to come from the intersection of input and hidden nodes and the end node has to come from the intersection of the hidden and output nodes. ↩
impl Mutations
[src]
impl Mutations
[src]pub fn change_activation(
activation_pool: &[Activation],
genome: &mut Genome,
rng: &mut GenomeRng
)
[src]
activation_pool: &[Activation],
genome: &mut Genome,
rng: &mut GenomeRng
)
This mutation changes the activation function of one random hidden node to any other choosen from activation_pool
.
If the pool is empty (the current activation function is excluded) nothing is changed.
impl Mutations
[src]
impl Mutations
[src]pub fn change_weights(
percent_perturbed: f64,
genome: &mut Genome,
rng: &mut GenomeRng
)
[src]
percent_perturbed: f64,
genome: &mut Genome,
rng: &mut GenomeRng
)
This mutation alters percent_perturbed
connection weights with perturbations sampled from calls to GenomeRng::weight_perturbation
.
impl Mutations
[src]
impl Mutations
[src]pub fn remove_node(
genome: &mut Genome,
rng: &mut impl Rng
) -> Result<(), &'static str>
[src]
genome: &mut Genome,
rng: &mut impl Rng
) -> Result<(), &'static str>
Removes a node and all incoming and outgoing connections, should this be possible without introducing dangling structure. Dangling means the in- or out-degree of any hidden node is zero, i.e. it neither can receive nor propagate a signal. If it is not possible, no node will be removed.
impl Mutations
[src]
impl Mutations
[src]pub fn mutate(
&self,
genome: &mut Genome,
rng: &mut GenomeRng,
id_gen: &mut IdGenerator
) -> Result<(), &'static str>
[src]
&self,
genome: &mut Genome,
rng: &mut GenomeRng,
id_gen: &mut IdGenerator
) -> Result<(), &'static str>
Mutate a Genome
but respects the associate chance
field of the Mutations
enum variants.
The user needs to supply the GenomeRng
and IdGenerator
manually when using this method directly.
Use the crate::GenomeContext
and the genomes <>_with_context
functions to avoid manually handling those.
Trait Implementations
impl<'de> Deserialize<'de> for Mutations
[src]
impl<'de> Deserialize<'de> for Mutations
[src]fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
impl RefUnwindSafe for Mutations
impl RefUnwindSafe for Mutations
impl UnwindSafe for Mutations
impl UnwindSafe for Mutations