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

ChangeWeights
Show fields

Fields of ChangeWeights

chance: f64percent_perturbed: f64
ChangeActivation
Show fields

Fields of ChangeActivation

chance: f64activation_pool: Vec<Activation>
AddNode
Show fields

Fields of AddNode

chance: f64activation_pool: Vec<Activation>
AddConnection
Show fields

Fields of AddConnection

chance: f64
AddRecurrentConnection
Show fields

Fields of AddRecurrentConnection

chance: f64
RemoveNode
Show fields

Fields of RemoveNode

chance: f64

Implementations

impl Mutations[src]

pub fn add_connection(
    genome: &mut Genome,
    rng: &mut GenomeRng
) -> Result<(), &'static str>
[src]

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.


  1. “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]

pub fn add_node(
    activation_pool: &[Activation],
    genome: &mut Genome,
    rng: &mut GenomeRng,
    id_gen: &mut IdGenerator
)
[src]

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]

pub fn add_recurrent_connection(
    genome: &mut Genome,
    rng: &mut GenomeRng
) -> Result<(), &'static str>
[src]

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.


  1. “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]

pub fn change_activation(
    activation_pool: &[Activation],
    genome: &mut Genome,
    rng: &mut GenomeRng
)
[src]

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]

pub fn change_weights(
    percent_perturbed: f64,
    genome: &mut Genome,
    rng: &mut GenomeRng
)
[src]

This mutation alters percent_perturbed connection weights with perturbations sampled from calls to GenomeRng::weight_perturbation.

impl Mutations[src]

pub fn remove_node(
    genome: &mut Genome,
    rng: &mut impl Rng
) -> Result<(), &'static str>
[src]

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]

pub fn mutate(
    &self,
    genome: &mut Genome,
    rng: &mut GenomeRng,
    id_gen: &mut IdGenerator
) -> Result<(), &'static str>
[src]

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 Clone for Mutations[src]

impl Debug for Mutations[src]

impl<'de> Deserialize<'de> for Mutations[src]

impl Serialize for Mutations[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,