Bardo.PolisMgr (Bardo v0.1.0)

View Source

Interface module for Polis Manager operations.

This module acts as a facade for the Polis.Manager implementation, providing compatibility with the complex examples that expect a root-level PolisMgr module.

Summary

Functions

Evolves the next generation for a specific polis instance.

Prepares the system with the provided tarball.

Sends a command to a live polis instance.

Sets up the neuroevolutionary platform with the given configuration.

Starts an experiment with the given ID.

Gets the current status of the specified agent.

Stops the polis manager and cleans up resources.

Stops a specific polis instance.

Updates the population for a specific polis instance.

Functions

evolve_generation(id)

@spec evolve_generation(atom() | binary()) :: {:ok, map()} | {:error, term()}

Evolves the next generation for a specific polis instance.

Parameters

  • id - ID of the polis instance

Returns

  • {:ok, generation_info} - Info about the evolved generation
  • {:error, reason} - If there was an error evolving the generation

prep(tarball)

@spec prep(binary()) :: :ok | {:error, term()}

Prepares the system with the provided tarball.

send_command(id, command)

@spec send_command(atom() | binary(), atom()) :: {:ok, term()} | {:error, term()}

Sends a command to a live polis instance.

Parameters

  • id - ID of the polis instance to send the command to
  • command - The command to send

Returns

  • {:ok, result} - Result of the command
  • {:error, reason} - If there was an error executing the command

setup(config)

@spec setup(map()) :: {:ok, term()} | {:error, term()}

Sets up the neuroevolutionary platform with the given configuration.

This function configures the environment, sets up populations and scapes according to the provided configuration.

Parameters

  • config - Map containing configuration for experiments, populations, and scapes

Returns

  • {:ok, term} - If the setup was successful
  • {:error, reason} - If there was an error during setup

start_experiment(experiment_id)

@spec start_experiment(atom() | binary()) :: :ok | {:error, term()}

Starts an experiment with the given ID.

Parameters

  • experiment_id - ID of the experiment to start

Returns

  • :ok - If the experiment was started successfully
  • {:error, reason} - If there was an error starting the experiment

status(id)

@spec status(atom() | binary()) :: {:ok, map()} | {:error, term()}

Gets the current status of the specified agent.

Parameters

  • id - ID of the agent to check

Returns

  • {:ok, status} - Status information about the agent
  • {:error, reason} - If there was an error getting the status

stop()

@spec stop() :: :ok

Stops the polis manager and cleans up resources.

stop(id)

@spec stop(atom() | binary()) :: :ok | {:error, term()}

Stops a specific polis instance.

Parameters

  • id - ID of the polis instance to stop

Returns

  • :ok - If the polis was stopped successfully
  • {:error, reason} - If there was an error stopping the polis

update_population(id, population)

@spec update_population(atom() | binary(), map()) :: :ok | {:error, term()}

Updates the population for a specific polis instance.

Parameters

  • id - ID of the polis instance
  • population - New population data

Returns

  • :ok - If the population was updated successfully
  • {:error, reason} - If there was an error updating the population