optiwindnet.baselines.hgs

Module Contents

optiwindnet.baselines.hgs.hgs_cvrp(A: networkx.Graph, *, capacity: float, time_limit: float, vehicles: int | None = None, seed: int = 0) 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.

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, use the minimum feasible)

Returns:

Solution topology.

optiwindnet.baselines.hgs.iterative_hgs_cvrp(A: networkx.Graph, *, capacity: float, time_limit: float, vehicles: int | None = None, seed: int = 0, max_iter: int = 10) networkx.Graph[source]

Iterate until crossing-free solution is found (hgs_cvrp() wrapper).

Each time a solution with a crossing is produced, one of the offending edges is removed from A and the solver is called again. In the same way as hgs_cvrp(), it is recommended to pass a normalized A.

Parameters:
  • * – see hgs_cvrp()

  • max_iter – maximum number of hgs_cvrp() calls in serie

Returns:

Solution S

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