CommodityMultiSourceSink¶
Class Description¶
- class paminco.net.demand.CommodityMultiSourceSink(data: dict, is_label=True, check_validity=False, dtype_float=<class 'numpy.float64'>)[source]¶
Commodity with multiple sources and/or multiple sinks.
A CommodityMultiSourceSink can be comprised of any number of sources (N_in) and any number of sinks (N_out). The total number of nodes that make up a CommodityMultiSourceSink is thus N_tot = N_in + N_out.
- Parameters
- datadict
Keys are node labels or ids, values are rate (in/outflow).
- is_labelbool, default=True,
Whether keys in
data
are labels.- check_validitybool, default=False
Check whether sum of values in
data
equals 0.- dtype_floattype, default=numpy.float_
Datatype to save rate values.
Methods¶
|
Construct commodity from |
Decompose CommodityMultiSourceSink into several single commodities. |
|
Check whether commodity is made up by node in |
|
|
Get commodity as dict. |
Get copy where every rate is scaled by scale_factor. |
|
Extract commodity data for sparse demand matrix. |
|
Map labels -> ids by d. |
|
Map ids -> labels by d. |
|
Construct from fully specified data (labels and ids). |
Attributes¶
Total number of nodes in commodity: sinks + sources. |
|
Number of sources. |
|
Number of sinks. |
|
ndarray (N_tot, ) of bool: whether node is sink. |
|
bool: whether nodes have proper indices. |
|
bool: whether nodes have proper labels. |
|
bool: whether commodity has single source and single sink. |
|
ndarray (N_tot, ) of int: node indices. |
|
ndarray (N_tot, ) of str: node labels. |
|
ndarray (N_in, ) of str: source labels. |
|
ndarray (N_in, ) of int: source indices. |
|
ndarray (N_out, ) of str: sink labels. |
|
ndarray (N_out, ) of int: sink indices. |
|
ndarray (N_tot, ) of float: in/outflow per node. |
|
float: total flow on commodity. |