Skip to content

NSGA-III configuration

Configure nsgaiii through vamos.algorithms.NSGAIIIConfig. This page is the parameter reference, not a tutorial about the algorithm.

Stable public API. The 1.x compatibility policy defines the supported surface; import from the public facade shown below.

from vamos.algorithms import NSGAIIIConfig

Configuration overview · Algorithm contracts · Optimization

VAMOS 1.3.0: pop_size_auto and enforce_ref_dirs have no effect: NSGA-III runs the largest reference-direction lattice that fits in pop_size and keeps at least one individual per direction. Setting them with the builder, or enforce_ref_dirs=False in the constructor or from_dict(), emits a FutureWarning; both fields are planned for removal in 2.0 (see stable configuration). NSGAIIIConfig.default() does not warn. mutation_prob_factor now sets the mutation probability to factor / n_var, as in NSGA-II.

Development after 1.4.0: selection is ("random", {}), the default, or ("tournament", {"size": k}), and any other method or option raises ConfigurationError; NSGA-III used to run a binary tournament on rank and crowding distance whatever its selection. See variants and their effect.

Development after 1.4.0: the file of reference_directions(path=...) is read as MOEA/D's weight files: one direction per line, the components separated by whitespace or by commas (VAMOS 1.4.0 read commas only, so jMetal's W3D_100.dat failed), every row non-negative and summing to one within the rounding of jMetal's files (1e-5). A path that is not an existing file raises ConfigurationError when the run starts; VAMOS 1.4.0 generated the lattice instead and saved it at that path.

Development after 1.4.0: reference_directions takes the keys of MOEA/D's weight_vectors and RVEA's reference_vectors (see reference and weight vectors): path may also name a directory, from which NSGA-III reads jMetal's W{n_obj}D_{pop_size}.dat (a directory without it raises), and reference_directions(divisions=3, inner_divisions=2) runs Deb and Jain's two-layer lattice, 156 directions with eight objectives. The resolved spec of a run with a path records the file in algorithm.resolution.reference_directions, {"source": "file", "file": "W3D_100.dat"}; a run without one keeps the resolved spec of VAMOS 1.4.0. Study planning still rejects a path, and checks that pop_size covers a two-layer lattice.

NSGAIIIConfig dataclass

Bases: _SerializableConfig

default(pop_size=None, n_var=None, n_obj=3, encoding=None) classmethod

Create a default NSGA-III configuration.

Development after 1.4.0: parents are selected at random, as Deb and Jain (2014); the default used to be a binary tournament on rank and crowding distance.

Parameters:

Name Type Description Default
pop_size int | None

Population size. Defaults to the generated reference-direction count.

None
n_var int | None

Number of variables used for the default mutation probability.

None
n_obj int

Number of objectives used to choose the reference directions. With pop_size, the complete Das-Dennis lattice with the most directions that fit in it (pop_size - 1 divisions with two objectives). Without it, 99 divisions for two objectives, 12 for three and 6 for four or more, and pop_size is the direction count.

3
encoding EncodingLike | None

Problem encoding. Discrete and mixed encodings take their crossover and mutation from the shared encoding table.

None

Builder methods

Use NSGAIIIConfig.builder() to obtain the fluent builder; do not import the private builder class directly. The methods below are generated from that returned object, so their signatures are not maintained as a second manual parameter table.

Bases: _ConfigBuilderState, _PopSizeBuilder, _CrossoverBuilder, _MutationBuilder, _SelectionBuilder, _RepairBuilder, _InitializerBuilder, _MutationProbFactorBuilder, _ResultArchiveBuilder, _ConstraintHandlingBuilder, _ConstraintModeBuilder, _TrackGenealogyBuilder

Declarative configuration holder for NSGA-III settings.

Examples: cfg = NSGAIIIConfig.default(n_obj=3) cfg = NSGAIIIConfig.builder().pop_size(92).crossover("sbx", prob=1.0).build()

enforce_ref_dirs(enabled=True)

Kept for compatibility: it has no effect, warns, and goes in VAMOS 2.0.

pop_size_auto(enabled=True)

Kept for compatibility: it has no effect, warns, and goes in VAMOS 2.0.

reference_directions(*, path=None, divisions=None, inner_divisions=None)

The reference directions: a file or directory, or the complete Das-Dennis lattice of divisions.

path names a file with one direction per line, its components separated by whitespace or by commas, such as jMetal's weight files (W3D_100.dat, which VAMOS ships). Without either, NSGA-III runs the complete lattice with the most directions that fit in pop_size. The population needs at least one individual per direction.

Development after 1.4.0: the file may use whitespace as well as commas, and a path that is not a file raises :class:~vamos.exceptions.ConfigurationError when the run starts; VAMOS 1.4.0 read commas only, and generated the lattice and saved it at a missing path. path may also name a directory with jMetal's W{n_obj}D_{pop_size}.dat files, as MOEA/D's weight_vectors, and inner_divisions with divisions gives Deb and Jain's two-layer lattice: the boundary lattice of divisions and the lattice of inner_divisions shrunk by half towards the centre of the simplex (156 directions with eight objectives, 3 and 2 divisions).

selection(method, **kwargs)

Parent selection: "random" or "tournament" (with an optional size, 2 by default).

"random" draws the parents at random, as Deb and Jain (2014). With constraint values and feasibility first (constraint_mode="feasibility" without constraint_handling), each parent wins a binary tournament on the constraint violation that is decided at random between two feasible solutions, as the constrained NSGA-III of Jain and Deb (2014) and pymoo's NSGA-III.

"tournament" takes size solutions at random and keeps the one of the lowest non-dominated rank (feasible solutions first, then by violation, or the fronts of constraint_handling), with ties decided at random: jMetal's NSGA-III tournament. It does not use crowding distance.

Development after 1.4.0: other methods and options raise ConfigurationError; before, every method ran a binary tournament on rank and crowding distance.