Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
Disabled pymoo cells
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom-van-Woudenberg committed May 22, 2024
1 parent a222271 commit f9e00b7
Showing 1 changed file with 21 additions and 28 deletions.
49 changes: 21 additions & 28 deletions book/pages/metaheuristics_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -225,7 +225,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 9,
"id": "2871c599",
"metadata": {
"tags": [
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -527,7 +516,11 @@
"cell_type": "code",
"execution_count": 34,
"id": "dc04e043",
"metadata": {},
"metadata": {
"tags": [
"disable-execution-cell"
]
},
"outputs": [
{
"name": "stdout",
Expand Down

0 comments on commit f9e00b7

Please sign in to comment.