Policy
Policy rules shared by the economics packages.
A policy rule acts on the system once per step, such as a central bank or a regulator.
PolicyRuleInteraction(label, *, rule=None, phase=None)
Bases: Interaction
Single actor that reads the system and sets parameters from what it reads.
It reads the system once per round of its phase. Its rule runs once per round of its phase, after the agents of the
phase. It reads observables with system.get_observable(name), reporters with system.get_history(name), and
agents with system.get_agents(name), and sets parameters of any group or interaction with
system.set_parameter(name, value). A change is visible to every rule at once and recorded in the trajectory like
any parameter. Subclasses declare their own parameters, such as a target, and override act. Otherwise
rule(system) acts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the feedback. |
required |
rule
|
Callable[[SystemT], None] | None
|
The function of the system view that acts, used when a subclass does not override |
None
|
phase
|
str | None
|
The phase the feedback acts in, or |
None
|
Examples:
>>> from skcomplex.systems.economics.common.policy import PolicyRuleInteraction
>>> PolicyRuleInteraction('controller', rule=lambda system: None).phase is None
True
Source code in src/skcomplex/systems/economics/common/policy/_policy_rule.py
47 48 49 50 51 52 53 54 55 56 | |
act(system)
Read the system and set parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
system
|
SystemT
|
The system view scoped to the feedback. |
required |
Raises:
| Type | Description |
|---|---|
ValidationError
|
The feedback has neither a rule nor its own |
Source code in src/skcomplex/systems/economics/common/policy/_policy_rule.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |