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

CommoditySingleSourceSink.from_tuple(t, **kwargs)

Construct from tuple (source, sink, rate).

CommoditySingleSourceSink.from_labels_and_id(data)

Construct from fully specified data (labels and ids).

CommoditySingleSourceSink.get_scaled_copy([...])

Get a copy of commodity with rate scaled by scale_factor.

CommoditySingleSourceSink.get_sparse_elements([...])

Extract commodity data for sparse demand matrix.

CommoditySingleSourceSink.map_node_labels(d)

Map labels -> ids by d.

CommoditySingleSourceSink.map_node_ids(d)

Map ids -> labels by d.

CommoditySingleSourceSink.node_in_comm(node)

Check whether commodity is made up by node in node.

CommoditySingleSourceSink.to_tuple([as_label])

Get Commodity data as tuple.

Methods

CommoditySingleSourceSink.has_valid_indices

Whether node labels have been mapped to node indices.

CommoditySingleSourceSink.has_valid_labels

Whether node indices have been mapped to node labels.

CommoditySingleSourceSink.source_lbl

str: label of source node.

CommoditySingleSourceSink.source_id

int: index of source node.

CommoditySingleSourceSink.sink_lbl

str: label of sink node.

CommoditySingleSourceSink.sink_id

int: index of sink node.

CommoditySingleSourceSink.rate

float: rate of flow from source to sink.

CommoditySingleSourceSink.total_rate

float: rate of flow from source to sink.