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, complete: bool = False) 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.
https://github.com/vidalt/HGS-CVRP#running-the-algorithm
- 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)
- 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]¶
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_retries – maximum number of retries to fix unrepairable crossings
- Returns:
Solution topology S