lava.lib.optimization.solvers.generic.read_gate

lava.lib.optimization.solvers.generic.read_gate.models

digraph inheritance92fd1b206e { 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)"]; "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)"]; "ReadGatePyModelD" [URL="../lava-lib-optimization/lava.lib.optimization.solvers.generic.read_gate.html#lava.lib.optimization.solvers.generic.read_gate.models.ReadGatePyModelD",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 ReadGate process."]; "PyLoihiProcessModel" -> "ReadGatePyModelD" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class lava.lib.optimization.solvers.generic.read_gate.models.ReadGatePyModelD(proc_params=None)

Bases: PyLoihiProcessModel

CPU model for the ReadGate process.

The model verifies if better payload (cost) has been notified by the downstream processes, if so, it reads those processes state and sends out to the upstream process the new payload (cost) and the network state.

best_solution: int = LavaPyType(cls=<class 'int'>, d_type=<class 'numpy.int32'>, precision=32)
cost_in_first_byte: PyInPort = LavaPyType(cls=<class 'lava.magma.core.model.py.ports.PyInPortVectorDense'>, d_type=<class 'numpy.int32'>, precision=8)
cost_in_last_bytes: PyInPort = LavaPyType(cls=<class 'lava.magma.core.model.py.ports.PyInPortVectorDense'>, d_type=<class 'numpy.int32'>, precision=24)
cost_out: PyOutPort = LavaPyType(cls=<class 'lava.magma.core.model.py.ports.PyOutPortVectorDense'>, d_type=<class 'numpy.int32'>, precision=32)
implements_process

alias of ReadGate

implements_protocol

alias of LoihiProtocol

min_cost: int = None
post_guard()

Decide whether to run post management phase.

required_resources: ty.List[ty.Type[AbstractResource]] = [<class 'lava.magma.core.resources.CPU'>]
run_post_mgmt()

Execute post management phase.

run_spk()

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

send_pause_request: PyOutPort = LavaPyType(cls=<class 'lava.magma.core.model.py.ports.PyOutPortVectorDense'>, d_type=<class 'numpy.int32'>, precision=32)
solution: ndarray = None
solution_out: PyOutPort = LavaPyType(cls=<class 'lava.magma.core.model.py.ports.PyOutPortVectorDense'>, d_type=<class 'numpy.int32'>, precision=32)
solution_reader = LavaPyType(cls=<class 'lava.magma.core.model.py.ports.PyRefPortVectorDense'>, d_type=<class 'numpy.int32'>, precision=32)
target_cost: int = LavaPyType(cls=<class 'int'>, d_type=<class 'numpy.int32'>, precision=32)
lava.lib.optimization.solvers.generic.read_gate.models.get_read_gate_model_class(num_in_ports)

Produce CPU model for the ReadGate process.

The model verifies if better payload (cost) has been notified by the downstream processes, if so, it reads those processes state and sends out to the upstream process the new payload (cost) and the network state.

lava.lib.optimization.solvers.generic.read_gate.models.get_readgate_members(num_in_ports)
lava.lib.optimization.solvers.generic.read_gate.models.readgate_post_guard(self)

Decide whether to run post management phase.

lava.lib.optimization.solvers.generic.read_gate.models.readgate_run_post_mgmt(self)

Execute post management phase.

lava.lib.optimization.solvers.generic.read_gate.models.readgate_run_spk(self)

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

lava.lib.optimization.solvers.generic.read_gate.process

digraph inheritance87a0455306 { 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"]; "ReadGate" [URL="../lava-lib-optimization/lava.lib.optimization.solvers.generic.read_gate.html#lava.lib.optimization.solvers.generic.read_gate.process.ReadGate",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="Process that triggers solution readout when problem is solved."]; "AbstractProcess" -> "ReadGate" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class lava.lib.optimization.solvers.generic.read_gate.process.ReadGate(shape, target_cost=None, num_in_ports=1, name=None, log_config=None)

Bases: AbstractProcess

Process that triggers solution readout when problem is solved.

Parameters:
  • shape (The shape of the set of units in the downstream process whose state) – will be read by ReadGate.

  • target_cost (cost value at which, once attained by the network,) – this process will stop execution.

  • name (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_last_bytes (OutPort) – Receives a better cost found by the CostIntegrator at the previous timestep. Messages the last 3 byte of the new best cost. Total cost = cost_in_first_byte << 24 + cost_in_last_bytes.

  • cost_in_first_byte (OutPort) – Receives a better cost found by the CostIntegrator at the previous timestep. Messages the first byte of the new best cost.

  • OutPorts

  • --------

  • cost_out (Forwards to an upstream process the better cost notified by the) – CostIntegrator.

  • solution_out (Forwards to an upstream process the better variable assignment) – found by the solver network.

  • send_pause_request (Notifies upstream process to request execution to pause.) –