NSGA2

This optimizer is a non-dominating sorting genetic algorithm that solves non-convex and non-smooth single and multiobjective optimization problems. The algorithm attempts to perform global optimization, while enforcing constraints using a tournament selection-based strategy

Warning

Currently, the Python wrapper does not catch exceptions. If there is any error in the user-supplied function, you will get a seg-fault and no idea where it happened. Please make sure the objective is without errors before trying to use nsga2.

Options

NSGA2 Default Options

Name

Type

Default value

Description

PopSize

int

100

Population size

maxGen

int

1000

Maximum number of generations

pCross_real

float

0.6

Probability of crossover of real variables

pMut_real

float

0.2

Probability of mutation of real variables

eta_c

float

10.0

Distribution index for crossover

eta_m

float

20.0

Distribution index for mutation

pCross_bin

float

0.0

Probability of crossover of binary variable

pMut_bin

float

0.0

Probability of mutation of binary variables

PrintOut

int

1

Flag to turn on output to filename

seed

int

0

Random Number Seed (0 - Auto-Seed based on time clock)

xinit

int

0

Use Initial Solution Flag (0 - random population, 1 - use given solution)

API

class pyoptsparse.pyNSGA2.pyNSGA2.NSGA2(*args, **kwargs)[source]

NSGA2 Optimizer Class - Inherited from Optimizer Abstract Class

This is the base optimizer class that all optimizers inherit from. We define common methods here to avoid code duplication.

Parameters
namestr

Optimizer name

categorystr

Typically local or global

defaultOptionsdictionary

A dictionary containing the default options

informsdict

Dictionary of the inform codes

__call__(optProb, storeHistory=None, hotStart=None, **kwargs)[source]

This is the main routine used to solve the optimization problem.

Parameters
optProbOptimization or Solution class instance

This is the complete description of the optimization problem to be solved by the optimizer

storeHistorystr

File name of the history file into which the history of this optimization will be stored

hotStartstr

File name of the history file to “replay” for the optimziation. The optimization problem used to generate the history file specified in ‘hotStart’ must be IDENTICAL to the currently supplied ‘optProb’. By identical we mean, EVERY SINGLE PARAMETER MUST BE IDENTICAL. As soon as he requested evaluation point from NSGA2 does not match the history, function and gradient evaluations revert back to normal evaluations.

Notes

The kwargs are there such that the sens= argument can be supplied (but ignored here in nsga2)