diff --git a/README.md b/README.md new file mode 100644 index 0000000..530aa0f --- /dev/null +++ b/README.md @@ -0,0 +1,68 @@ +# EMOA + +Benchmarks of Evolutionary multi-objective optimization algorithms (EMOA) on Real-world Multi-objective +Optimization Problem Suite. + +## Quick Start + +Creating the environment: + +``` +conda create -n pymoo python=3.8 +conda activate pymoo +pip install -U pymoo +``` + +Change the test problem in `main.py` + +``` +python main.py +``` + +## Benchmark + +> population size: 100 +> number of generations: 200 + +#### CRE-2-3-1 + +Time (s): +CTAEA 6.297407865524292 +NSGA2 9.709688425064087 +NSGA3 13.19536280632019 + +![](images/CRE-2-3-1.png) + +#### CRE-2-4-2 + +Time (s): +CTAEA 5.5211687088012695 +NSGA2 8.863621950149536 +NSGA3 12.693290948867798 + +#### CRE-2-4-3 + +Time (s): +CTAEA 5.683619022369385 +NSGA2 9.352391481399536 +NSGA3 13.239986419677734 + +![](images/CRE-2-4-3.png) + +#### CRE-2-7-4 + +Time (s): +CTAEA 6.6659016609191895 +NSGA2 10.643601417541504 +NSGA3 14.66565227508545 + +![](images/CRE-2-7-4.png) + +#### CRE-2-4-5 + +Time (s): +CTAEA 5.434146165847778 +NSGA2 10.283865928649902 +NSGA3 15.255037069320679 + +![](images/CRE-2-4-5.png) diff --git a/images/CRE-2-3-1.png b/images/CRE-2-3-1.png new file mode 100644 index 0000000..e025cc5 Binary files /dev/null and b/images/CRE-2-3-1.png differ diff --git a/images/CRE-2-4-2.png b/images/CRE-2-4-2.png new file mode 100644 index 0000000..9c1bbb7 Binary files /dev/null and b/images/CRE-2-4-2.png differ diff --git a/images/CRE-2-4-3.png b/images/CRE-2-4-3.png new file mode 100644 index 0000000..6bf4436 Binary files /dev/null and b/images/CRE-2-4-3.png differ diff --git a/images/CRE-2-4-5.png b/images/CRE-2-4-5.png new file mode 100644 index 0000000..010a6de Binary files /dev/null and b/images/CRE-2-4-5.png differ diff --git a/images/CRE-2-7-4.png b/images/CRE-2-7-4.png new file mode 100644 index 0000000..731bdf2 Binary files /dev/null and b/images/CRE-2-7-4.png differ diff --git a/main.py b/main.py new file mode 100644 index 0000000..2e7ecfc --- /dev/null +++ b/main.py @@ -0,0 +1,59 @@ +from cProfile import label +from pymoo.algorithms.moo.nsga2 import NSGA2 +from pymoo.algorithms.moo.ctaea import CTAEA +from pymoo.algorithms.moo.nsga3 import NSGA3 + +from pymoo.factory import get_reference_directions +from pymoo.optimize import minimize + +from pymoo.visualization.scatter import Scatter +from reproblem import * + +import time + +# Define the problem +problem = CRE25() # CRE21() CRE22() CRE23() CRE24() CRE25() + +ref_dirs = get_reference_directions("das-dennis", 2, n_partitions=64) + +# Define Algorithms +nsga_2_alg = NSGA2(pop_size=100) +nsga_3_alg = NSGA3(pop_size=100, ref_dirs=ref_dirs) +ctaea_alg = CTAEA(ref_dirs=ref_dirs) + +# C-TAEA +start = time.time() +res_ctaea = minimize(problem, + ctaea_alg, + ('n_gen', 200), + seed=1, + verbose=False) +end = time.time() +print('CTAEA', end - start) + +# NSGA-II +res_nsga_2 = minimize(problem, + nsga_2_alg, + ('n_gen', 200), + seed=1, + verbose=False) +end = time.time() +print('NSGA2', end - start) + +# NSGA-III +res_nsga_3 = minimize(problem, + nsga_3_alg, + ('n_gen', 200), + seed=1, + verbose=False) +end = time.time() +print('NSGA3', end - start) + +# Plot the results +plot = Scatter(title="Approximated Pareto fronts of the CRE2-4-5", legend=True) + +plot.add(res_ctaea.F, facecolor="none", edgecolor="blue", label="C-TAEA") +plot.add(res_nsga_2.F, facecolor="none", edgecolor="red", label="NSGA-II") +plot.add(res_nsga_3.F, facecolor="none", edgecolor="yellow", label="NSGA-III") + +plot.show() diff --git a/nsga-ii-re.py b/nsga-ii-re.py deleted file mode 100644 index 590edea..0000000 --- a/nsga-ii-re.py +++ /dev/null @@ -1,29 +0,0 @@ -from pymoo.algorithms.moo.nsga2 import NSGA2 -from pymoo.algorithms.moo.ctaea import CTAEA -from pymoo.algorithms.moo.nsga3 import NSGA3 - -from pymoo.factory import get_reference_directions -from pymoo.optimize import minimize - -from pymoo.visualization.scatter import Scatter -from reproblem import * - -problem = CRE22() -ref_dirs = get_reference_directions("das-dennis", 2, n_partitions=64) - -algorithm = NSGA2(pop_size=100) -algorithm = NSGA3(pop_size=92, - ref_dirs=ref_dirs) -# IBEA -algorithm = CTAEA(ref_dirs=ref_dirs) - -res = minimize(problem, - algorithm, - ('n_gen', 200), - seed=1, - verbose=False) - -plot = Scatter() -plot.add(problem.pareto_front(), plot_type="line", color="black", alpha=0.7) -plot.add(res.F, facecolor="none", edgecolor="red") -plot.show()