Bardo.PopulationManager.PopulationManagerSupervisor (Bardo v0.1.0)

View Source

Dynamic supervisor for population manager workers.

This module provides helper functions for starting, stopping and managing population workers, which handle the evolutionary process for populations of neural networks.

Summary

Functions

Returns a specification to start this module under a supervisor.

Get the count of running populations.

List all running population IDs.

Starts the supervisor.

Start a new population worker under the dynamic supervisor.

Stop a population worker.

Functions

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

count_populations()

@spec count_populations() :: {:ok, non_neg_integer()}

Get the count of running populations.

Returns

  • {:ok, count} - The number of running population workers

list_populations()

@spec list_populations() :: {:ok, [atom()]}

List all running population IDs.

Returns

  • {:ok, [atom()]} - List of running population IDs

start_link(args \\ [])

Starts the supervisor.

Parameters

  • args - Optional arguments for the supervisor

Returns

  • {:ok, pid} - PID of the started supervisor process

start_population(population_id, params)

@spec start_population(binary() | atom(), map()) :: DynamicSupervisor.on_start_child()

Start a new population worker under the dynamic supervisor.

Parameters

  • population_id - Unique identifier for the population
  • params - Parameters for the population, including experiment ID, size, etc.

Returns

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

stop_population(population_id)

@spec stop_population(binary() | atom()) :: :ok | {:error, :not_found}

Stop a population worker.

Parameters

  • population_id - Unique identifier for the population

Returns

  • :ok - If the worker was stopped successfully
  • {:error, :not_found} - If the worker was not found