Struct Cppn

Source
pub struct Cppn<'a, N, L, EXTID>
where N: CppnNodeType + 'a, L: Copy + Debug + Send + Sized + Into<f64> + 'a, EXTID: Copy + Debug + Send + Sized + Ord + 'a,
{ /* private fields */ }
Expand description

Represents a Compositional Pattern Producing Network (CPPN)

Implementations§

Source§

impl<'a, N, L, EXTID> Cppn<'a, N, L, EXTID>
where N: CppnNodeType + 'a, L: Copy + Debug + Send + Sized + Into<f64> + 'a, EXTID: Copy + Debug + Send + Sized + Ord + 'a,

Source

pub fn new(graph: &'a CppnGraph<N, L, EXTID>) -> Cppn<'a, N, L, EXTID>

Source

pub fn incoming_signals(&self) -> &[f64]

Source

pub fn calculate(&mut self, inputs: &[&[f64]]) -> Vec<f64>

Calculate all outputs

Source

pub fn read_output(&self, nth_output: usize) -> Option<f64>

Reads the nth_output of the network.

Source

pub fn output_count(&self) -> usize

Returns the number of outputs

Source

pub fn input_count(&self) -> usize

Returns the number of inputs

Source

pub fn process(&mut self, inputs: &[&[f64]])

Process the network for the given inputs. Outputs can be read after this call using read_output.

Source

pub fn group_layers(&self) -> Vec<Vec<usize>>

Group the nodes into layers.

Source

pub fn layout(&self) -> Vec<usize>

Auto Trait Implementations§

§

impl<'a, N, L, EXTID> Freeze for Cppn<'a, N, L, EXTID>

§

impl<'a, N, L, EXTID> RefUnwindSafe for Cppn<'a, N, L, EXTID>

§

impl<'a, N, L, EXTID> Send for Cppn<'a, N, L, EXTID>
where N: Sync, EXTID: Sync, L: Sync,

§

impl<'a, N, L, EXTID> Sync for Cppn<'a, N, L, EXTID>
where N: Sync, EXTID: Sync, L: Sync,

§

impl<'a, N, L, EXTID> Unpin for Cppn<'a, N, L, EXTID>

§

impl<'a, N, L, EXTID> UnwindSafe for Cppn<'a, N, L, EXTID>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.