CommoditySingleSourceSink (Abstract)¶
Class Description¶
- class paminco.net.demand.CommoditySingleSourceSink(source, sink, rate: float, is_label: bool = True)[source]¶
Commodity with exactly one source and one sink.
- Parameters
- sourcestr or int
Label or index of source.
- sinkstr or int
Label or index of sink.
- ratefloat
Rate of flow from source to sink.
- is_labelbool, default=True
If True, source and sink are expected to be str, else as int.
- Attributes
has_valid_indices
Whether node labels have been mapped to node indices.
has_valid_labels
Whether node indices have been mapped to node labels.
source_lbl
str: label of source node.
source_id
int: index of source node.
sink_lbl
str: label of sink node.
sink_id
int: index of sink node.
rate
float: rate of flow from source to sink.
total_rate
float: rate of flow from source to sink.
Methods¶
|
Construct from tuple (source, sink, rate). |
Construct from fully specified data (labels and ids). |
|
Get a copy of commodity with rate scaled by |
|
Extract commodity data for sparse demand matrix. |
|
Map labels -> ids by d. |
|
Map ids -> labels by d. |
|
Check whether commodity is made up by node in |
|
|
Get Commodity data as tuple. |
Methods¶
Whether node labels have been mapped to node indices. |
|
Whether node indices have been mapped to node labels. |
|
str: label of source node. |
|
int: index of source node. |
|
str: label of sink node. |
|
int: index of sink node. |
|
float: rate of flow from source to sink. |
|
float: rate of flow from source to sink. |