Skip to content

A python library for the following Multiobjective Optimization Algorithms or Many Objectives Optimization Algorithms: C-NSGA II; CTAEA; GrEA; HypE; IBEA-FC; IBEA-HV; MOEA/D; NAEMO; NSGA II; NSGA III; OMOPSO; PAES; RVEA; SMPSO; SMS-EMOA; SPEA2; U-NSGA III

License

Notifications You must be signed in to change notification settings

Valdecy/pyMultiobjective

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

pyMultiobjective

Introduction

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

Usage

  1. Install
pip install pyMultiobjective
  1. 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)
  1. Try it in Colab
  1. Test Functions
  1. Peformance Indicators

Single Objective Optimization

For Single Objective Optimization try pyMetaheuristic

TSP (Travelling Salesman Problem)

For Travelling Salesman Problems try pyCombinatorial

Acknowledgement

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.

About

A python library for the following Multiobjective Optimization Algorithms or Many Objectives Optimization Algorithms: C-NSGA II; CTAEA; GrEA; HypE; IBEA-FC; IBEA-HV; MOEA/D; NAEMO; NSGA II; NSGA III; OMOPSO; PAES; RVEA; SMPSO; SMS-EMOA; SPEA2; U-NSGA III

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages