PyNeighbourhoodManagerModel

Full Name

neuroptimiser.core.models.PyNeighbourhoodManagerModel

Description

class PyNeighbourhoodManagerModel[source]

Bases: PyLoihiProcessModel

Neighbourhood manager model for Loihi-based perturbation-based nheuristics

This model manages the neighbourhood of agents/units in a neuroptimiser architecture, allowing them to access the positions and fitness values of their neighbours.

See also

neuroptimiser.core.processes.NeighbourhoodManager

Process that manages the neighbourhood of agents/units in a neuroptimiser architecture.

__init__(proc_params)[source]

Initialises the neighbourhood manager model with the given parameters.

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

  • num_dimensions: int, number of dimensions in the problem space

  • num_neighbours: int, number of neighbouring agents

fp_in: PyInPort = LavaPyType(cls=<class 'lava.magma.core.model.py.ports.PyInPortVectorDense'>, d_type=<class 'numpy.float32'>, precision=None)
fp_out: PyOutPort = LavaPyType(cls=<class 'lava.magma.core.model.py.ports.PyOutPortVectorDense'>, d_type=<class 'numpy.float32'>, precision=None)
implements_process

alias of NeighbourhoodManager

implements_protocol

alias of LoihiProtocol

neighbour_indices: ndarray = LavaPyType(cls=<class 'numpy.ndarray'>, d_type=<class 'int'>, precision=None)
p_in: PyInPort = LavaPyType(cls=<class 'lava.magma.core.model.py.ports.PyInPortVectorDense'>, d_type=<class 'numpy.float32'>, precision=None)
p_out: PyOutPort = LavaPyType(cls=<class 'lava.magma.core.model.py.ports.PyOutPortVectorDense'>, 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 neighbourhood manager process model.

The process is summarised as follows:
  1. If the process is not initialised, it creates tensors to store the neighbourhood positions and fitness values.

  2. Receives the input position and fitness matrices from the inports.

  3. For each agent/unit, retrieves the positions and fitness values of its neighbours based on the pre-defined indices.

  4. Sends the neighbourhood position and fitness tensors to the outports.

weight_matrix: ndarray = LavaPyType(cls=<class 'numpy.ndarray'>, d_type=<class 'float'>, precision=None)