Functions Bundles, Libraries and MetaLibraries

Bundles

Library

UTCGP.LibraryType

A Library Holds ALL functions that return a 'type' for UTCGP

Callable functions come in bundles of FunctionWrappers.

So the Library first store the bundles and then unpacks them to create the internal library.

source
UTCGP.LibraryMethod
Library(bundles::Vector{FunctionBundle})

Creates a library adding all function bundles.

The vector of FunctionBundles is deepcopyed so that changes to that vector don't affect the Library.

The internal library of FunctionWrappers is empty.

source
Base.sizeFunction
size(library::AbstractLibrary)

Returns the size of the internal library (that holds FunctionWrappers).

source
size(ml::AbstractMetaLibrary)

Returns the number of libraries in the MetaLibrary.

source
size(shared_inputs::AbstractGenomeInputs)

Returns the number of inputs in the internal vector.

source
size(genome::AbstractGenome)

Returns the size of the internal chromosome (a vector of nodes)

source
size(genome::AbstractMetaGenome)

Returns the size of the internal chromosome (a vector of nodes)

source
Base.size(program::Program)

Number of operations.

source
Base.size(pop_progs::PopulationPrograms)

Number of IndividualPrograms inside the population.

Usually the number of individuals

source
Base.lengthFunction
length(library::AbstractLibrary)

Returns the size of the internal library (that holds FunctionWrappers).

source
length(ml::AbstractMetaLibrary)

Returns the number of libraries in the MetaLibrary.

source
length(shared_inputs::AbstractGenomeInputs)

Returns the number of inputs in the internal vector.

source
length(genome::AbstractGenome)

Returns the size of the internal chromosome (a vector of nodes)

source
length(genome::AbstractMetaGenome)

Returns the size of the internal chromosome (a vector of nodes)

source
Base.length(program::Program)

Number of operations.

source
Base.length(pop_progs::PopulationPrograms)

Number of IndividualPrograms inside the population.

Usually the number of individuals

source
Base.getindexFunction

Indexes the internal library at a given index.

source

Index the library with the name of a function

source

Returns the library at a given index.

source

Gets multiple inputs at several indices.

source

Indexes the internal vector of nodes at a given index.

source

Indexes the internal vector of nodes at multiple indices.

source

Indexes the internal vector of nodes at a given index.

source

Indexes the internal vector of nodes at multiple indices.

source
Base.getindex(program::Program, i::Int)

Returns the ith operation in the program.

source
Base.getindex(pop_progs::PopulationPrograms, i::Int)

Index an IndividualPrograms

source
Base.getindex(pop_progs::PopulationPrograms, idx::Vector{Int})

Index an IndividualPrograms

source
Base.iterateFunction

Iterates over the internal node elements.

It iterates over the node_meterial vector.

source

Iterates the internal library.

source

Iterates over all libraries in the MetaLibrary

source

Iterates over the inputs.

source

Iterates the internal chromosome (a vector of nodes) .

source

Iterates the internal chromosome (a vector of nodes) .

source
Base.iterate(program::Program, state = 1)

Iterate over Operations in the program.

source
Base.iterate(pop_progs::PopulationPrograms, state = 1)

Iterate over IndividualPrograms.

source
UTCGP.add_bundle_to_library!Function
add_bundle_to_library!(library::AbstractLibrary, bundle::FunctionBundle)::Int

Adds a bundle to the bundles of the Library.

Returns the length of the internal bundles after addition (nb of bundles in the Library).

source
UTCGP.unpack_bundles_in_library!Function

From all the bundles in the Library, it unpacks them and adds ALL functions to the internal list of functions.

It's a way of having all functions (comming from multiple bundles) in the same place.

This operation is meant to be run once, after all bundles have been added to the Library.

Caveats:

  • This functions will replace the previous (if any) content of the internal list of fns

of the Library. A warning is given if the list of functions was not empty.

  • A warning is also given if the bundles, after unpacking, resulted in an empty list of functions.

Returns the number of functions in Library (after unpacking).

source
UTCGP.list_functions_namesMethod
list_functions_names(library::Library;symbol::Bool = false)

Returns the names of all the functions in the library.

Useful for reproducibility.

The vector can be asked as a vector of strings or a vector of symbols.

source

MetaLibrary

UTCGP.MetaLibraryMethod
MetaLibrary(libs::Vector{<:AbstractLibrary})

From a vector of libraries, they will be unpacked and added to the MetaLibrary.

Caveats:

  • The vector of libraries can't be empty.
  • The libraries will be unpacked one by one
  • The libraries can't be empty
source
UTCGP.list_functions_namesMethod
list_functions_names(meta_library::MetaLibrary)

Returns a vector of vectors (one per library). Each vector is a list of functions inside the library.

source

Casters

UTCGP.listinteger_casterFunction
listinteger_caster(l :: Vector{<:Number})

Cast a vector of generic Number type to concrete Int64 type.

Numbers are floored.

source
UTCGP.listfloat_casterFunction
listfloat_caster(l :: Vector{<:Number})

Cast a vector of generic Number type to concrete Float64 type.

source

Pre made libraries