{
"cells": [
{
"cell_type": "markdown",
"id": "5f6be665-2ab0-404e-b4f1-68e882887775",
"metadata": {},
"source": [
"## SCIP example"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "23c1c992-a563-4f2d-bbc8-cf0884e5b275",
"metadata": {},
"outputs": [],
"source": [
"from optiwindnet.importer import load_repository\n",
"from optiwindnet.svg import svgplot\n",
"from optiwindnet.mesh import make_planar_embedding\n",
"from optiwindnet.interarraylib import G_from_S\n",
"from optiwindnet.heuristics import EW_presolver\n",
"from optiwindnet.MILP import solver_factory, ModelOptions"
]
},
{
"cell_type": "markdown",
"id": "dd5d2195-9b34-4aed-bd09-8f52116d098a",
"metadata": {},
"source": [
"### Initialize Sheringham Shoal"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "29a6b5d1-a05f-4112-bf66-462b4d36b516",
"metadata": {},
"outputs": [],
"source": [
"locations = load_repository()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "6493ef36-765a-4cd3-9dc8-f2d952a23573",
"metadata": {},
"outputs": [],
"source": [
"L = locations.sheringham\n",
"capacity = 6"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "2a81cdd4-7be8-4da3-9b94-9799c6f1760b",
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
""
],
"text/plain": [
""
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"svgplot(L)"
]
},
{
"cell_type": "markdown",
"id": "5996b343-8973-49cb-8e34-d4b1161d625e",
"metadata": {},
"source": [
"### Optimize Sheringham Shoal"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "df05184d-7caa-4b34-810e-37c13a7a8092",
"metadata": {},
"outputs": [],
"source": [
"P, A = make_planar_embedding(L)"
]
},
{
"cell_type": "markdown",
"id": "4f9b49b1-a597-4053-a3d1-f3de7bb8d164",
"metadata": {},
"source": [
"Initial heuristic solution to warm-start the solver:"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "19eb273d-f662-4851-bf09-e0ec532d7b8b",
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
""
],
"text/plain": [
""
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Sʹ = EW_presolver(A, capacity=capacity)\n",
"Gʹ = G_from_S(Sʹ, A)\n",
"svgplot(Gʹ)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "977c294a-b052-4cba-97e8-a71b86b480f3",
"metadata": {},
"outputs": [],
"source": [
"solver = solver_factory('scip')"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "ceb633e1-785a-4625-bf8a-c1fc4b5bd298",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Solver is not capable of warm-starting.\n"
]
}
],
"source": [
"solver.set_problem(\n",
" P, A,\n",
" capacity=Sʹ.graph['capacity'],\n",
" model_options=ModelOptions(\n",
" topology=\"branched\",\n",
" feeder_route=\"segmented\",\n",
" feeder_limit=\"unlimited\",\n",
" ),\n",
" warmstart=Sʹ,\n",
")"
]
},
{
"cell_type": "markdown",
"id": "73ab52bb-067d-4e39-b8e7-bc92a3573e01",
"metadata": {},
"source": [
"SCIP's Pyomo API does not offer the warm-starting capability yet."
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "71a448d2-3257-4c58-a7c4-d953b989ea75",
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"SCIP version 9.2.2 [precision: 8 byte] [memory: block] [mode: optimized] [LP solver: SoPlex 7.1.4] [GitHash: 416226a4f8]\n",
"Copyright (c) 2002-2025 Zuse Institute Berlin (ZIB)\n",
"\n",
"External libraries: \n",
" SoPlex 7.1.4 Linear programming solver developed at Zuse Institute Berlin (soplex.zib.de) [GitHash: 7c53d552]\n",
" CppAD 20180000.0 Algorithmic Differentiation of C++ algorithms developed by B. Bell (github.com/coin-or/CppAD)\n",
" ZLIB 1.3.1 General purpose compression library by J. Gailly and M. Adler (zlib.net)\n",
" GMP 6.3.0 GNU Multiple Precision Arithmetic Library developed by T. Granlund (gmplib.org)\n",
" ZIMPL 3.6.2 Zuse Institute Mathematical Programming Language developed by T. Koch (zimpl.zib.de)\n",
" AMPL/MP 690e9e7 AMPL .nl file reader library (github.com/ampl/mp)\n",
" PaPILO 2.4.2 parallel presolve for integer and linear optimization (github.com/scipopt/papilo) (built with TBB) [GitHash: 4b399c4c]\n",
" Nauty 2.8.8 Computing Graph Automorphism Groups by Brendan D. McKay (users.cecs.anu.edu.au/~bdm/nauty)\n",
" sassy 1.1 Symmetry preprocessor by Markus Anders (github.com/markusa4/sassy)\n",
" Ipopt 3.14.17 Interior Point Optimizer developed by A. Waechter et.al. (github.com/coin-or/Ipopt)\n",
"\n",
"reading user parameter file \n",
"===========================\n",
"\n",
"limits/time = 180\n",
"limits/gap = 0.005\n",
"\n",
"read problem \n",
"============\n",
"\n",
"original problem has 1992 variables (996 bin, 996 int, 0 impl, 0 cont) and 2986 constraints\n",
"\n",
"solve problem\n",
"=============\n",
"\n",
" [linear] : [B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +[B] (+0) +