Three-sector purchasing power decoupled by feedback
Forrest's categorized purchasing power of money.
- Class:
CategorizedPurchasingPowerSystem - Import:
from skcomplex.systems.economics.macroeconomics import CategorizedPurchasingPowerSystem - Field:
economics/macroeconomics - Topics:
purchasing power,monetary policy,fiscal policy,decoupling,feedback,linear system,ode - References:
- Forrest 2018
Use this system
The block imports the class and simulates the system with its default parameters and its tuned run settings.
from skcomplex.systems.economics.macroeconomics import CategorizedPurchasingPowerSystem
trajectory = CategorizedPurchasingPowerSystem().prepare().simulate()
Parameters
The model parameters take these defaults, and set_params changes them.
| Parameter | Default |
|---|---|
policy |
(0.0, 0.0, 1.0) |
policy_time |
(1.0, 1.0, 1.0) |
feedback |
True |
A |
((-1.0, 0.3, 0.2), (0.2, -0.8, 0.3), (0.1, 0.4, -0.6)) |
B |
((1.0, 0.2, 0.1), (0.1, 1.0, 0.2), (0.2, 0.1, 1.0)) |
C |
((1.0, 0.3, 0.0), (0.0, 1.0, 0.3), (0.2, 0.0, 1.0)) |
D |
((1.0, 0.2, 0.0), (0.0, 1.0, 0.2), (0.1, 0.0, 1.0)) |
solver |
'auto' |
backend |
'auto' |
Tags
The system with its default parameters has these capability tags, which solvers and analyses check.
| Tag | Values |
|---|---|
| Time | continuous |
| Space | none |
| Laws | rate |
| Randomness | deterministic |
| Domains | real |
| Structure | fixed |
Class
The source of the class shows how it builds its components from its model parameters.
class CategorizedPurchasingPowerSystem(BaseSystem):
"""Forrest's categorized purchasing power of money.
Its three sectors can be steered one by one by feedback. The economy is split into the sectors of the basic, the
desired, and the luxurious living conditions, with the gaps `z_i = D_i - S_i` between the demand and the supply of
money of each, which the categorized monetary and fiscal policies `x_i` move through `z' = A z + B x`, and the
indices of the sectors `y = C z + D x`, from the zero state (Forrest 2018, Eqs. 22.6 and 22.7). The policies of one
sector act on all of them. By Theorem 11.3 and Example 11.2 the system can be decoupled by feedback into the systems
`w' = A w + B_i x_i` and `y_i = C_i w + D_i x_i` of the sectors (Eqs. 22.9 to 22.12), whose market reactions keep
each index on its own policy, so money poured into the luxury sector leaves the basic sector alone. The source gives
no numbers, so the matrices are illustrative, with a stable `A` and a stable `A - B D^-1 C`, and the policies are
steps.
The system has the gaps `economy.z1` to `economy.z3` and, with feedback, the decoupled states `economy.w11` to
`economy.w33`. The observables of the system are the indices `economy.y1` to `economy.y3` and the inputs of the
economy `economy.u1` to `economy.u3`.
Args:
policy:
The size of the step policy of every sector.
policy_time:
The time of the step policy of every sector.
feedback:
Whether the feedback component decouples the sectors.
A:
The matrix of the state.
B:
The matrix of the policies in the state.
C:
The matrix of the state in the indices.
D:
The nonsingular matrix of the policies in the indices.
label:
The label of the system, which names it when it is nested in another one.
solver:
The solver of the problem, or `'auto'` for the one the system chooses.
backend:
The backend that evaluates the compiled functions, or `'auto'` for the one the system chooses.
Examples:
>>> from skcomplex.systems.economics.macroeconomics import CategorizedPurchasingPowerSystem
>>> CategorizedPurchasingPowerSystem(feedback=False).prepare().system_.interactions[0].feedback
False
"""
field = 'economics/macroeconomics'
topics = ('purchasing power', 'monetary policy', 'fiscal policy', 'decoupling', 'feedback', 'linear system', 'ode')
references = ('Forrest 2018',)
until = 15.0
dt = 0.05
@staticmethod
def _get_sector_value(
s: SimpleNamespace,
dynamics: PurchasingPowerInteraction,
method: str,
index: int,
) -> Expression:
"""Return the index or the input of one sector of the economy."""
values: list[Expression] = getattr(dynamics, method)(s)
return values[index]
@staticmethod
def _get_observables(system: System) -> list[Observable]:
"""Return the index and the input of every sector."""
dynamics = system.interactions[0]
if not isinstance(dynamics, PurchasingPowerInteraction):
return []
return [
Observable(
f'{name}{i + 1}',
partial(CategorizedPurchasingPowerSystem._get_sector_value, dynamics=dynamics, method=method, index=i),
element='economy',
)
for name, method in (('y', 'get_outputs'), ('u', 'get_inputs'))
for i in range(SECTORS)
]
def __init__(
self,
policy: Sequence[float] = (0.0, 0.0, 1.0),
policy_time: Sequence[float] = (1.0, 1.0, 1.0),
*,
feedback: bool = True,
A: Sequence[Sequence[float]] = A_MATRIX,
B: Sequence[Sequence[float]] = B_MATRIX,
C: Sequence[Sequence[float]] = C_MATRIX,
D: Sequence[Sequence[float]] = D_MATRIX,
label: str = 'system',
solver: BaseSolver | str = 'auto',
backend: BaseBackend | str = 'auto',
) -> None:
super().__init__(label, solver=solver, backend=backend)
self.policy = policy
self.policy_time = policy_time
self.feedback = feedback
self.A = A
self.B = B
self.C = C
self.D = D
def _prepare(self, context: Sequence[Observable] | None = None) -> None:
"""Set the system of the components built from the model parameters."""
super()._prepare(context)
dynamics = PurchasingPowerInteraction(
'dynamics',
target='economy',
A=self.A,
B=self.B,
C=self.C,
D=self.D,
feedback=self.feedback,
)
economy = Element('economy', values=dynamics.get_values(self.policy, self.policy_time))
self.system_ = System(self.label, elements=[economy], interactions=[dynamics])
self.observables_ = tuple(CategorizedPurchasingPowerSystem._get_observables(self.system_))
Components
The system uses these element and interaction classes, each with its nearest class of the core.
Elements:
Interactions:
PurchasingPowerInteraction, fromInteraction
class Element(BaseElement):
"""An element that holds named values of one thing or of a group of members.
It holds its values by name, such as the height and mass of a ball in
`Element('ball', values={'x': 10.0, 'm': 1.0})`, and the laws of the interactions decide which values change. With
`size` it holds a group of members with values of their own, such as 1000 molecules of a gas, and with `space` one
member per site, such as the cells of a grid. A subclass may take its values as arguments of `__init__` instead,
such as a population class with a growth rate. Members whose values change by agent rules, Python functions run for
each member at each step, act as agents, and their values may be any Python object. It holds a prey population, a
firm of an economy, and the charge of a capacitor.
Read more in the user guide, under Elements.
Args:
label:
The name of the element, unique among the components of its system, such as `'rabbits'`.
values:
Values by name, such as `{'x': 10.0, 'm': 1.0}`. A derivative or a past value that a law reads starts from
the value named with primes or a past index, such as `{'x': 10.0, "x'": 3.0}` for a ball thrown upwards or
`{'y': 1.0, 'y[-1]': 0.5}` for an economy. A group of members takes one value per member as an array.
size:
The number of members, each with its own values, such as `1000` molecules of a gas, or `None` for one.
space:
The space of the element, with one member per site, such as a lattice of cells, or `None` for none.
on:
The part of a network space that holds one member each: `'edges'` for every link, `'hyperedges'` for every
hyperedge, the name of a layer for every link of that layer, such as `'immune'`, or `None` for every site.
Attributes:
default_visual_:
How the element is drawn by default, the `visual` of its class.
See Also:
BaseElement: The base of every element.
Interaction: States the laws that change the values of elements.
Examples:
>>> from skcomplex.core.components.elements import Element
>>> ball = Element('ball', values={'x': 10.0, 'm': 1.0})
>>> ball.get_params()['x']
10.0
"""
law_classes: ClassVar[tuple[type, ...]] = ()
def __init__(
self,
label: str,
*,
values: Mapping[str, object] | None = None,
size: int | None = None,
space: BaseSpace | None = None,
on: str | None = None,
) -> None:
super().__init__(label)
self.values = values
self.size = size
self.space = space
self.on: object = on
def get_params(self, deep: bool = True) -> dict[str, Any]:
"""Return the parameters of the element, with each entry of `values` when deep.
An entry of `values` whose name is a Python identifier is listed under its own name, so a system lists it as
`<element>__<name>` and `set_params(ball__x=2.0)`, grid searches, and sweeps reach it. A primed or past value,
such as `"x'"` or `'x[-1]'`, is no identifier and stays inside `values`. An entry that has the name of an
argument is not listed twice.
Args:
deep:
Whether to add the parameters of nested estimators and the entries of `values`.
Returns:
params:
The parameters by name.
Examples:
>>> from skcomplex.core.components.elements import Element
>>> params = Element('ball', values={'x': 10.0, "x'": 3.0}).get_params()
>>> params['x'], "x'" in params
(10.0, False)
"""
params = super().get_params(deep=deep)
if deep and isinstance(self.values, Mapping):
entries = self._get_value_entries()
params.update({name: value for name, value in entries.items() if name not in params})
return params
def set_params(self, **params: object) -> Self:
"""Set parameters of the element and entries of `values` by name.
An entry of `values` takes its new value in a new mapping, so the mapping the user gave never changes, as
`clone` of scikit-learn leaves the arguments of an estimator unchanged. A new `values` is set first, so the
output of `get_params` is accepted as it is.
Args:
**params:
The new values, by the name of a parameter or of an entry of `values`, such as `x=2.0`.
Returns:
self:
The element.
Examples:
>>> from skcomplex.core.components.elements import Element
>>> values = {'x': 10.0}
>>> Element('ball', values=values).set_params(x=2.0).values, values
({'x': 2.0}, {'x': 10.0})
"""
arguments = super().get_params(deep=True)
if 'values' in params:
super().set_params(values=params['values'])
entries = self._get_value_entries()
changed = {name: value for name, value in params.items() if name in entries and name not in arguments}
rest = {name: value for name, value in params.items() if name not in changed and name != 'values'}
super().set_params(**rest)
if changed:
self.values = {**(self.values or {}), **changed}
return self
def _get_value_entries(self) -> dict[str, object]:
"""Return the entries of `values` whose names are Python identifiers."""
values = self.values if isinstance(self.values, Mapping) else {}
return {name: value for name, value in values.items() if name.isidentifier()}
def _prepare(self, context: BaseSpace | None = None) -> None:
"""Set `default_visual_`, checking the reserved names.
Args:
context:
The space the element inherits from its system, which an element with `on` and no space of its own
sits on.
Raises:
ValidationError:
`size` is not a number of members, `space` is not a space, or `values` is not a mapping, as when a
subclass stores a quantity of its own under a reserved name.
"""
super()._prepare(context)
size = self.size
checks = {
'size': size is None or (isinstance(size, numbers.Integral) and not isinstance(size, bool) and size >= 1),
'space': self.space is None or isinstance(self.space, BaseSpace),
'values': self.values is None or isinstance(self.values, Mapping),
}
for name, valid in checks.items():
if not valid:
error_msg = (
f'Element {self.label!r} has {name} = {getattr(self, name)!r}, but {name} is the '
f'{RESERVED_MEANINGS[name]}. The names {", ".join(RESERVED)} are reserved, so rename the value, '
f'such as half_side for the half side of a table.'
)
raise ValidationError(error_msg)
self._check_on(self.space if self.space is not None else context)
def _get_tags(self) -> Tags:
"""Return the tags of the element, with the tags of its space when it has one.
A field on a phase space thus asks for a solver that supports phase spaces, as a group on it does.
"""
tags = super()._get_tags()
if not isinstance(self.space, BaseSpace):
return tags
return replace(tags, space=self.space.get_tags().space)
def _check_on(self, space: BaseSpace | None) -> None:
"""Raise an error for an `on` that names no part of a network space.
A value named `on` that the element declares as its own state or parameter names no place. The space is the
element's own, or else that of its system.
"""
if isinstance(type(self)._get_specs().get('on'), _StateSpec | _ParameterSpec):
return
on = getattr(self, 'on', None)
if on is None or (isinstance(space, NetworkSpace) and (on in LINKS or on in space.prepare().graphs_)):
return
error_msg = (
f'Element {self.label!r} has on = {on!r}, but on is the part of a network space that holds one member '
"each, 'edges', 'hyperedges', or the name of a layer for its edges, such as "
"Element('links', values={'sign': 1}, space=network, on='edges'). The names "
f'{", ".join(RESERVED)} are reserved, so rename a value of the element named on, such as closed for a '
'switch.'
)
raise ValidationError(error_msg)
@staticmethod
def _get_domain_of(annotation: object, value: object) -> object:
"""Return the domain of a value from its annotation or its Python type.
A value without an annotation, such as one given through `values`, takes the domain of its type, so `3` is an
integer and `0.5 + 1j` is complex. The annotation `object` says nothing of the kind, so a value annotated so,
such as a point that may be one number or an array of complex numbers, also takes the domain of its type, and
so does a value of one of several types, such as `float | Sequence[float]`. A subshift, such as
`Annotated[int, SubshiftSpec(LatticeNeighborhood(((0,), (1,))), ((1, 1),))]`, is the domain of the cells of a
lattice whose configurations hold no forbidden word.
"""
if get_origin(annotation) is Annotated:
for item in get_args(annotation)[1:]:
if isinstance(item, set | frozenset):
return FiniteEnumeratedSet(sorted(item, key=str))
allowed = hasattr(item, '__contains__') and not isinstance(item, str | MatrixGroupSpec)
if allowed or isinstance(item, SubshiftSpec | PowerSeriesSpec):
return item
annotation = get_args(annotation)[0]
annotated = isinstance(annotation, type) and annotation not in {inspect.Parameter.empty, object}
kind = annotation if annotated else type(value)
if kind is bool:
return BOOLEAN
if kind is int:
return ZZ
if kind is complex or (isinstance(kind, type) and issubclass(kind, np.complexfloating)):
return CC
return RR
def _get_domain_tags(self) -> frozenset[str]:
"""Return the domain tags of the states of the element.
An element that declares no states has the domains of all its numeric values, since the laws of the system
decide which of them are states, such as `boolean` for `opinion: Annotated[int, {0, 1}] = 0`.
"""
if self._get_component_specs():
return super()._get_domain_tags()
params = self.get_params(deep=False)
values = {name: params.get(name) for name in self._get_hints()}
values |= {name: value for name, value in (self.values or {}).items() if name.isidentifier()}
hints = self._get_hints()
domains = {
_StateSpec(domain=self._get_domain_of(hints.get(name, inspect.Parameter.empty), value))._get_domain_tag()
for name, value in values.items()
if isinstance(value, numbers.Number | list | np.ndarray)
}
return frozenset(domain for domain in domains if domain is not None)
def _get_hints(self) -> dict[str, object]:
"""Return the type hint of every value argument by name, in their order.
The hints are the annotations of the arguments of the class, such as `Annotated[float, Quantity('energy')]`,
from which the kind, the allowed values, the quantity, and the period of each value are read. A generic
subclass that takes its values through `values` gives their hints here instead, and the arguments it leaves
out, such as the allowed values themselves, are no values.
"""
parameters = inspect.signature(type(self)).parameters
return {name: parameter.annotation for name, parameter in parameters.items() if name not in RESERVED}
@classmethod
def _get_view(cls) -> type | None:
"""Return the class of the views of the element's agents.
The result is `None` for the engine's plain view. An agent element names a subclass of the engine's `AgentView`
that annotates its states and parameters, such as `class WordView(AgentView): count: float`, so its rules read
them with checked types.
"""
return None
class PurchasingPowerInteraction(Interaction):
"""Dynamics of a national economy of three spending sectors, with sector policies.
It follows `z' = A z + B u` and `y = C z + D u`. The state `z_i` of the economy is the gap between the demand and
the supply of money of sector `i`, the basic, the desired, and the luxurious living conditions, the output `y_i` is
the index of the sector, and the policy `x_i` of a sector is a step of size `policy_i` at the time `policy_time_i`,
values of the economy. Without feedback the economy takes the policies as its inputs, `u = x`. With feedback, the
market reactions of Forrest's feedback component set `u` so that every sector responds to its own policy only, as
the decoupled systems `w_i' = A w_i + B_i x_i` and `y_i = C_i w_i + D_i x_i`, whose states `w_ik` the economy holds.
The feedback component holds a copy of `z` that equals `z` from the common zero start, so `u = D^-1 (y - C z)` with
the decoupled outputs `y`.
Args:
label:
The label of the interaction.
target:
The path of the economy.
A:
The matrix of the state.
B:
The matrix of the inputs in the state.
C:
The matrix of the state in the outputs.
D:
The nonsingular matrix of the inputs in the outputs.
feedback:
Whether the feedback component decouples the sectors.
Examples:
>>> from skcomplex.systems.economics.macroeconomics import PurchasingPowerInteraction
>>> PurchasingPowerInteraction('dynamics', target='economy', feedback=True).feedback
True
"""
law_classes = (RateLaw,)
def __init__(
self,
label: str,
*,
target: Role,
A: Sequence[Sequence[float]] = A_MATRIX,
B: Sequence[Sequence[float]] = B_MATRIX,
C: Sequence[Sequence[float]] = C_MATRIX,
D: Sequence[Sequence[float]] = D_MATRIX,
feedback: bool = False,
) -> None:
super().__init__(label)
self.target = target
self.A = A
self.B = B
self.C = C
self.D = D
self.feedback = feedback
def get_values(self, policy: Sequence[float], policy_time: Sequence[float]) -> dict[str, float]:
"""Return the values of the economy: the states `z_i`, with feedback `w_ik`, at zero, then the policies.
Args:
policy:
The size of the step policy of every sector.
policy_time:
The time of the step policy of every sector.
Returns:
values:
The value of every state and parameter of the economy by name.
"""
states = [f'z{i}' for i in range(1, SECTORS + 1)]
if self.feedback:
states += [f'w{i}{k}' for i in range(1, SECTORS + 1) for k in range(1, SECTORS + 1)]
values = dict.fromkeys(states, 0.0)
for i in range(SECTORS):
values[f'policy{i + 1}'] = float(policy[i])
values[f'policy_time{i + 1}'] = float(policy_time[i])
return values
@staticmethod
def _get_policies(s: SimpleNamespace) -> list[Expression]:
"""Return the policies of the sectors, steps of their sizes at their times."""
return [step(s.t, getattr(s, f'policy_time{i}'), getattr(s, f'policy{i}')) for i in range(1, SECTORS + 1)]
def get_outputs(self, s: SimpleNamespace) -> list[Expression]:
"""Return the indices `y` of the sectors.
Args:
s:
The namespace of the economy, with the time `t`.
Returns:
outputs:
One index per sector.
"""
x, C, D = self._get_policies(s), np.asarray(self.C), np.asarray(self.D)
if not self.feedback:
z = [getattr(s, f'z{i}') for i in range(1, SECTORS + 1)]
return [sum(C[i, k] * z[k] + D[i, k] * x[k] for k in range(SECTORS)) for i in range(SECTORS)]
return [
sum(C[i, k] * getattr(s, f'w{i + 1}{k + 1}') for k in range(SECTORS)) + D[i, i] * x[i]
for i in range(SECTORS)
]
def get_inputs(self, s: SimpleNamespace) -> list[Expression]:
"""Return the inputs `u` of the economy.
They are the policies, or `D^-1 (y - C z)` with feedback.
Args:
s:
The namespace of the economy, with the time `t`.
Returns:
inputs:
One input per sector.
"""
if not self.feedback:
return self._get_policies(s)
C, inverse = np.asarray(self.C), np.linalg.inv(np.asarray(self.D, dtype=float))
z, y = [getattr(s, f'z{i}') for i in range(1, SECTORS + 1)], self.get_outputs(s)
gaps = [y[i] - sum(C[i, k] * z[k] for k in range(SECTORS)) for i in range(SECTORS)]
return [sum(inverse[i, k] * gaps[k] for k in range(SECTORS)) for i in range(SECTORS)]
def _prepare(self, context: SimpleNamespace) -> None:
"""Set the rates of the economy and, with feedback, of the decoupled systems as the laws.
Args:
context:
The namespace of the elements a binding of the roles names.
"""
super()._prepare(context)
s = SimpleNamespace(t=context.t, **vars(context.target))
A, B = np.asarray(self.A), np.asarray(self.B)
z, u = [getattr(s, f'z{i}') for i in range(1, SECTORS + 1)], self.get_inputs(s)
laws: list[BaseLaw] = [
RateLaw(z[i], sum(A[i, k] * z[k] + B[i, k] * u[k] for k in range(SECTORS))) for i in range(SECTORS)
]
if self.feedback:
x = self._get_policies(s)
for i in range(SECTORS):
w = [getattr(s, f'w{i + 1}{k + 1}') for k in range(SECTORS)]
laws += [
RateLaw(w[j], sum(A[j, k] * w[k] for k in range(SECTORS)) + B[j, i] * x[i]) for j in range(SECTORS)
]
self.laws_ = laws
Equations
The equations are those that symbolic returns for the system with its default parameters.
economy.z1: diff(z1_economy(t), t) == 0.9900398406374502*w11_economy(t) + 0.29701195219123505*w12_economy(t) + 0.0019920318725099606*w22_economy(t) + 0.0005976095617529881*w23_economy(t) + 0.019920318725099605*w31_economy(t) + 0.09960159362549802*w33_economy(t) + 0.0019920318725099606*where(t >= policy_time2_economy, policy2_economy, 0) + 0.9900398406374502*where(t >= policy_time1_economy, policy1_economy, 0) + 0.09960159362549802*where(t >= policy_time3_economy, policy3_economy, 0) - 2.00996015936255*z1_economy(t) + 0.000996015936254952*z2_economy(t) + 0.099800796812749*z3_economy(t)
economy.z2: diff(z2_economy(t), t) == 0.099601593625498*w11_economy(t) + 0.029880478087649404*w12_economy(t) + 0.9800796812749004*w22_economy(t) + 0.2940239043824701*w23_economy(t) + 0.0007968127490039847*w31_economy(t) + 0.003984063745019917*w33_economy(t) + 0.9800796812749004*where(t >= policy_time2_economy, policy2_economy, 0) + 0.099601593625498*where(t >= policy_time1_economy, policy1_economy, 0) + 0.003984063745019917*where(t >= policy_time3_economy, policy3_economy, 0) + 0.099601593625498*z1_economy(t) - 1.8099601593625498*z2_economy(t) + 0.0019920318725099306*z3_economy(t)
economy.z3: diff(z3_economy(t), t) == 0.10159362549800798*w11_economy(t) + 0.030478087649402394*w12_economy(t) + 0.07968127490039842*w22_economy(t) + 0.02390438247011952*w23_economy(t) + 0.19681274900398407*w31_economy(t) + 0.9840637450199203*w33_economy(t) + 0.07968127490039842*where(t >= policy_time2_economy, policy2_economy, 0) + 0.10159362549800798*where(t >= policy_time1_economy, policy1_economy, 0) + 0.9840637450199203*where(t >= policy_time3_economy, policy3_economy, 0) - 0.19840637450199206*z1_economy(t) + 0.2898406374501992*z2_economy(t) - 1.60796812749004*z3_economy(t)
economy.w11: diff(w11_economy(t), t) == -1.0*w11_economy(t) + 0.3*w12_economy(t) + 0.2*w13_economy(t) + 1.0*where(t >= policy_time1_economy, policy1_economy, 0)
economy.w12: diff(w12_economy(t), t) == 0.2*w11_economy(t) - 0.8*w12_economy(t) + 0.3*w13_economy(t) + 0.1*where(t >= policy_time1_economy, policy1_economy, 0)
economy.w13: diff(w13_economy(t), t) == 0.1*w11_economy(t) + 0.4*w12_economy(t) - 0.6*w13_economy(t) + 0.2*where(t >= policy_time1_economy, policy1_economy, 0)
economy.w21: diff(w21_economy(t), t) == -1.0*w21_economy(t) + 0.3*w22_economy(t) + 0.2*w23_economy(t) + 0.2*where(t >= policy_time2_economy, policy2_economy, 0)
economy.w22: diff(w22_economy(t), t) == 0.2*w21_economy(t) - 0.8*w22_economy(t) + 0.3*w23_economy(t) + 1.0*where(t >= policy_time2_economy, policy2_economy, 0)
economy.w23: diff(w23_economy(t), t) == 0.1*w21_economy(t) + 0.4*w22_economy(t) - 0.6*w23_economy(t) + 0.1*where(t >= policy_time2_economy, policy2_economy, 0)
economy.w31: diff(w31_economy(t), t) == -1.0*w31_economy(t) + 0.3*w32_economy(t) + 0.2*w33_economy(t) + 0.1*where(t >= policy_time3_economy, policy3_economy, 0)
economy.w32: diff(w32_economy(t), t) == 0.2*w31_economy(t) - 0.8*w32_economy(t) + 0.3*w33_economy(t) + 0.2*where(t >= policy_time3_economy, policy3_economy, 0)
economy.w33: diff(w33_economy(t), t) == 0.1*w31_economy(t) + 0.4*w32_economy(t) - 0.6*w33_economy(t) + 1.0*where(t >= policy_time3_economy, policy3_economy, 0)