booldog.io.interaction_logic

Convert interactions into Boolean functions

Attributes

logger

Classes

LogicBuilder

Abstract base class for Boolean logic builders.

SquadLogic

SQUAD logic:

Functions

interactions2rules(→ Dict[str, Callable])

Convert interactions directly to prime implicants.

_normalise_and_collect_regulators(interactions, ...)

Normalize signs and orient interactions as target → regulators.

Module Contents

booldog.io.interaction_logic.logger
booldog.io.interaction_logic.interactions2rules(interactions: tuple[int | str, int | str, int | str], *, logic: LogicBuilder = None, activator_symbol: int | str = 1, inhibitor_symbol: int | str = -1) Dict[str, Callable]

Convert interactions directly to prime implicants.

Parameters:
  • interactions (list) – A list of interactions in the network. Each interaction should be a tuple of (source, target, sign), where source and target are node identifiers and sign is either activator_symbol or inhibitor_symbol.

  • activator_symbol (int, optional) – The value representing activation in the network. Default is 1.

  • inhibitor_symbol (int, optional) – The value representing inhibition in the network. Default is -1.

  • logic (LogicBuilder, optional) –

    An optional logic builder to use for constructing the update functions. If not provided, the default is SquadLogic, which implements the SQUAD logic: A node is active iff:

    (any activator is active) AND (no inhibitor is active)

Returns:

A dictionary mapping node identifiers to their corresponding prime implicants.

Return type:

dict

booldog.io.interaction_logic._normalise_and_collect_regulators(interactions, activator_symbol, inhibitor_symbol)

Normalize signs and orient interactions as target → regulators.

class booldog.io.interaction_logic.LogicBuilder

Abstract base class for Boolean logic builders.

abstract build(node: str, regulators: Mapping[str, int]) str

Return an update rule for node.

class booldog.io.interaction_logic.SquadLogic

Bases: LogicBuilder

SQUAD logic:

A node is active iff:

(any activator is active) AND (no inhibitor is active)

build(node: str, regulators: Mapping[str, int]) str

Return an update rule for node.