Skip to content

Commit

Permalink
Update notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
ajnebro committed May 10, 2024
1 parent 008cca9 commit 1b7a63d
Show file tree
Hide file tree
Showing 6 changed files with 1,557 additions and 1,747 deletions.
43 changes: 42 additions & 1 deletion Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.10.3"
manifest_format = "2.0"
project_hash = "29a6145c02c22a98034a3568ff449383e5e62744"
project_hash = "aa033784bda443e249e3bfcba6e156ffd538383e"

[[deps.ArgTools]]
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
Expand Down Expand Up @@ -88,6 +88,12 @@ git-tree-sha1 = "8cfa272e8bdedfa88b6aefbbca7c19f1befac519"
uuid = "f0e56b4a-5159-44fe-b623-3e5288b988bb"
version = "2.3.0"

[[deps.Conda]]
deps = ["Downloads", "JSON", "VersionParsing"]
git-tree-sha1 = "51cab8e982c5b598eea9c8ceaced4b58d9dd37c9"
uuid = "8f4d0f93-b110-5947-807f-2305c1781a2d"
version = "1.10.0"

[[deps.Contour]]
git-tree-sha1 = "d05d9e7b7aedff4e5b51a029dced05cfb6125781"
uuid = "d38c429a-6771-53c6-b99e-75d170b6e991"
Expand Down Expand Up @@ -241,6 +247,12 @@ git-tree-sha1 = "129acf094d168394e80ee1dc4bc06ec835e510a3"
uuid = "2e76f6c2-a576-52d4-95c1-20adfe4de566"
version = "2.8.1+1"

[[deps.IJulia]]
deps = ["Base64", "Conda", "Dates", "InteractiveUtils", "JSON", "Libdl", "Logging", "Markdown", "MbedTLS", "Pkg", "Printf", "REPL", "Random", "SoftGlobalScope", "Test", "UUIDs", "ZMQ"]
git-tree-sha1 = "47ac8cc196b81001a711f4b2c12c97372338f00c"
uuid = "7073ff75-c697-5162-941a-fcdaad2a7d2a"
version = "1.24.2"

[[deps.InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
Expand Down Expand Up @@ -654,6 +666,12 @@ version = "1.1.0"
[[deps.Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"

[[deps.SoftGlobalScope]]
deps = ["REPL"]
git-tree-sha1 = "986ec2b6162ccb95de5892ed17832f95badf770c"
uuid = "b85f4697-e234-5449-a836-ec8e2f98b302"
version = "1.1.0"

[[deps.SortingAlgorithms]]
deps = ["DataStructures"]
git-tree-sha1 = "66e0a8e672a0bdfca2c3f5937efb8538b9ddc085"
Expand Down Expand Up @@ -759,6 +777,11 @@ git-tree-sha1 = "ca0969166a028236229f63514992fc073799bb78"
uuid = "41fe7b60-77ed-43a1-b4f0-825fd5a5650d"
version = "0.2.0"

[[deps.VersionParsing]]
git-tree-sha1 = "58d6e80b4ee071f5efd07fda82cb9fbe17200868"
uuid = "81def892-9a0e-5fdd-b105-ffc91e053289"
version = "1.3.0"

[[deps.Vulkan_Loader_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Wayland_jll", "Xorg_libX11_jll", "Xorg_libXrandr_jll", "xkbcommon_jll"]
git-tree-sha1 = "2f0486047a07670caad3a81a075d2e518acc5c59"
Expand Down Expand Up @@ -939,6 +962,18 @@ git-tree-sha1 = "e92a1a012a10506618f10b7047e478403a046c77"
uuid = "c5fb5394-a638-5e4d-96e5-b29de1b5cf10"
version = "1.5.0+0"

[[deps.ZMQ]]
deps = ["FileWatching", "Sockets", "ZeroMQ_jll"]
git-tree-sha1 = "356d2bdcc0bce90aabee1d1c0f6d6f301eda8f77"
uuid = "c2297ded-f4af-51ae-bb23-16f91089e4e1"
version = "1.2.2"

[[deps.ZeroMQ_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "libsodium_jll"]
git-tree-sha1 = "42f97fb27394378591666ab0e9cee369e6d0e1f9"
uuid = "8f1865be-045e-5c20-9c9f-bfbfb0764568"
version = "4.3.5+0"

[[deps.Zlib_jll]]
deps = ["Libdl"]
uuid = "83775a58-1f1d-513f-b197-d71354ab007a"
Expand Down Expand Up @@ -1009,6 +1044,12 @@ git-tree-sha1 = "93284c28274d9e75218a416c65ec49d0e0fcdf3d"
uuid = "b53b4c65-9356-5827-b1ea-8c7a1a84506f"
version = "1.6.40+0"

[[deps.libsodium_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "848ab3d00fe39d6fbc2a8641048f8f272af1c51e"
uuid = "a9144af2-ca23-56d9-984f-0d03f7b5ccf8"
version = "1.0.20+0"

[[deps.libvorbis_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Ogg_jll", "Pkg"]
git-tree-sha1 = "b910cb81ef3fe6e78bf6acee440bda86fd6ae00c"
Expand Down
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ version = "0.2.0"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
474 changes: 283 additions & 191 deletions notebooks/Dealing with constrained problems.ipynb

Large diffs are not rendered by default.

58 changes: 32 additions & 26 deletions notebooks/Defining problems.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 6,
"id": "44759988",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ContinuousProblem{Real}(Bounds{Real}[Bounds{Real}(-1000.0, 1000.0)], Function[var\"#9#10\"(), var\"#11#12\"()], Function[], \"Schaffer\")\n"
"ContinuousProblem{Real}(Bounds{Real}[Bounds{Real}(-1000.0, 1000.0)], Function[var\"#13#14\"(), var\"#15#16\"()], Function[], \"Schaffer\")\n"
]
}
],
Expand Down Expand Up @@ -165,7 +165,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 5,
"id": "d496dfdc",
"metadata": {},
"outputs": [
Expand All @@ -176,7 +176,7 @@
"Number of variables: 1\n",
"Number of objectives: 2\n",
"Number of constraints: 0\n",
"Name: Schaffer\n",
"Name: Schaffer2\n",
"Bounds: Bounds{Real}[Bounds{Real}(-1000.0, 1000.0)]\n"
]
}
Expand Down Expand Up @@ -254,7 +254,7 @@
"This problem can be implemented as follows. First, we create a struct called ``ZDT6`` to contain the problem bounds:\n",
" \n",
"```julia\n",
"struct ZDT6 <: AbstractContinuousProblem{Float64}\n",
"struct ProblemZDT6 <: AbstractContinuousProblem{Float64}\n",
" bounds::Vector{Bounds{Float64}}\n",
"end\n",
"```"
Expand All @@ -268,25 +268,29 @@
"Next we define a function called ``zdt6Problem()`` which initializes the problem bounds and the set of functions to retrieve the problem data:\n",
"\n",
"```julia\n",
"function zdt6Problem(numberOfVariables::Int=10)\n",
"function ZDT6(numberOfVariables::Int=10)\n",
" bounds = [Bounds{Float64}(0.0, 1.0) for _ in range(1, numberOfVariables)]\n",
"\n",
" return ZDT6(bounds)\n",
" return ProblemZDT6(bounds)\n",
"end\n",
"\n",
"function numberOfVariables(problem::ZDT6)\n",
"function numberOfVariables(problem::ProblemZDT6)\n",
" return length(problem.bounds)\n",
"end\n",
"\n",
"function numberOfObjectives(problem::ZDT6)\n",
"function numberOfObjectives(problem::ProblemZDT6)\n",
" return 2\n",
"end\n",
"\n",
"function numberOfConstraints(problem::ZDT6)\n",
"function numberOfConstraints(problem::ProblemZDT6)\n",
" return 0\n",
"end\n",
"\n",
"function name(problem::ZDT6)\n",
"function bounds(problem::ProblemZDT6)\n",
" return problem.bounds\n",
"end\n",
"\n",
"function name(problem::ProblemZDT6)\n",
" return \"ZDT6\"\n",
"end\n",
"\n",
Expand All @@ -300,7 +304,7 @@
"source": [
"The last step is to implement the ``evaluate`` method containing the code of the objective functions:\n",
"```julia\n",
"function evaluate(solution::ContinuousSolution{Float64}, problem::ZDT6)::ContinuousSolution{Float64}\n",
"function evaluate(solution::ContinuousSolution{Float64}, problem::ProblemZDT6)::ContinuousSolution{Float64}\n",
" x = solution.variables\n",
" @assert length(x) == numberOfVariables(problem) \"The number of variables of the solution to be evaluated is not correct\"\n",
"\n",
Expand Down Expand Up @@ -333,30 +337,32 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"id": "00ca6da7",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "f83004f7",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
"display_name": "Julia 1.10.3",
"language": "julia",
"name": "julia-1.10"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.10.3"
}
},
"nbformat": 4,
Expand Down
1,320 changes: 594 additions & 726 deletions notebooks/NSGA-II notebook.ipynb

Large diffs are not rendered by default.

1,408 changes: 605 additions & 803 deletions notebooks/NSGA-II with external archive.ipynb

Large diffs are not rendered by default.

0 comments on commit 1b7a63d

Please sign in to comment.