{
"cells": [
{
"cell_type": "markdown",
"id": "0e2b76a4-f1d7-4dd5-88c1-0d622df5bd49",
"metadata": {},
"source": [
"# 3.6.2 Cazzaro and Pisinger 2022 Fig. 6"
]
},
{
"cell_type": "markdown",
"id": "7da558c5-033b-4fa8-9841-4b7f7b75d138",
"metadata": {},
"source": [
"This is used in the paper **Flexible cable routing framework for wind farm collection system optimization**."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "2278cd98-3fcb-428b-842b-802f13af7c2e",
"metadata": {},
"outputs": [],
"source": [
"import pickle\n",
"from importlib.resources import files\n",
"from matplotlib import pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "c69dd56e-dc8e-43cd-bcc5-b284c2a18300",
"metadata": {},
"outputs": [],
"source": [
"from optiwindnet.interarraylib import G_from_S\n",
"from optiwindnet.svg import svgplot, svgpplot\n",
"from optiwindnet.mesh import make_planar_embedding\n",
"from optiwindnet.baselines.hgs import hgs_cvrp\n",
"from optiwindnet.importer import L_from_yaml\n",
"from optiwindnet.pathfinding import PathFinder\n",
"from optiwindnet.MILP import solver_factory, ModelOptions"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "70241594-b980-4588-8e68-2981e1a4850a",
"metadata": {},
"outputs": [],
"source": [
"%config InlineBackend.figure_formats = ['svg']\n",
"plt.rcParams['svg.fonttype'] = 'none'"
]
},
{
"cell_type": "markdown",
"id": "fcf076a3-3b88-4805-8c4b-b542ce88a555",
"metadata": {},
"source": [
"## Reference solution"
]
},
{
"cell_type": "markdown",
"id": "1a7e6518-c670-45ca-a610-9b263c442bea",
"metadata": {},
"source": [
"Cazzaro, D., & Pisinger, D. (2022). Balanced cable routing for offshore wind farms with obstacles. Networks, 80(4), 386–406. https://doi.org/10.1002/net.22100"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "e978d022-7efc-4a65-9d28-61879eee3134",
"metadata": {},
"outputs": [],
"source": [
"G_ref = pickle.load(open('data/cazzaro_2022_paper_routeset.pkl', 'rb'))"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "4c5be888-9dae-4a34-9eda-8b3fe90aed23",
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
""
],
"text/plain": [
""
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"svgplot(G_ref)"
]
},
{
"cell_type": "markdown",
"id": "2386ab9b-0570-4206-8262-af30725d06a7",
"metadata": {},
"source": [
"## Start here"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "7fbfa19d-98e9-4183-9959-f71919aff71a",
"metadata": {},
"outputs": [],
"source": [
"solver = solver_factory('gurobi')"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "c282d7c0-7f50-423f-9e4e-a69d13518d04",
"metadata": {},
"outputs": [],
"source": [
"L = L_from_yaml(files('optiwindnet.data') / 'Cazzaro-2022.yaml')"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "bc633875-a777-42a1-8130-d6931eef88d1",
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
""
],
"text/plain": [
""
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"svgplot(L)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "91bf5be2-adb5-4bd9-9b5e-a06eb2b26157",
"metadata": {},
"outputs": [],
"source": [
"P, A = make_planar_embedding(L)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "ea6f4cc9-873a-456d-9fbf-67eaf9c1f896",
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
""
],
"text/plain": [
""
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"svgplot(A)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "b792422a-2397-410e-8d77-a68a8d57a36e",
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"