optiwindnet.terse¶
Compact, self-describing encodings of solution and routeset links.
Module Contents¶
- class optiwindnet.terse.LinkScope[source]¶
Bases:
enum.StrEnumGraph layer represented by
TerseLinks.Initialize self. See help(type(self)) for accurate signature.
- class optiwindnet.terse.TerseLinks[source]¶
Bases:
collections.abc.Sequence[int]Compact links plus the metadata needed to reconstruct their graph.
RADIALandBRANCHEDvalues use one parent target per non-root node.RINGEDvalues use the flattened route representation. A topology value representsS; a routeset value additionally carries the clone mapping needed to reproduceGagainst its location graph. Either scope can be bound to an exact location geometry withnodeset_digest.- topology: optiwindnet.types.Topology[source]¶
- to_dict() dict[str, Any][source]¶
Return a versioned representation suitable for JSON serialization.
- classmethod from_dict(data: collections.abc.Mapping[str, Any]) TerseLinks[source]¶
Restore a value created by
to_dict().
- classmethod from_topology(S: networkx.Graph, *, nodeset_digest: bytes | None = None) TerseLinks[source]¶
Encode solution topology
S, optionally bound to a node set.
- classmethod from_routeset(G: networkx.Graph) TerseLinks[source]¶
Encode routed solution
G, including its clone mapping.
- classmethod from_array(links: collections.abc.Sequence[int], *, topology: optiwindnet.types.Topology | str | None = None, R: int | None = None, T: int | None = None) TerseLinks[source]¶
Adapt a legacy topology array to a self-describing value.