Skip to main content

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.

Metadata

Release files for pymultiobjective 1.5.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymultiobjective 1.5.7
File Size Uploaded
pymultiobjective-1.5.7.tar.gz 37.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pymultiobjective 1.5.7
File Interpreter ABI Platform
pymultiobjective-1.5.7-py3-none-any.whl Python 3 none any Details

Total release size: 97.0 kB

Release files / pymultiobjective-1.5.7.tar.gz

Download URL pymultiobjective-1.5.7.tar.gz
Size 37.4 kB
Tags Source
SHA-256 checksum
How to use checksums
03f1e457e2cf8374073a297ab54a8243e532f9ba7ef7fd09d5cd0154f6a83c02
BLAKE2b-256 checksum
How to use checksums
b4cd27ac61339aee8c24faa2ba0e1a263e2a9f99cbd807aba4bb702f64ddc1d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.9

Release files / pymultiobjective-1.5.7-py3-none-any.whl

Download URL pymultiobjective-1.5.7-py3-none-any.whl
Size 59.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
22dada7f8f5e155c6187264c18b4aecc8e2bfe5eb05e54461f72f96911f6a9e7
BLAKE2b-256 checksum
How to use checksums
9c5d2221501fcc30163b83d6af1d748f9ca1dfb28da4be3edfa4ce9ef2d5162b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.9

Release history Release notifications | RSS feed

This release

1.5.7 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page