A python library for the following Multiobjective Optimization Algorithms or Many Objectives Optimization Algorithms: C-NSGA II (Clustered Non-Dominated Sorting Genetic Algorithm II); CTAEA (Constrained Two Archive Evolutionary Algorithm); GrEA (Grid-based Evolutionary Algorithm); HypE (Hypervolume Estimation Multiobjective Optimization Algorithm); IBEA-FC (Indicator-Based Evolutionary Algorithm with Fast Comparison Indicator); IBEA-HV (Indicator-Based Evolutionary Algorithm with Hypervolume Indicator); MOEA/D (Multiobjective Evolutionary Algorithm Based on Decomposition); NAEMO (Neighborhood-sensitive Archived Evolutionary Many-objective Optimization); NSGA II (Non-Dominated Sorting Genetic Algorithm II); NSGA III (Non-Dominated Sorting Genetic Algorithm III); OMOPSO (Optimized Multiobjective Particle Swarm Optimization); PAES (Pareto Archived Evolution Strategy) with Fast Non-Dominance Sorting); RVEA (Reference Vector Guided Evolutionary Algorithm); SMPSO (Speed-Constrained Multiobjective Particle Swarm Optimization); SMS-EMOA (S-Metric Selection Evolutionary Multiobjective Optimization Algorithm); SPEA2 (Strength Pareto Evolutionary Algorithm 2); U-NSGA III (Unified Non-Dominated Sorting Genetic Algorithm III).
- Install
pip install pyMultiobjective
- Import
# Import NSGA III
from pyMultiobjective.algorithm import non_dominated_sorting_genetic_algorithm_III
# Import Test Functions. Available Test Functions: Dent, DTLZ1, DTLZ2, DTLZ3, DTLZ4, DTLZ5, DTLZ6, DTLZ7, Fonseca-Fleming, Kursawe, Poloni, Schaffer1, Schaffer2, ZDT1, ZDT2, ZDT3, ZDT4, ZDT6, Viennet1, Viennet2, Viennet3
from pyMultiobjective.test_functions import dent_f1, dent_f2
# OR Define your Own Custom Function. The function input should be a list of values,
# each value represents a dimenstion (x1, x2, ...xn) of the problem.
# Run NSGA III
parameters = {
'references': 5,
'min_values': (-5, -5),
'max_values': (5, 5),
'mutation_rate': 0.1,
'generations': 1500,
'mu': 1,
'eta': 1,
'k': 2,
'verbose': True
}
sol = non_dominated_sorting_genetic_algorithm_III(list_of_functions = [dent_f1, dent_f2], **parameters)
# Import Graphs
from pyMultiobjective.util import graphs
# Plot Solution - Scatter Plot
parameters = {
'min_values': (-5, -5),
'max_values': (5, 5),
'step': (0.1, 0.1),
'solution': sol,
'show_pf': True,
'show_pts': True,
'show_sol': True,
'pf_min': True, # True = Minimum Pareto Front; False = Maximum Pareto Front
'custom_pf': [], # Input a custom Pareto Front(numpy array where each column is an Objective Function)
'view': 'browser'
}
graphs.plot_mooa_function(list_of_functions = [dent_f1, dent_f2], **parameters)
# Plot Solution - Parallel Plot
parameters = {
'min_values': (-5, -5),
'max_values': (5, 5),
'step': (0.1, 0.1),
'solution': sol,
'show_pf': True,
'pf_min': True, # True = Minimum Pareto Front; False = Maximum Pareto Front
'custom_pf': [], # Input a custom Pareto Front(numpy array where each column is an Objective Function)
'view': 'browser'
}
graphs.parallel_plot(list_of_functions = [dent_f1, dent_f2], **parameters)
# Plot Solution - Andrews Plot
parameters = {
'min_values': (-5, -5),
'max_values': (5, 5),
'step': (0.1, 0.1),
'solution': sol,
'normalize': True,
'size_x': 15,
'size_y': 15,
'show_pf': True,
'pf_min': True, # True = Minimum Pareto Front; False = Maximum Pareto Front
'custom_pf': [] # Input a custom Pareto Front(numpy array where each column is an Objective Function)
}
graphs.andrews_plot(list_of_functions = [dent_f1, dent_f2], **parameters)
# Import Performance Indicators. Available Performance Indicators: GD, GD+, IGD, IGD+, Maximum Spread, Spacing and Hypervolume
from pyMultiobjective.utils import indicators
parameters = {
'min_values': (-5, -5),
'max_values': (5, 5),
'step': (0.1, 0.1),
'solution': sol,
'pf_min': True, # True = Minimum Pareto Front; False = Maximum Pareto Front
'custom_pf': [] # Input a custom Pareto Front(numpy array where each column is an Objective Function)
}
gd = indicators.gd_indicator(list_of_functions = [dent_f1, dent_f2], **parameters)
gdp = indicators.gd_plus_indicator(list_of_functions = [dent_f1, dent_f2], **parameters)
igd = indicators.igd_indicator(list_of_functions = [dent_f1, dent_f2], **parameters)
igdp = indicators.igd_plus_indicator(list_of_functions = [dent_f1, dent_f2], **parameters)
ms = indicators.ms_indicator(list_of_functions = [dent_f1, dent_f2], **parameters)
sp = indicators.sp_indicator(list_of_functions = [dent_f1, dent_f2], **parameters)
print('GD = ', gd)
print('GDP = ', gdp)
print('IGD = ', igd)
print('IGDP = ', igdp)
print('MS = ', ms)
print('SP = ', sp)
parameters = {
'solution': sol,
'n_objs': 2,
'ref_point': [], # A Reference Point. If empty, an arbitrary Reference Point will be Used
}
hypervolume = indicators.hv_indicator(**parameters)
print('Hypervolume = ', hypervolume)
- Try it in Colab
- C-NSGA II ( Colab Demo ) ( Original Paper )
- CTAEA ( Colab Demo ) ( Original Paper )
- GrEA ( Colab Demo ) ( Original Paper )
- HypE ( Colab Demo ) ( Original Paper )
- IBEA-FC ( Colab Demo ) ( Original Paper )
- IBEA-HV ( Colab Demo ) ( Original Paper )
- MOEA/D ( Colab Demo ) ( Original Paper )
- NAEMO ( Colab Demo ) ( Original Paper )
- NSGA II ( Colab Demo ) ( Original Paper )
- NSGA III ( Colab Demo ) ( Original Paper )
- OMOPSO ( Colab Demo ) ( Original Paper )
- PAES ( Colab Demo ) ( Original Paper )
- RVEA ( Colab Demo ) ( Original Paper )
- SMPSO ( Colab Demo ) ( Original Paper )
- SMS-EMOA ( Colab Demo ) ( Original Paper )
- SPEA2 ( Colab Demo ) ( Original Paper )
- U-NSGA III ( Colab Demo ) ( Original Paper )
- Test Functions
- Dent ( Paper ) ( Pareto Front ) ( Plot )
- DTLZ1 ( Paper ) ( Pareto Front ) ( Plot )
- DTLZ2 ( Paper ) ( Pareto Front ) ( Plot )
- DTLZ3 ( Paper ) ( Pareto Front ) ( Plot )
- DTLZ4 ( Paper ) ( Pareto Front ) ( Plot )
- DTLZ5 ( Paper ) ( Pareto Front ) ( Plot )
- DTLZ6 ( Paper ) ( Pareto Front ) ( Plot )
- DTLZ7 ( Paper ) ( Pareto Front ) ( Plot )
- Fonseca-Fleming ( Paper ) ( Pareto Front ) ( Plot )
- Kursawe ( Paper ) ( Pareto Front ) ( Plot )
- Poloni ( Paper ) ( Pareto Front ) ( Plot )
- Schaffer1 ( Paper ) ( Pareto Front ) ( Plot )
- Schaffer2 ( Paper ) ( Pareto Front ) ( Plot )
- ZDT1 ( Paper ) ( Pareto Front ) ( Plot )
- ZDT2 ( Paper ) ( Pareto Front ) ( Plot )
- ZDT3 ( Paper ) ( Pareto Front ) ( Plot )
- ZDT4 ( Paper ) ( Pareto Front ) ( Plot )
- ZDT6 ( Paper ) ( Pareto Front ) ( Plot )
- Viennet1 ( Paper ) ( Pareto Front ) ( Plot )
- Viennet2 ( Paper ) ( Pareto Front ) ( Plot )
- Viennet3 ( Paper ) ( Pareto Front ) ( Plot )
- Peformance Indicators
- GD ( Paper )
- GD+ ( Paper )
- IGD ( Paper )
- IGD+ ( Paper )
- Maximum Spread ( Paper )
- Spacing ( Paper )
- Hypervolume ( Paper )
For Single Objective Optimization try pyMetaheuristic
For Travelling Salesman Problems try pyCombinatorial
This section is dedicated to all the people that helped to improve or correct the code. Thank you very much!
- Wei Chen (07.AUGUST.2019) - AFRL Summer Intern/Rising Senior at Stony Brook University.