From 3f71ec0c8f5d2b3bb8531b90eaf1e9f562dc23eb Mon Sep 17 00:00:00 2001 From: Ahmed Gad Date: Wed, 6 Sep 2023 18:20:47 -0400 Subject: [PATCH] Support of NSGA-II --- pygad/utils/nsga2.py | 4 ++-- pygad/visualize/plot.py | 25 +++---------------------- 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/pygad/utils/nsga2.py b/pygad/utils/nsga2.py index 8b24f30..c6a93ba 100644 --- a/pygad/utils/nsga2.py +++ b/pygad/utils/nsga2.py @@ -64,7 +64,7 @@ def get_non_dominated_set(self, curr_solutions): def non_dominated_sorting(self, fitness): """ - Apply the non-dominant sorting over the fitness to create the pareto fronts based on non-dominaned sorting of the solutions. + Apply non-dominant sorting over the fitness to create the pareto fronts based on non-dominaned sorting of the solutions. Parameters ---------- @@ -114,7 +114,7 @@ def non_dominated_sorting(self, fitness): def crowding_distance(self, pareto_front, fitness): """ - Calculate the crowding dstance for all solutions in the current pareto front. + Calculate the crowding distance for all solutions in the current pareto front. Parameters ---------- diff --git a/pygad/visualize/plot.py b/pygad/visualize/plot.py index e00bfaf..a084951 100644 --- a/pygad/visualize/plot.py +++ b/pygad/visualize/plot.py @@ -3,32 +3,13 @@ """ import numpy -import warnings import matplotlib.pyplot import pygad class Plot: - def plot_result(self, - title="PyGAD - Generation vs. Fitness", - xlabel="Generation", - ylabel="Fitness", - linewidth=3, - font_size=14, - plot_type="plot", - color="#64f20c", - save_dir=None): - - if not self.suppress_warnings: - warnings.warn("Please use the plot_fitness() method instead of plot_result(). The plot_result() method will be removed in the future.") - - return self.plot_fitness(title=title, - xlabel=xlabel, - ylabel=ylabel, - linewidth=linewidth, - font_size=font_size, - plot_type=plot_type, - color=color, - save_dir=save_dir) + + def __init__(): + pass def plot_fitness(self, title="PyGAD - Generation vs. Fitness",