This is used in the paper Flexible cable routing framework for wind farm collection system optimization.
[1]:
from importlib.resources import files
import dill
[2]:
from optiwindnet.interarraylib import G_from_S
from optiwindnet.svg import svgplot
from optiwindnet.mesh import make_planar_embedding
from optiwindnet.baselines.hgs import hgs_multiroot
from optiwindnet.importer import L_from_yaml
from optiwindnet.pathfinding import PathFinder
from optiwindnet.MILP import solver_factory, ModelOptions
from optiwindnet.heuristics import EW_presolver
from optiwindnet.interarraylib import as_normalized
[3]:
solver = solver_factory('gurobi')
Reference solution¶
Taylor, P., Yue, H., Campos-Gaona, D., Anaya-Lara, O., & Jia, C. (2023). Wind farm array cable layout optimisation for complex offshore sites—A decomposition based heuristic approach. IET Renewable Power Generation, 17(2), 243–259. https://doi.org/10.1049/rpg2.12593
[4]:
G_ref = dill.load(open('data/taylor_2023_paper_routeset.dill', 'rb'))
[5]:
svgplot(G_ref)
[5]:
Start here¶
[6]:
L = L_from_yaml(files('optiwindnet.data') / 'Taylor-2023.yaml')
[7]:
svgplot(L)
[7]:
[8]:
P, A = make_planar_embedding(L)
[9]:
Sʹ = EW_presolver(A, 12)
[10]:
Gʹ = G_from_S(Sʹ, A)
[11]:
Hʹ = PathFinder(Gʹ, planar=P, A=A).create_detours()
[12]:
svgplot(Hʹ)
[12]:
[13]:
Sʹ = hgs_multiroot(as_normalized(A), capacity=12, time_limit=0.6)
[14]:
Sʹ.graph['solution_time']
[14]:
(0.24, 0.45)
[15]:
Gʹ = G_from_S(Sʹ, A)
[16]:
Hʹ = PathFinder(Gʹ, planar=P, A=A).create_detours()
[17]:
svgplot(Hʹ)
[17]:
[18]:
1 - Hʹ.size(weight='length')/G_ref.size(weight='length')
[18]:
0.007366473452870892
[19]:
solver.set_problem(
P, A,
capacity=Sʹ.graph['capacity'],
model_options=ModelOptions(
topology="branched",
feeder_route="segmented",
feeder_limit="unlimited",
),
warmstart=Sʹ,
)
[20]:
solver.solve(
mip_gap=0.001,
time_limit=5,
verbose=True,
options=dict(
mipfocus=1,
RINS=100,
CutPasses=4,
VarBranch=1,
)
)
Set parameter OutputFlag to value 1
Gurobi Optimizer version 12.0.3 build v12.0.3rc0 (win64 - Windows 11.0 (26100.2))
CPU model: 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz, instruction set [SSE2|AVX|AVX2|AVX512]
Thread count: 8 physical cores, 16 logical processors, using up to 16 threads
Non-default parameters:
TimeLimit 5
MIPGap 0.001
MIPFocus 1
RINS 100
VarBranch 1
CutPasses 4
Academic license 937681 - for non-commercial use only - registered to ma___@dtu.dk
Optimize a model with 4322 rows, 2896 columns and 16328 nonzeros
Model fingerprint: 0x8af4f963
Variable types: 0 continuous, 2896 integer (1448 binary)
Coefficient statistics:
Matrix range [1e+00, 1e+01]
Objective range [4e+02, 9e+03]
Bounds range [1e+00, 1e+01]
RHS range [1e+00, 1e+02]
Loaded user MIP start with objective 103544
Presolve removed 531 rows and 0 columns
Presolve time: 0.03s
Presolved: 3791 rows, 2896 columns, 13820 nonzeros
Variable types: 0 continuous, 2896 integer (1448 binary)
Root relaxation: objective 9.983546e+04, 2945 iterations, 0.06 seconds (0.07 work units)
Nodes | Current Node | Objective Bounds | Work
Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time
0 0 99835.4625 0 131 103543.724 99835.4625 3.58% - 0s
H 0 0 102928.08101 99835.4625 3.00% - 0s
H 0 0 102579.91095 99835.4625 2.68% - 0s
H 0 0 102564.80595 99835.4625 2.66% - 0s
H 0 0 101945.23428 100385.045 1.53% - 0s
H 0 0 101941.50091 100385.045 1.53% - 0s
H 0 0 101792.05306 100385.045 1.38% - 0s
0 0 100385.045 0 269 101792.053 100385.045 1.38% - 0s
H 0 0 101449.42419 100385.045 1.05% - 0s
H 0 0 101320.93030 100385.045 0.92% - 0s
H 0 0 101002.99294 100459.087 0.54% - 0s
H 0 0 100997.84062 100459.087 0.53% - 0s
0 0 100459.087 0 221 100997.841 100459.087 0.53% - 0s
0 0 100460.601 0 233 100997.841 100460.601 0.53% - 0s
0 0 100460.602 0 233 100997.841 100460.602 0.53% - 0s
0 0 100484.376 0 222 100997.841 100484.376 0.51% - 0s
0 0 100484.376 0 147 100997.841 100484.376 0.51% - 0s
H 0 0 100944.96471 100484.376 0.46% - 0s
0 0 100484.670 0 231 100944.965 100484.670 0.46% - 0s
0 0 100487.927 0 233 100944.965 100487.927 0.45% - 0s
0 0 100488.213 0 215 100944.965 100488.213 0.45% - 0s
0 0 100488.246 0 215 100944.965 100488.246 0.45% - 0s
0 0 100498.562 0 265 100944.965 100498.562 0.44% - 0s
0 0 100499.797 0 296 100944.965 100499.797 0.44% - 0s
0 0 100500.291 0 283 100944.965 100500.291 0.44% - 0s
0 0 100500.306 0 299 100944.965 100500.306 0.44% - 0s
H 0 0 100919.34129 100500.306 0.42% - 1s
H 0 0 100917.57961 100500.306 0.41% - 1s
H 0 0 100901.68653 100514.234 0.38% - 1s
H 0 0 100894.06812 100514.234 0.38% - 1s
0 0 100514.234 0 229 100894.068 100514.234 0.38% - 1s
0 0 100517.593 0 260 100894.068 100517.593 0.37% - 1s
0 0 100518.294 0 276 100894.068 100518.294 0.37% - 1s
0 0 100518.365 0 285 100894.068 100518.365 0.37% - 1s
0 0 100518.365 0 282 100894.068 100518.365 0.37% - 1s
H 0 0 100871.45809 100518.365 0.35% - 1s
H 0 0 100863.60197 100518.365 0.34% - 1s
0 0 100520.841 0 258 100863.602 100520.841 0.34% - 1s
0 0 100520.841 0 133 100863.602 100520.841 0.34% - 1s
0 0 100520.841 0 228 100863.602 100520.841 0.34% - 1s
0 0 100520.841 0 161 100863.602 100520.841 0.34% - 1s
0 0 100520.841 0 257 100863.602 100520.841 0.34% - 1s
0 0 100521.478 0 246 100863.602 100521.478 0.34% - 1s
0 0 100521.527 0 258 100863.602 100521.527 0.34% - 1s
0 0 100522.902 0 265 100863.602 100522.902 0.34% - 1s
0 0 100522.954 0 270 100863.602 100522.954 0.34% - 1s
0 0 100524.972 0 241 100863.602 100524.972 0.34% - 1s
0 0 100525.199 0 244 100863.602 100525.199 0.34% - 1s
0 0 100525.262 0 235 100863.602 100525.262 0.34% - 1s
0 0 100525.833 0 261 100863.602 100525.833 0.33% - 1s
0 2 100525.864 0 261 100863.602 100525.864 0.33% - 1s
H 39 48 100853.92852 100531.675 0.32% 104 2s
H 157 151 100853.01366 100531.675 0.32% 63.1 2s
H 158 151 100840.13267 100531.675 0.31% 63.3 2s
H 587 398 100836.08865 100537.148 0.30% 49.5 3s
H 598 419 100823.57443 100537.148 0.28% 49.5 3s
H 706 443 100796.21047 100537.148 0.26% 49.5 3s
H 978 583 100794.97109 100548.611 0.24% 46.1 4s
Cutting planes:
Gomory: 10
Lift-and-project: 1
Implied bound: 4
MIR: 44
StrongCG: 5
Flow cover: 37
Flow path: 1
Inf proof: 6
Network: 7
Relax-and-lift: 2
Explored 2155 nodes (95704 simplex iterations) in 5.02 seconds (3.60 work units)
Thread count was 16 (of 16 available processors)
Solution count 10: 100795 100796 100824 ... 100894
Time limit reached
Best objective 1.007949710936e+05, best bound 1.005572361407e+05, gap 0.2359%
WARNING: Loading a SolverResults object with an 'aborted' status, but
containing a solution
[20]:
SolutionInfo(runtime=5.0290000438690186, bound=100557.23614067948, objective=100794.97109360032, relgap=0.002358599346192314, termination='maxTimeLimit')
[21]:
S, G = solver.get_solution()
[22]:
svgplot(G)
[22]:
[23]:
1 - G.size(weight='length')/G_ref.size(weight='length')
[23]:
0.03371769751959075
[24]:
with open('Taylor_comparison_κ_12_branched_our.dill', 'wb') as outfile:
dill.dump(G, outfile)