Skip to main content

A python library for Multiobjective Objectives Optimization Algorithms or Many Objectives Optimization Algorithms

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymultiobjective-1.5.7.tar.gz (37.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pymultiobjective-1.5.7-py3-none-any.whl (59.6 kB view details)

Uploaded Python 3

File details

Details for the file pymultiobjective-1.5.7.tar.gz.

File metadata

  • Download URL: pymultiobjective-1.5.7.tar.gz
  • Upload date:
  • Size: 37.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.9

File hashes

Hashes for pymultiobjective-1.5.7.tar.gz
Algorithm Hash digest
SHA256 03f1e457e2cf8374073a297ab54a8243e532f9ba7ef7fd09d5cd0154f6a83c02
MD5 911c194d1b505ab1cc940763b1876d91
BLAKE2b-256 b4cd27ac61339aee8c24faa2ba0e1a263e2a9f99cbd807aba4bb702f64ddc1d0

See more details on using hashes here.

File details

Details for the file pymultiobjective-1.5.7-py3-none-any.whl.

File metadata

File hashes

Hashes for pymultiobjective-1.5.7-py3-none-any.whl
Algorithm Hash digest
SHA256 22dada7f8f5e155c6187264c18b4aecc8e2bfe5eb05e54461f72f96911f6a9e7
MD5 e970fe1ed4eeaff3c1489444bd609d46
BLAKE2b-256 9c5d2221501fcc30163b83d6af1d748f9ca1dfb28da4be3edfa4ce9ef2d5162b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page