From eae8172f376d2d817b07321123e59bd542bc473d Mon Sep 17 00:00:00 2001 From: Alexander Dittrich Date: Thu, 7 Mar 2024 10:33:58 +0100 Subject: [PATCH] added more description to dominate check --- exercise_3_nsga-II/nsga-ii.ipynb | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/exercise_3_nsga-II/nsga-ii.ipynb b/exercise_3_nsga-II/nsga-ii.ipynb index 33a9bce..a6c55b7 100644 --- a/exercise_3_nsga-II/nsga-ii.ipynb +++ b/exercise_3_nsga-II/nsga-ii.ipynb @@ -248,10 +248,10 @@ "id": "1a7656c1-35b6-40db-a6c8-43aa42e0560b", "metadata": {}, "source": [ - "## Step 3: Non-dominated Sorting\n", + "## Step 3a: Check dominance\n", "\n", "First we have to specify, when a solution dominates another. Remember, a solution dominates another if:\n", - "1. $\\exists i \\in {1, \\dots, k}, f_i(x) \\leq f_i(y)$ --> Solution ($x$) is no worse than Solution ($y$) in all objectives.\n", + "1. $\\forall i \\in {1, \\dots, k}, f_i(x) \\leq f_i(y)$ --> Solution ($x$) is no worse than Solution ($y$) in all objectives.\n", "2. $\\exists i \\in {1, \\dots, k}, f_i(x) < f_i(y)$ --> Solution ($x$) is strictly better than Solution ($y$) in at least one objective.\n", "\n", "--------\n", @@ -260,6 +260,19 @@ "\n", "\n", "### **Hint**\n", + "\n", + "1. **Initialize a Flag:** \n", + " Start with a boolean flag called dominates set to True. This flag will be used to indicate whether Solution A dominates Solution B.\n", + "\n", + "2. **Loop Through Objectives:** \n", + " For each objective function $f_i$ā€‹ from $0$ to $n$, do the following:\n", + " - Check for No Worse Objective: If Solution A is worse than Solution B in objective $f_i$ā€‹, i.e., if $f_i(A)>f_i(B)$ for a minimization problem (or $f_i(A)f_i(B)$ for a maximization problem).\n", + "\n", + "3. **Final Decision: After the loop:**\n", + " - If the dominates flag is still True and A is strictly better in at least one objective, then Solution A dominates Solution B.\n", + " - Otherwise, Solution A does not dominate Solution B.\n", + "\n", "Try different fitness values in the test field to ensure that you implemented the `dominates` function correctly. \n", "\n", "In this implementation we have a minimization problem, therefore a solution is not dominated if there is no solution in the rectangle left-hand below the solution as elaborated on slide 9 \"Comparing solutions in the objective space\" of the lecture.\n", @@ -339,7 +352,7 @@ "tags": [] }, "source": [ - "## Nondominant sorting / find Pareto fronts\n", + "## Step 3b: Non-dominant sorting / find Pareto fronts\n", "Core element of this algorithm is the nondominant sorting into Pareto fronts. For an efficient implementation of the non-dominant sorting, we split this step into two functions.\n", "\n", "\n",