Add benchmark results

This commit is contained in:
wuhanstudio 2022-07-15 23:58:15 +01:00
parent 40fc17ac5e
commit 249ac91ffe
8 changed files with 127 additions and 29 deletions

68
README.md Normal file
View File

@ -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)

BIN
images/CRE-2-3-1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

BIN
images/CRE-2-4-2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
images/CRE-2-4-3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
images/CRE-2-4-5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
images/CRE-2-7-4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

59
main.py Normal file
View File

@ -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()

View File

@ -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()