Migrating from removed heuristic entry points¶
The legacy heuristic entry points (ClassicEW, CPEW, NBEW, and OBEW) have been removed. Their closest replacements are methods of the unified constructor() entry point.
This notebook is a migration reference, not a tutorial for a supported legacy API. Update existing code to call constructor(A, capacity, method=...) directly.
[1]:
from optiwindnet.importer import load_repository
from optiwindnet.mesh import make_planar_embedding
from optiwindnet.pathfinding import PathFinder
from optiwindnet.heuristics import constructor
from optiwindnet.interarraylib import G_from_S, calcload
from optiwindnet.svg import svgplot
%config InlineBackend.figure_formats = ['svg']
[2]:
locations = load_repository()
1. Classic Esau-Williams (method='esau_williams')¶
Replaces ClassicEW().
[3]:
L = locations.merkur
capacity = 9
P, A = make_planar_embedding(L)
S_classic = constructor(A, capacity=capacity, method='esau_williams', weigh_detours=False)
G_classic = PathFinder(G_from_S(S_classic, A), P, A).create_detours()
svgplot(G_classic)
[3]:
2. Crossing-Preventing EW (method='biased_EW')¶
Replaces CPEW().
[4]:
S_cpew = constructor(A, capacity=capacity, method='biased_EW', straight_feeder_route=True, weigh_detours=False)
G_cpew = PathFinder(G_from_S(S_cpew, A), P, A).create_detours()
svgplot(G_cpew)
[4]:
3. Non-Branching Radial EW (method='radial_EW')¶
Replaces NBEW().
[5]:
L_sofia = locations.sofia
P_sofia, A_sofia = make_planar_embedding(L_sofia)
S_nbew = constructor(A_sofia, capacity=capacity, method='radial_EW', straight_feeder_route=True, weigh_detours=False)
G_nbew = PathFinder(G_from_S(S_nbew, A_sofia), P_sofia, A_sofia).create_detours()
svgplot(G_nbew)
[5]:
4. Obstacle-Bypassing EW (method='rootlust')¶
Replaces OBEW().
[6]:
L_borkum = locations.borkum2
cap = 6
P_borkum, A_borkum = make_planar_embedding(L_borkum)
S_obew = constructor(A_borkum, capacity=cap, method='rootlust', rootlust_=(0.0, 0.6 * (cap - 1) / cap))
G_obew = PathFinder(G_from_S(S_obew, A_borkum), P_borkum, A_borkum).create_detours()
svgplot(G_obew)
[6]: