lava.lib.optimization.solvers.generic.cost_integrator

lava.lib.optimization.solvers.generic.cost_integrator.models

digraph inheritance5384cb5d13 { bgcolor=transparent; rankdir=TB; size=""; "ABC" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Helper class that provides a standard way to create an ABC using"]; "AbstractProcessModel" [URL="../../lava/lava.magma.core.model.html#lava.magma.core.model.model.AbstractProcessModel",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Represents a model that implements the behavior of a Process."]; "ABC" -> "AbstractProcessModel" [arrowsize=0.5,style="setlinewidth(0.5)"]; "AbstractPyProcessModel" [URL="../../lava/lava.magma.core.model.py.html#lava.magma.core.model.py.model.AbstractPyProcessModel",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Abstract interface for Python ProcessModels."]; "AbstractProcessModel" -> "AbstractPyProcessModel" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ABC" -> "AbstractPyProcessModel" [arrowsize=0.5,style="setlinewidth(0.5)"]; "CostIntegratorModel" [URL="../lava-lib-optimization/lava.lib.optimization.solvers.generic.cost_integrator.html#lava.lib.optimization.solvers.generic.cost_integrator.models.CostIntegratorModel",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="CPU model for the CostIntegrator process."]; "PyLoihiProcessModel" -> "CostIntegratorModel" [arrowsize=0.5,style="setlinewidth(0.5)"]; "PyLoihiProcessModel" [URL="../../lava/lava.magma.core.model.py.html#lava.magma.core.model.py.model.PyLoihiProcessModel",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="ProcessModel to simulate a Process on Loihi using CPU."]; "AbstractPyProcessModel" -> "PyLoihiProcessModel" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class lava.lib.optimization.solvers.generic.cost_integrator.models.CostIntegratorModel(proc_params=None)

Bases: PyLoihiProcessModel

CPU model for the CostIntegrator process.

The process adds up local cost components from downstream units comming as spike payload. It has a min_cost variable which keeps track of the best cost seen so far, if the new cost is better, the minimum cost is updated and send as an output spike to an upstream process.

cost: ndarray = LavaPyType(cls=<class 'numpy.ndarray'>, d_type=<class 'int'>, precision=32)
cost_in: PyInPort = LavaPyType(cls=<class 'lava.magma.core.model.py.ports.PyInPortVectorDense'>, d_type=<class 'int'>, precision=None)
implements_process

alias of CostIntegrator

implements_protocol

alias of LoihiProtocol

min_cost: ndarray = LavaPyType(cls=<class 'numpy.ndarray'>, d_type=<class 'int'>, precision=32)
required_resources: ty.List[ty.Type[AbstractResource]] = [<class 'lava.magma.core.resources.CPU'>]
run_spk()

Execute spiking phase, integrate input, update dynamics and send messages out.

update_buffer: PyOutPort = LavaPyType(cls=<class 'lava.magma.core.model.py.ports.PyOutPortVectorDense'>, d_type=<class 'int'>, precision=None)

lava.lib.optimization.solvers.generic.cost_integrator.process

digraph inheritance741b5b575e { bgcolor=transparent; rankdir=TB; size=""; "AbstractProcess" [URL="../../lava/lava.magma.core.process.html#lava.magma.core.process.process.AbstractProcess",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="The notion of a Process is inspired by the Communicating Sequential"]; "CostIntegrator" [URL="../lava-lib-optimization/lava.lib.optimization.solvers.generic.cost_integrator.html#lava.lib.optimization.solvers.generic.cost_integrator.process.CostIntegrator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Node that integrates cost components and produces output when a better"]; "AbstractProcess" -> "CostIntegrator" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class lava.lib.optimization.solvers.generic.cost_integrator.process.CostIntegrator(*, shape=(1,), min_cost=16777216, name=None, log_config=None)

Bases: AbstractProcess

Node that integrates cost components and produces output when a better cost is found.

Parameters:
  • shape (tuple(int)) – The expected number and topology of the input cost components.

  • name (str, optional) – Name of the Process. Default is ‘Process_ID’, where ID is an integer value that is determined automatically. log_config: Configuration options for logging.

  • InPorts

  • -------

  • cost_in – input to be additively integrated.

  • OutPorts

  • --------

  • update_buffer – OutPort which notifies the next process about the detection of a better cost.

  • Vars

  • ----

  • cost – Holds current cost as addition of input spikes’ payloads

  • min_cost (int) – Current minimum cost, i.e., the lowest reported cost so far.