optiwindnet.baselines.hgsΒΆ

Module ContentsΒΆ

optiwindnet.baselines.hgs.hgs_cvrp(A: networkx.Graph, *, capacity: float, time_limit: float, vehicles: int | None = None, seed: int | None = None, keep_log: bool = False, repair: bool = True, max_retries: int = 10, balanced: bool = False, log_callback: Callable | None = None) networkx.Graph[source]ΒΆ

Solves the OCVRP using HGS-CVRP with links from A.

Wraps HybGenSea, which provides bindings to the HGS-CVRP library (Hybrid Genetic Search solver for Capacitated Vehicle Routing Problems). This function uses it to solve an Open-CVRP i.e., vehicles do not return to the depot.

Normalization of input graph is recommended before calling this function.

For single-root problems, the solver runs on the full graph. For multi-root problems, the graph is clustered and each cluster is solved concurrently.

For multi-root instances, the vehicles (feeders) parameter can only be left undefined (meaning unlimited) or set to the minimum feasible value. Attempting to set other values will result in a warning and the minimum being used.

If repair=True (the default), the solution is iteratively repaired until no crossings remain (or max_retries is reached). This may cause the actual runtime to be up to (max_retries + 1) times the given time_limit.

Parameters:
  • A – graph with allowed edges (if it has 0 edges, use complete graph)

  • capacity – maximum vehicle capacity

  • time_limit – [s] solver run time limit

  • vehicles – number of vehicles (if None, let HGS-CVRP decide; ignored for multi-root problems)

  • seed – random seed for reproducibility

  • keep_log – attach solver log to the solution graph

  • repair – iteratively fix crossings (default True)

  • max_retries – maximum repair iterations

  • balanced – balance loads across feeders (multi-root only)

  • log_callback – callback to receive each log line produced by HGS-CVRP (only for single-root instances)

Returns:

Solution topology S

optiwindnet.baselines.hgs.iterative_hgs_cvrp(A: networkx.Graph, *, capacity: float, time_limit: float, vehicles: int | None = None, seed: int | None = None, max_retries: int = 10, keep_log: bool = False, complete: bool = False) networkx.Graph[source]ΒΆ

DEPRECATED: Backward-compatible alias of hgs_cvrp(), use it instead.

optiwindnet.baselines.hgs.hgs_multiroot(A: networkx.Graph, *, capacity: int, time_limit: float, balanced: bool = False, seed: int | None = None, keep_log: bool = False) networkx.Graph[source]ΒΆ

DEPRECATED: Backward-compatible alias of hgs_cvrp(), use it instead.