PyHighLevelSelectionModel

Full Name

neuroptimiser.core.models.PyHighLevelSelectionModel

Description

class PyHighLevelSelectionModel[source]

Bases: PyLoihiProcessModel

High-level selection model for perturbation-based nheuristics

This model implements a high-level selection process that aggregates the best positions from multiple NeuroHeuristicUnit and selects the overall best position based on a fitness function.

See also

neuroptimiser.core.processes.HighLevelSelection

Process that performs high-level selection of the best position from multiple NeuroHeuristicUnit processes.

__init__(proc_params)[source]

Initialises the high-level selection model with the given parameters.

Parameters:

proc_params (dict) –

A dictionary containing the parameters for the process model. It must include:
  • num_agents: int, number of agents in the system

fg: ndarray = LavaPyType(cls=<class 'numpy.ndarray'>, d_type=<class 'float'>, precision=None)
fg_out: PyOutPort = LavaPyType(cls=<class 'lava.magma.core.model.py.ports.PyOutPortVectorDense'>, d_type=<class 'numpy.float32'>, precision=None)
fp: ndarray = LavaPyType(cls=<class 'numpy.ndarray'>, d_type=<class 'float'>, precision=None)
fp_in: PyInPort = LavaPyType(cls=<class 'lava.magma.core.model.py.ports.PyInPortVectorDense'>, d_type=<class 'numpy.float32'>, precision=None)
g: ndarray = LavaPyType(cls=<class 'numpy.ndarray'>, d_type=<class 'float'>, precision=None)
g_out: PyOutPort = LavaPyType(cls=<class 'lava.magma.core.model.py.ports.PyOutPortVectorDense'>, d_type=<class 'numpy.float32'>, precision=None)
implements_process

alias of HighLevelSelection

implements_protocol

alias of LoihiProtocol

p: ndarray = LavaPyType(cls=<class 'numpy.ndarray'>, d_type=<class 'float'>, precision=None)
p_in: PyInPort = LavaPyType(cls=<class 'lava.magma.core.model.py.ports.PyInPortVectorDense'>, d_type=<class 'numpy.float32'>, precision=None)
required_resources: ty.List[ty.Type[AbstractResource]] = [<class 'lava.magma.core.resources.CPU'>]
run_spk()[source]

Runs the high-level selection process model.

The process is summarised as follows:
  1. Receives the candidate positions and their fitness values from the inports.

  2. Saves these candidates in the internal variables p and fp.

  3. Searches for the best candidate based on the fitness values.

  4. If the new candidate is better than the current global best or if the process is not initialised, updates the global best position and fitness.

  5. Sends the global best position and fitness to the outports.