economy
planning.economy
Dataclasses to save the economy and the planned economy returned by the optimizer. The Economy class is implemented using Pydantic to perform certain checks in the data, which will normally come from a database, making it prone to mistakes when loading the data.
Economy
Bases: BaseModel
Dataclass with validations that stores the whole economy's information.
periods
property
Number of products in the economy.
products
property
Number of products in the economy.
sectors
property
Number of products in the economy.
__post_init__()
Run after initial validation. Validates that the shapes of the matrices are compatible with each other (same number of products and sectors).
Source code in planning/economy.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
|
equal_shapes(matrices, info)
Assert that all the inputed matrices have the same shape.
Source code in planning/economy.py
54 55 56 57 58 59 60 61 |
|
validate_matrix_shape(*matrices, shape)
staticmethod
Assert that all the inputed matrices have the same shape.
Source code in planning/economy.py
93 94 95 96 97 98 |
|
PlannedEconomy(activity=list(), production=list(), surplus=list(), total_import=list(), export_deficit=list(), worked_hours=list())
dataclass
Dataclass that stores the whole planned economy.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
activity
|
list[NDArray]
|
list with the planned activity for all sectors in each period. |
list()
|
production
|
list[NDArray]
|
list with the planned production for all product in each period. |
list()
|
surplus
|
list[NDArray]
|
The surplus production at the end of each period. |
list()
|
total_import
|
list[NDArray]
|
list of total imports in each period. |
list()
|
export_deficit
|
list[float]
|
list export deficit at the end of each period. |
list()
|
worked_hours
|
list[float]
|
list of total worked hours in each period. |
list()
|
TargetEconomy
Bases: BaseModel
Dataclass with validations that stores the whole economy's information.
periods
property
Number of products in the economy.
products
property
Number of products in the economy.
equal_shapes(matrices, info)
Assert that all the inputed matrices have the same size.
Source code in planning/economy.py
133 134 135 136 137 138 139 140 |
|