NSGA2¶
This optimizer is a nondominating sorting genetic algorithm that solves nonconvex and nonsmooth single and multiobjective optimization problems. The algorithm attempts to perform global optimization, while enforcing constraints using a tournament selectionbased strategy
Warning
Currently, the Python wrapper does not catch exceptions. If there is any error in the usersupplied function, you will get a segfault and no idea where it happened. Please make sure the objective is without errors before trying to use nsga2.
Options¶
Name 
Type 
Default value 
Description 


int 
100 
Population size 

int 
1000 
Maximum number of generations 

float 
0.6 
Probability of crossover of real variables 

float 
0.2 
Probability of mutation of real variables 

float 
10.0 
Distribution index for crossover 

float 
20.0 
Distribution index for mutation 

float 
0.0 
Probability of crossover of binary variable 

float 
0.0 
Probability of mutation of binary variables 

int 
1 
Flag to turn on output to filename 

int 
0 
Random Number Seed (0  AutoSeed based on time clock) 

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)