Skip to content

Commit

Permalink
Update notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
ajnebro committed Nov 28, 2024
1 parent fd45c0c commit 734d135
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions notebooks/NSGA-II solving multiobjective TSP.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,43 @@
"xlabel!(\"First objective\")\n",
"ylabel!(\"Second objective\")"
]
},
{
"cell_type": "markdown",
"id": "c22b5bb7",
"metadata": {},
"source": [
"## Standard NSGA-II configured with custom settings and an observer"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2193fe0c",
"metadata": {},
"outputs": [],
"source": [
"solver::NSGAII = NSGAII(\n",
" problem,\n",
" populationSize = 100, \n",
" termination = TerminationByEvaluations(125000),\n",
" crossover = PMXCrossover(probability = 0.9),\n",
" mutation = PermutationSwapMutation(probability = 0.2))\n",
"\n",
"observer = EvaluationObserver(10000)\n",
"register!(observable(solver), observer)\n",
"\n",
"optimize!(solver)\n",
"\n",
"x = [solution.objectives[1] for solution in foundSolutions(solver)];\n",
"y = [solution.objectives[2] for solution in foundSolutions(solver)];\n",
" \n",
"gr();\n",
" \n",
"scatter(x, y, title = \"Pareto front approximation\", label = \"Solutions\")\n",
"xlabel!(\"First objective\")\n",
"ylabel!(\"Second objective\")"
]
}
],
"metadata": {
Expand Down

0 comments on commit 734d135

Please sign in to comment.