neuroevolution_evaluator_worker (faber_neuroevolution v1.2.4)

View Source

Event-driven evaluator worker for distributed neuroevolution.

This gen_server subscribes to evaluation request events and runs evaluations using a configured evaluator module. Results are published back to the evaluated topic.

Usage

Start a worker for a specific realm:

{ok, Pid} = neuroevolution_evaluator_worker:start_link(#{ realm => RealmBinary, evaluator_module => my_evaluator, evaluator_options => #{} }).

The worker will automatically subscribe to neuro.<realm>.evaluate and publish results to neuro.<realm>.evaluated.

Message Format

The worker expects messages in the format: {neuro_event, Topic, {evaluate_request, RequestMap}}

Where RequestMap contains: - request_id - Correlation ID for tracking - individual_id - The individual's ID - network - The neural network to evaluate - options - Domain-specific evaluation options

Distributed Operation

Multiple workers can subscribe to the same realm topic. The event backend determines load distribution: - Local backend (pg): All workers receive all requests - Macula backend: DHT-based routing (load balanced)

Summary

Functions

Start a linked evaluator worker.

Stop a worker.

Types

worker_config/0

-type worker_config() ::
          #{realm := binary(),
            evaluator_module := module(),
            evaluator_options => map(),
            max_concurrent => pos_integer()}.

Functions

start_link(Config)

-spec start_link(Config) -> {ok, pid()} | {error, term()} when Config :: worker_config().

Start a linked evaluator worker.

Config must contain: - realm - The realm to subscribe to - evaluator_module - Module implementing neuroevolution_evaluator behaviour

Optional: - evaluator_options - Options passed to evaluator (default: #{}) - max_concurrent - Max concurrent evaluations (default: 10)

stop(Pid)

-spec stop(Pid) -> ok when Pid :: pid().

Stop a worker.