Bardo.Models (Bardo v0.1.0)
View SourceModels for evolutionary computation data structures.
This module provides functions for creating and manipulating the various data structures used in the Bardo system. It includes model definitions for experiments, populations, species, and other components of the evolutionary computation framework.
Summary
Functions
Create an actuator model.
Create an agent model.
Create a champion model.
Create a cortex model.
Delete a model from storage.
Check if a model exists in storage.
Create an experiment model.
Create a fitness model.
Create a genotype model.
Get a value from a nested map using a path of keys.
List all models of a given type.
Create a morphology model.
Create a neuron model.
Create a population model.
Create a population status model.
Read a model from storage by ID and type.
Create a result model.
Create a scape model.
Create a sensor model.
Set a value or values in a model.
Create a specie model.
Create a stat model.
Create a substrate model.
Create a topology summary model.
Create a trace model.
Write a model to storage.
Functions
Create an actuator model.
Takes a map with actuator configuration and returns a model that can be stored in the database.
Create an agent model.
Takes a map with agent configuration and returns a model that can be stored in the database.
Create a champion model.
Takes a map with champion data and returns a model that can be stored in the database.
Create a cortex model.
Takes a map with cortex configuration and returns a model that can be stored in the database.
Delete a model from storage.
Parameters
id- The ID of the model to deletetype- The type of the model (e.g. :experiment, :population, etc.)
Returns
:ok- If the model was deleted successfully{:error, reason}- If there was an error deleting the model
Check if a model exists in storage.
Parameters
id- The ID of the model to checktype- The type of the model (e.g. :experiment, :population, etc.)
Returns
true- If the model existsfalse- If the model does not exist
Create an experiment model.
Takes a map with experiment configuration and returns a model that can be stored in the database.
Create a fitness model.
Takes a map with fitness data and returns a model that can be stored in the database.
Create a genotype model.
Takes a map with genotype configuration and returns a model that can be stored in the database.
Get a value from a nested map using a path of keys.
Parameters
map- The map to get the value frompath- A key or list of keys to traversedefault- Optional default value if the path is not found
Returns
- The value at the path, or the default value if not found
Examples
# Simple key access
iex> Models.get(%{a: 1}, :a)
1
# Nested map access
iex> Models.get(%{a: %{b: 2}}, [:a, :b])
2
# Access with default
iex> Models.get(%{a: 1}, :b, :not_found)
:not_found
List all models of a given type.
Parameters
type- The type of models to list
Returns
[models]- List of models, or empty list if none found
Create a morphology model.
Takes a map with morphology configuration and returns a model that can be stored in the database.
Create a neuron model.
Takes a map with neuron configuration and returns a model that can be stored in the database.
Create a population model.
Takes a map with population configuration and returns a model that can be stored in the database.
Create a population status model.
Read a model from storage by ID and type.
Parameters
id- The ID of the model to readtype- The type of the model (e.g. :experiment, :population, etc.)
Returns
{:ok, model}- If the model was found{:error, reason}- If the model was not found or there was an error
Create a result model.
Takes a map with result data and returns a model that can be stored in the database.
Create a scape model.
Takes a map with scape configuration and returns a model that can be stored in the database.
Create a sensor model.
Takes a map with sensor configuration and returns a model that can be stored in the database.
Set a value or values in a model.
Parameters
key_value- A tuple {key, value} or a list of tuples to setmodel- The model to update
Returns
- The updated model with the new values
Examples
# Set a single value
iex> set({:a, 2}, %{data: %{a: 1}})
%{data: %{a: 2}}
# Set multiple values
iex> set([{:a, 2}, {:b, 3}], %{data: %{a: 1}})
%{data: %{a: 2, b: 3}}
Create a specie model.
Create a stat model.
Takes a map with statistics data and returns a model that can be stored in the database.
Create a substrate model.
Takes a map with substrate configuration and returns a model that can be stored in the database.
Create a topology summary model.
Takes a map with topology data and returns a model that can be stored in the database.
Create a trace model.
Takes a map with trace data and returns a model that can be stored in the database.
Write a model to storage.
Parameters
model- The model to writetype- The type of the modelid- The ID of the model
Returns
:ok- If the model was written successfully{:error, reason}- If there was an error writing the model