Skip to content

Systems

A system is a component that holds elements, interactions, nested systems, a space, and a time. BaseSystem is the base of every system. A subclass takes the parameters of its model in __init__, builds its components from them in _build_system, and derives its capability tags from its components, which get_tags() returns. A general system that several fields share, such as ReactionNetworkSystem of skcomplex.systems.general.reactions, is a recipe built from core components. The ready-made systems of skcomplex.systems subclass these, one class per model. The catalog lists them by field and by topic, with their import paths, model parameters, and capability tags, and all_systems of skcomplex.systems finds them by field, topic, or tag. The table lists the system classes of the core.

System Import Description
System from skcomplex.core.systems import System A system of elements, interactions, nested systems, and a space.

Comparison

Class Summary Uses See also
BaseSystem An abstract system, which is prepared once and simulated many times. It is the base of the ready-made systems of predators and prey, of reactions in a cell, and of prices in a market. System
System A system of elements, interactions, nested systems, and a space. It models an ecosystem of populations, a network of reactions, a circuit, or a market, and a system nests in another one as a component. BaseSystem

Fact sheets

BaseSystem

An abstract system, which is prepared once and simulated many times.

System

A system of elements, interactions, nested systems, and a space.

General systems

General systems are recipes of skcomplex.systems.general that systems of several fields share. The table lists each with the catalog systems that subclass it.

General system Import Catalog systems
DynamicalSystem from skcomplex.systems.general.dynamics import DynamicalSystem AdaptrodeSystem, CDNMapSystem, CapitalStockSystem, CircleMapSystem, CropLivestockHouseholdSystem, DaisyworldSystem, DroopCellQuotaSystem, DrugResistanceSwitchingSystem, DuffingSystem, FaradayDiskSystem, FibonacciRabbitsSystem, HER2TargetedTherapySystem, KirmanExchangeRateSystem, MemristorOscillatorSystem, MultiplierAcceleratorSystem, OptimalConsumptionSystem, OptimalHarvestingSystem, PenaeidShrimpSystem, PendulumSwingUpSystem, PidLoopSystem, PopulationPollutionSystem, RegenerativeBrakingSystem, RiccatiPricesSystem, SIRVaccinationSystem, SatelliteTransferSystem, SoilTemperatureSystem, SteerableFeedbackLoopSystem, TentMapSystem, ThermostatSystem, TunnelDiodeOscillatorSystem, VascularCorePeripherySystem, VibratingTableSystem
NetworkDynamicalSystem from skcomplex.systems.general.dynamics import NetworkDynamicalSystem MetapopulationSystem, NetworkDiffusionSystem, QuenchedMeanFieldSISSystem
ReactionDiffusionSystem from skcomplex.systems.general.dynamics import ReactionDiffusionSystem BarkleySystem, FisherKPPSystem, FitzhughNagumoSystem, GrayScottSystem, MinProteinSkeletonSystem, SchnakenbergSystem
StockFlowSystem from skcomplex.systems.general.dynamics import StockFlowSystem BassDiffusionSystem, BathtubSystem, GrainStorageSystem, OilEconomySystem
ReactionNetworkSystem from skcomplex.systems.general.reactions import ReactionNetworkSystem ChemicalLangevinNetworkSystem, MichaelisMentenSystem, SIRSSystem, SIRSystem, SISSystem, ZombieOutbreakSystem

A compatible system

A system of random arrivals has jump laws, which GillespieSolver draws one event at a time.

from skcomplex.core.components.elements import Element
from skcomplex.core.engine.solvers import GillespieSolver
from skcomplex.core.systems import System
from skcomplex.systems.general.reactions import ReactionInteraction

queue = Element('queue', values={'x': 0.0})
arrive = ReactionInteraction('arrive', target='queue', products={'x': 1}, k=2.0, mode='jump')
system = System(elements=[queue], interactions=[arrive], solver=GillespieSolver()).prepare()
system.form_
system.simulate(until=5, random_state=0).get_values('queue.x')[-1]
jump process
11.0

The system is a jump process, and with the seed 0 the queue holds 11 after five time units.

An incompatible system

A system of a decay has rate equations, which GillespieSolver does not draw, so prepare raises a TagError that names the law kind.

from skcomplex.core.components.elements import Element
from skcomplex.core.engine.solvers import GillespieSolver
from skcomplex.core.errors import TagError
from skcomplex.core.systems import System
from skcomplex.systems.general.reactions import ReactionInteraction

tank = Element('tank', values={'x': 10.0})
decay = ReactionInteraction('decay', target='tank', reactants={'x': 1}, k=0.5)
try:
    System(elements=[tank], interactions=[decay], solver=GillespieSolver()).prepare()
except TagError as error:
    message = str(error)
message
assert 'laws rate' in message
The solver GillespieSolver does not support the laws rate of the system. Pass a solver that supports them, or none for the default.

The message says that GillespieSolver does not support the law kind rate. Leave the solver out and the tags choose one that integrates rates.

Find ready-made systems by tag

all_systems takes the values of capability tags, so it finds the ready-made systems that a solver or an analysis accepts.

from skcomplex.systems import all_systems

stochastic = all_systems(field='biology/epidemiology', tags={'randomness': 'stochastic'})
[name for name, _ in stochastic][:3]
['AdaptiveSISSystem', 'AgentBasedSIRSystem', 'DifferentiableCovidAbmSystem']

The list holds the first three stochastic systems of epidemiology, in alphabetical order.