optiwindnet.baselines.utils

Module Contents

optiwindnet.baselines.utils.length_matrix_single_depot_from_G(A: networkx.Graph, *, scale: float) tuple[numpy.ndarray, float][source]

Edge length matrix for VRP-based solvers. It is assumed that the problem has been pre-scaled, such that multiplying all lengths by scale will place them within a numerically stable range. Length of return to depot from all nodes is set to 0 (i.e. Open-VRP). Order of nodes in the returned matrix is depot, clients (required by some VRP methods), which differs from interrarray order (i.e clients, depot).

Parameters:
  • A (NetworkX Graph) – Must contain graph attributes R, ‘T’, VertexC and ‘d2roots’. If A has no edges, calculate lengths of the complete graph of A’s nodes, otherwise only calculate lengths of A’s edges and assign +inf to non-existing edges. A’s edges must have the ‘length’ attribute.

  • scale (float) – Factor to multiply all lengths by.

Returns:

Matrix of lengths and maximum length value (below +inf).

Return type:

L, len_max