The algorithm is implemented in base of   [benchmark] [data]. Implementation details of this algorithm can be found in . The reference lines that should be used by this algorithm must be defined before it is executed. Commonly, the Das-Dennis method (implemented in UniformReferenceDirectionFactory) is used to sample reference directions uniformly.
The survival, first, the non-dominated sorting is done as in NSGA-II.
Second, from the splitting front some solutions need to be selected. NSGA-III fills up the underrepresented reference direction first. If the reference direction does not have any solution assigned to, then the solution with the smallest perpendicular distance in the normalized objective space is surviving. In case, a second solution for this reference line is added, it is assigned randomly.
For this reason, when this algorithm converges each reference line seeks to find a good representative non-dominated solution.
from pymoo.optimize import minimize from pymoo.util import plotting from pymoo.util.reference_direction import UniformReferenceDirectionFactory from pymop.factory import get_problem from pymoo.algorithms.nsga3 import nsga3 import matplotlib.pyplot as plt # create the reference directions to be used for the optimization ref_dirs = UniformReferenceDirectionFactory(3, n_points=91).do() # create the algorithm object method = nsga3(pop_size=92, ref_dirs=ref_dirs) # execute the optimization res = minimize(get_problem("dtlz1"), method, seed=1, termination=('n_gen', 600))
ax = plotting.plot(res.F, show=False, alpha=1.0) ax.view_init(45, 45) plt.show()
# execute the optimization res = minimize(get_problem("dtlz1_-1"), method, seed=1, termination=('n_gen', 600)) ax = plotting.plot(res.F, show=False, alpha=1.0) ax.view_init(25, 45) plt.show()
nsga3(ref_dirs, pop_size=None, sampling=RandomSampling(), selection=TournamentSelection(func_comp=comp_by_cv_then_random), crossover=SimulatedBinaryCrossover(prob=1.0, eta=30), mutation=PolynomialMutation(prob=None, eta=20), eliminate_duplicates=True, n_offsprings=None, **kwargs)
The reference direction that should be used during the optimization. Each row represents a reference line and each column a variable.
- pop_sizeint (default = None)
By default the population size is set to None which means that it will be equal to the number of reference line. However, if desired this can be overwritten by providing a positve number.
The sampling process defines the initial set of solutions which are the starting point of the optimization algorithm. Here, you have three different options by passing
Samplingimplementation which is an implementation of a random sampling method.
Populationobject containing the variables to be evaluated initially OR already evaluated solutions (F needs to be set in this case).
(iii) Pass a two dimensional
numpy.arraywith (n_individuals, n_var) which contains the variable space values for each individual.
This object defines the mating selection to be used. In an evolutionary algorithm each generation parents need to be selected to produce new offsprings using different recombination and mutation operators. Different strategies for selecting parents are possible e.g. selecting them just randomly, only in the neighbourhood, using a tournament selection to introduce some seletion pressure, …
The crossover has the purpose of create offsprings during the evolution. After the mating selection the parents are passed to the crossover operator which will dependent on the implementation create a different number of offsprings.
Some genetic algorithms rely only on the mutation operation. However, it has shown that increases the performance to perform a mutation after creating the offsprings through crossover as well. Usually the mutation operator needs to be initialized with a probability to be executed. Having a high probability of mutation will most of the time increase the diversity in the population.
The genetic algorithm implementation has a built in feature that eliminates duplicates after merging the parent and the offspring population. If there are duplicates with respect to the current population or in the offsprings itself they are removed and the mating process is repeated to fill up the offsprings until the desired number of unique offsprings is met.
- n_offspringsint (default: None)
Number of offspring that are created through mating. By default n_offsprings=None which sets the number of offsprings equal to the population size. By setting n_offsprings=1 a, so called, steady-state version of an algorithm can be achieved.
Returns an NSGA3 algorithm object.