From f9e00b7e8b01af29e217dff743e199758fe80db8 Mon Sep 17 00:00:00 2001 From: Tom van Woudenberg Date: Wed, 22 May 2024 17:51:30 +0200 Subject: [PATCH] Disabled pymoo cells --- book/pages/metaheuristics_example.ipynb | 49 +++++++++++-------------- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/book/pages/metaheuristics_example.ipynb b/book/pages/metaheuristics_example.ipynb index 4a84a39..6c4e46c 100644 --- a/book/pages/metaheuristics_example.ipynb +++ b/book/pages/metaheuristics_example.ipynb @@ -11,7 +11,7 @@ ":replace_default: \"True\"\n", "```\n", "\n", - "Click {fa}`rocket` --> {guilabel}`Live Code` to activate live coding on this page!\n", + "Click {fa}`rocket` --> {guilabel}`Live Code` to activate live coding on this page! Unfortunately, the `pymoo` package doesn't work yet.\n", "\n", "## Problem\n", "\n", @@ -225,7 +225,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 9, "id": "2871c599", "metadata": { "tags": [ @@ -236,36 +236,17 @@ "outputs": [], "source": [ "import scipy as sp \n", - "import numpy as np\n", - "import micropip\n", - "await micropip.install(\"pymoo\")\n", - "#%pip install pymoo\n" + "import numpy as np" ] }, { - "cell_type": "code", - "execution_count": null, - "id": "7b7d6a93", + "cell_type": "markdown", + "id": "c1e8ff92", "metadata": { "tags": [ - "thebe-remove-input-init" + "disable-execution-cell" ] }, - "outputs": [], - "source": [ - "from pymoo.problems.functional import FunctionalProblem as FunctionalProblem #import problem definer\n", - "from pymoo.algorithms.soo.nonconvex.ga import GA #import algoritm\n", - "from pymoo.optimize import minimize #import general minimizer\n", - "from pymoo.operators.sampling.rnd import IntegerRandomSampling #used for random integer creation\n", - "from pymoo.operators.crossover.sbx import SBX #needed for adapting function for integers\n", - "from pymoo.operators.mutation.pm import PM #needed for adapting function for integers\n", - "from pymoo.operators.repair.rounding import RoundingRepair #used for treating integer values" - ] - }, - { - "cell_type": "markdown", - "id": "c1e8ff92", - "metadata": {}, "source": [ "### Define variables\n", "This is done differently in SciPy and pymoo.\n", @@ -349,7 +330,11 @@ "cell_type": "code", "execution_count": 14, "id": "f740b252", - "metadata": {}, + "metadata": { + "tags": [ + "disable-execution-cell" + ] + }, "outputs": [], "source": [ "xl = np.array([0,0,0,0,0,0,0,0,0,0])\n", @@ -508,7 +493,11 @@ "cell_type": "code", "execution_count": 28, "id": "78d474e0", - "metadata": {}, + "metadata": { + "tags": [ + "disable-execution-cell" + ] + }, "outputs": [], "source": [ "problem = FunctionalProblem(n_var=n_var, objs=obj, constr_ieq=[linconfun],constr_eq = [nonlinconfun],xl=xl, xu = xu)\n", @@ -527,7 +516,11 @@ "cell_type": "code", "execution_count": 34, "id": "dc04e043", - "metadata": {}, + "metadata": { + "tags": [ + "disable-execution-cell" + ] + }, "outputs": [ { "name": "stdout",