optiwindnet.crossings¶

Module Contents¶

optiwindnet.crossings.get_interferences_list(Edge: numpy.ndarray, VertexC: numpy.ndarray, fnT: numpy.ndarray | None = None, EPSILON=1e-15) list[source]¶

List all crossings between edges in the Edge (E×2) numpy array.

Coordinates must be provided in the VertexC (V×2) array.

Edge contains indices to VertexC. If Edge includes detour nodes (i.e. indices go beyond VertexC’s length), fnT translation table must be provided.

Should be used when edges are not limited to the expanded Delaunay set.

optiwindnet.crossings.edge_crossings(u: int, v: int, G: networkx.Graph, diagonals: bidict.bidict) list[tuple[int, int]][source]¶
optiwindnet.crossings.edgeset_edgeXing_iter(diagonals: bidict.bidict) collections.abc.Iterator[list[tuple[int, int]]][source]¶

Iterator over all edge crossings in an expanded Delaunay edge set A.

Each crossing is a 2 or 3-tuple of (u, v) edges. Does not include gates.

optiwindnet.crossings.gateXing_iter(G: networkx.Graph, *, hooks: collections.abc.Iterable | None = None, borders: collections.abc.Iterable | None = None, touch_is_cross: bool = True) collections.abc.Iterator[tuple[tuple[int, int], tuple[int, int]]][source]¶

Iterate over all crossings between gates and edges/borders in G.

If hooks is None, all nodes that are not a root neighbor are considered. Used in constraint generation for ILP model.

Parameters:
  • G – Routeset or edgeset (A) to examine.

  • hooks – Nodes to check, grouped by root in sub-sequences from root -R to -1. If None, all non-root nodes are checked using ‘root’ node attribute.

  • borders – Impassable line segments between border vertices.

  • touch_is_cross – If True, count as crossing a gate going over a node.

Yields:

Pair of (edge, gate) that cross (each a 2-tuple of nodes).

optiwindnet.crossings.validate_routeset(G: networkx.Graph) list[tuple[int, int, int, int]][source]¶

Validate G’s tree topology and absence of crossings.

Check if the routeset represented by G’s edges is topologically sound, repects capacity and has no edge crossings nor branch splitting.

Parameters:

G – graph to evaluate

Returns:

list of crossings/splits, G is valid if an empty list is returned

Example:

Xings = validate_routeset(G)
  for u, v, s, t in Xings:
    if u != v:
      print(f'{u}–{v} crosses {s}–{t}')
    else:
      print(f'detour @ {u} splits {s}–{v}–{t}')
optiwindnet.crossings.list_edge_crossings(S: networkx.Graph, A: networkx.Graph) list[tuple[tuple[int, int], tuple[int, int]]][source]¶

List edge×edge crossings for the network topology in S.

S must only use extended Delaunay edges. It will not detect crossings of non-extDelaunay gates or detours.

Parameters:
  • S – solution topology

  • A – available edges used in creating S

Returns:

list of 2-tuple (crossing) of 2-tuple (edge, ordered)