Skip to content

Commit

Permalink
added more description to dominate check
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderdittrich committed Mar 7, 2024
1 parent 93f339b commit eae8172
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions exercise_3_nsga-II/nsga-ii.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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), set dominates to False and break the loop. This means A cannot dominate B if it is worse in any of the objectives.\n",
" - Check for At Least One Better Objective: Keep track of whether Solution A is strictly better than Solution B in at least one objective. You can do this by having a boolean flag that you set to True if you find any objective where $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",
Expand Down Expand Up @@ -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",
"<img src=\"assets/fast_nondominated_sort.png\" width=\"550\">\n",
Expand Down

0 comments on commit eae8172

Please sign in to comment.