MOEA/D configuration¶
Configure moead through vamos.algorithms.MOEADConfig. 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 MOEADConfig
Configuration overview · Algorithm contracts · Optimization
VAMOS 1.3.0: the resolved spec of a MOEA/D run records where its
weight vectors come from, in algorithm.resolution.weight_vectors, beside the
population in population.initial_size: {"source": "das_dennis", "divisions": 12, "vectors": 91},
{"source": "packaged_file", "file": "W3D_100.dat", "vectors": 100}, {"source": "file", "file": ...}
for a file of weight_vectors(path=...), or {"source": "uniform", ...} with two objectives.
A run whose weight_vectors(path=...) directory lacks the file generates the
lattice and saves it there; a file that holds exactly that lattice is recorded as
das_dennis, so every seed of a study records the same source whether or not an
earlier run wrote the file.
A complete lattice comes before a packaged file of the same size, so 91 and 120
individuals with three objectives use the lattice although VAMOS ships
W3D_91.dat and W3D_120.dat. Once normalized, W3D_120.dat differs from the
lattice by about 1e-16, so a tool that reads the file can drift from VAMOS with
the same seed. vamos tune records the population a trial ran
when it differs from the sampled one (see Tuning).
VAMOS 1.5.0: every weight file that VAMOS ships loads, from
optimize and from the packaged directory that the command line passes as
weight_vectors(path=...). Fourteen of the 31 did not:
W4D_100.datheld its 100 vectors twice, as the jMetalPy file it comes from (jMetal has no such file), so VAMOS skipped it, and MOEA/D with four objectives and 100 to 119 individuals ran the 84 vectors of the next smaller lattice; it now runs the file's 100 vectors, and the command line, which failed, runs them too.W4D_165.datis comma-separated in jMetal, whose own reader expects whitespace; VAMOS ships it space-separated, and reads either separator in every weight file.- jMetal rounds its files: the rows of
W3D_500.dattoW3D_1200.datand ofW5D_1000.dattoW5D_2500.datsum to one within2e-6, andW3D_136.dathas components of-5e-17. A file's rows may now depart from the simplex by1e-5(1e-6before), and a negative component within it reads as zero; the rows are not renormalized, so a file that loaded before gives the same vectors.
With optimize, a complete lattice still comes before a packaged file of the
same size, and the populations of the other sizes are unchanged.
VAMOS 1.5.0: weight_vectors(divisions=H1, inner_divisions=H2)
runs Deb and Jain's two-layer lattice, the boundary lattice of H1 divisions
and the lattice of H2 shrunk by half towards the centre of the simplex, with
comb(H1 + m - 1, m - 1) + comb(H2 + m - 1, m - 1) vectors for m objectives:
156 with eight objectives, H1 = 3 and H2 = 2, the size of jMetal's
W8D_156.dat (which stacks the two lattices without shrinking the inside one,
so it repeats the eight axes). A single lattice with many objectives has every
vector on the boundary of the simplex and grows fast (eight objectives: 120
vectors with 3 divisions, 330 with 4). The resolved spec records
{"source": "two_layer", "divisions": 3, "inner_divisions": 2, "vectors": 156}.
NSGA-III's reference_directions and RVEA's reference_vectors take the same
keys (see reference and weight vectors).
A weight_vectors(path=...) that does not exist now raises ConfigurationError
when the run starts; VAMOS 1.4.0 created it as a directory and saved the
lattice there. A directory that exists but lacks the file still gets the
lattice, saved there with a RuntimeWarning. A run binds a weight file by content:
its resolved configuration records the file it read and the sha256 of its
vectors, and replay refuses the file if they change (see
reference and weight vectors).
VAMOS 1.4.0: the options of Evolver's MOEA/D. Each is off by default, so a configuration that leaves them out runs exactly as in VAMOS 1.3.0.
| Option | Values | Reference |
|---|---|---|
subproblem_order (field and builder method) |
"random_permutation" (default), "cyclic" |
Evolver's subProblemIdGenerator: jMetal's RandomPermutationCycle and CyclicIntegerSequence |
scheme of crossover("de", cr=..., f=..., scheme=...) |
"rand_1_bin" (default), "rand_1_exp", "rand_2_bin", "rand_2_exp" |
jMetal's DifferentialEvolutionCrossover: RAND_1_BIN, RAND_1_EXP, RAND_2_BIN, RAND_2_EXP |
base of crossover("de", ..., base=...) |
"current" (default), "random" |
Evolver's MOEA/D, whose mating pool holds random parents only (selectCurrentSolution = false) |
aggregation(...) |
"augmented_tchebycheff" (rho, default 1e-4), "inverted_pbi" (theta, default 0.1), "inverse_weight_tchebycheff" |
jMetal's AugmentedTschebyscheff, InvertedPenaltyBoundaryIntersection and ModifiedTschebyscheff |
normalize and epsilon of any aggregation(...) |
normalize=False (default) or True; epsilon > 0, default 1e-6, only with normalize=True |
jMetal's normalizeObjectives and epsilon (Evolver's epsilonParameterForNormalization) |
The definitions follow jMetal 7.8, the version Evolver uses:
- Order of the subproblems.
"random_permutation"visits a new random permutation of the subproblems in each cycle."cyclic"visits 0, 1, ...,pop_size - 1and starts again, and draws no random number for it. A checkpoint keeps the order and its cursor; a cyclic run refuses the checkpoint of a random order.to_dict()leaves out the default order, so a run that does not set it keeps the resolved specification, and the task id, that VAMOS 1.3.0 gives it. - DE schemes. The child starts as the subproblem's current solution
x. The mutant isx + F (x_r1 - x_r2)with rand/1 andx + F (x_r1 - x_r2) + F (x_r3 - x_r4)with rand/2: its base is the current solution, as in jMetal'sMOEADDEBuilderand in MOEA/D-DE. Withbase="random"the base is one more random parent,x_r3(rand/1) orx_r5(rand/2), as in Evolver's MOEA/D, whose mating pool holds three or five random parents; jMetal'sDifferentialEvolutionCrossovertakes the last as the base, and the child still starts as the current solution. The random parents are distinct and come from the neighbourhood (probabilitydelta) or the population, so the neighbourhood must hold them:neighbor_size >= 2for rand/1, 3 with a random base, 4 for rand/2 and 5 with a random base. The binomial crossover takes each variable from the mutant when its draw is lower thancr, and one variable at random always. The exponential crossover takes a random variable and the next ones, cyclically, while a draw is lower thancr, up to all of them; it is CMOEA-MS'srand_1_exp. The repair then clips the child to the bounds. - Augmented Tchebycheff.
max_i w_i |f_i - z*_i| + rho sum_i w_i |f_i - z*_i|, where a zero weight counts1e-4 |f_i - z*_i|. This is the formula ofmodified_tchebycheff, whoserhodefaults to1e-3, and which Evolver does not have. - Inverse-weight Tchebycheff (
inverse_weight_tchebycheff, no parameter). jMetal'sModifiedTschebyscheff, which Evolver callsmodifiedTschebyscheff:max_i |f_i - z*_i| / w_i, where a zero weight counts1e-7 |f_i - z*_i|. Up to a positive factor per weight vector, which leaves the comparisons of a subproblem unchanged, it is the Tchebycheff function with the weights that Qi et al. (2014, Eq. 3) call the WS-transformation,(1 / w_i) / sum_j (1 / w_j). - Inverted PBI (Sato, 2014). With the displacement
u = z^nad - ffrom the nadir point,d1 = |u . w| / ||w||andd2 = ||u - d1 w / ||w|| ||, the value istheta d2 - d1, which is minimized (Sato's IPBI maximizesd1 - theta d2). - Normalization.
normalize=Truedivides the displacement of each objective byz^nad_i - z*_i + epsilon:(f_i - z*_i) / (z^nad_i - z*_i + epsilon), which the weighted sum uses in place off_i, and(z^nad_i - f_i) / (z^nad_i - z*_i + epsilon)for the inverted PBI. The nadir point is jMetal's estimate: the largest value of each objective among the non-dominated solutions of the initial population and of every evaluated child. Solutions compare by their constraint violation first (feasible before infeasible, then the less violated) and by Pareto dominance at equal violation. The ideal and nadir points are updated with each child before its replacements, or with the whole batch whenbatch_size > 1. The inverted PBI reads the nadir point with or without normalization. Evolver always normalizes it, so itsinvertedPenaltyBoundaryIntersectionisinverted_pbiwithnormalize=True. A checkpoint keeps the non-dominated set, inextra["nadir_front"]andextra["nadir_front_cv"].
The compiled neighbourhood update computes every aggregation, with and without
normalization. The compiled one-offspring step of engine="numba" covers the cyclic order
and the augmented and inverse-weight Tchebycheff aggregations. The other DE schemes, the
random base, the normalization and the inverted PBI keep the reference step, so both
engines give the same results.
The tuning name table (vamos.engine.tuning.racing.parameter_names) reads Evolver's
modifiedTschebyscheff as inverse_weight_tchebycheff and augmentedTschebyscheff as
augmented_tchebycheff, and writes them back; to_evolver refuses modified_tchebycheff,
which Evolver does not have.
MOEADConfig
dataclass
¶
Bases: _SerializableConfig
Configuration of MOEA/D.
MOEA/D gives each individual one weight vector, so pop_size must be a size that has
weights. With one or two objectives every size has them: uniform weights, as in jMetal. With
three or more, the weights are the file of weight_vectors(path=...) when there is one (a
directory holds W{n_obj}D_{pop_size}.dat); otherwise the complete Das-Dennis lattice with
exactly pop_size vectors; otherwise the jMetal file W{n_obj}D_{pop_size}.dat that VAMOS
ships (100 individuals with three objectives). Any other size raises ValueError when the run
starts: a lattice is never truncated, and the configuration never changes pop_size. The
tuning bridge does round a sampled population down to the largest size that has weights, so
150 becomes 136 with three objectives. The resolved spec of a run records the source in
algorithm.resolution.weight_vectors.
VAMOS 1.4.0: the options of Evolver's MOEA/D, all off by default:
subproblem_order:"random_permutation"(the default) or"cyclic", the order in which the subproblems are visited (Evolver'ssubProblemIdGenerator,randomPermutationCycleorcyclicIntegerSequence);- the
schemeof thedecrossover:"rand_1_bin"(the default),"rand_1_exp","rand_2_bin"or"rand_2_exp"(jMetal'sDifferentialEvolutionCrossovervariants), and itsbase:"current"(the default), the subproblem's solution, or"random", one more random parent, as Evolver's MOEA/D; the random parents (2 for rand/1, 4 for rand/2, one more with a random base) must fit inneighbor_size; - the aggregations
augmented_tchebycheff(rho, default1e-4),inverted_pbi(theta, default0.1) andinverse_weight_tchebycheff(jMetal's and Evolver's modified Tchebycheff), andnormalize=Truewithepsilon(default1e-6) for any aggregation, which normalizes the objectives with the ideal and nadir points as jMetal does.
See :mod:vamos.engine.algorithm.moead.aggregation and :mod:vamos.engine.operators.policies.moead
for the definitions.
VAMOS 1.5.0: weight_vectors takes inner_divisions with divisions, Deb and
Jain's two-layer lattice, which gives usual populations with many objectives (156 vectors with eight
objectives, 3 and 2 divisions), and NSGA-III's reference_directions and RVEA's reference_vectors
take the same keys. :func:vamos.algorithms.moead_populations lists the populations that have weights
without options.
default(pop_size=None, n_var=None, n_obj=3, encoding=None, *, variant=None)
classmethod
¶
Create a default MOEA/D configuration: VAMOS's, or one of jMetal's two defaults.
Without variant, VAMOS's default: DE rand/1/bin with cr=1.0 and
f=0.5, and PBI aggregation with theta=5, which is neither of
jMetal's. "de" is MOEA/D-DE (Li and Zhang, 2009): the same DE with
Tchebycheff aggregation; "sbx" is SBX with prob=0.9 and eta=20,
and PBI with theta=5. They are jMetal's MOEADDEBuilder and
MOEADBuilder, and Evolver's MOEADDEDefault and
MOEADDoubleDefault. All three use polynomial mutation with probability
1/n_var and eta=20, a neighbourhood of 20, a probability of 0.9
of mating in it and at most 2 replaced solutions. VAMOS 2.0 will make
"de" the default.
Without pop_size, the population is the weight-vector lattice: 99
divisions with two objectives, 12 with three and 6 with more. With
pop_size and three or more objectives, the weights are the lattice
with exactly pop_size vectors or, without one, the packaged
W{n_obj}D_{pop_size}.dat file (as jMetal uses). Discrete and mixed
encoding values take their crossover and mutation from the shared
encoding table, and the variant's aggregation.
Builder methods¶
Use MOEADConfig.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, _RepairBuilder, _InitializerBuilder, _MutationProbFactorBuilder, _ConstraintModeBuilder, _TrackGenealogyBuilder, _ResultArchiveBuilder
Declarative configuration holder for MOEA/D settings.
Examples: # Fluent builder cfg = MOEADConfig.builder().pop_size(100).neighbor_size(20).build()
# Quick default configuration
cfg = MOEADConfig.default()
aggregation(method, **kwargs)
¶
aggregation(method: AggregationName, **kwargs: Any) -> _MOEADConfigBuilder
aggregation(method: str, **kwargs: Any) -> _MOEADConfigBuilder
The aggregation function and its parameters.
tchebycheff, weighted_sum, pbi (theta, default 5), modified_tchebycheff
(rho, default 1e-3) and, VAMOS 1.4.0, augmented_tchebycheff
(rho, default 1e-4), inverted_pbi (theta, default 0.1) and
inverse_weight_tchebycheff (jMetal's ModifiedTschebyscheff, max |f - z*| / w). Any of them takes
normalize=True and epsilon (default 1e-6): each objective becomes
(f - z*) / (z^nad - z* + epsilon) with the ideal point z* and the nadir point
z^nad of the non-dominated solutions evaluated so far, as in jMetal.
subproblem_order(value)
¶
VAMOS 1.4.0: the order of the subproblems, "random_permutation" (default) or "cyclic".
"random_permutation" visits a new random permutation of the subproblems in each cycle;
"cyclic" visits them in index order and draws no random number for it (jMetal's
RandomPermutationCycle and CyclicIntegerSequence).
subproblem_update_criterion(name, **params)
¶
How a new solution replaces the solution of a subproblem under constraints.
name is feasibility_rules (the default), improved_epsilon (tao,
feasibility_ratio_threshold, decay_fraction) or violation_threshold, the criteria of
jMetal's package subproblemupdate. See :mod:vamos.engine.algorithm.moead.update_criteria.
weight_vectors(*, path=None, divisions=None, inner_divisions=None)
¶
The weight vectors: a file or directory, a lattice, or by default the lattice or packaged file of pop_size.
path names a file with one vector per line, its components separated by whitespace or commas,
or a directory with jMetal's W{n_obj}D_{pop_size}.dat files; a directory without the file gets
the lattice of exactly pop_size vectors, saved there with a RuntimeWarning. divisions
gives the complete Das-Dennis lattice. MOEA/D needs exactly one vector per individual.
VAMOS 1.5.0: 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, for any number of objectives; a path that does not exist
raises :class:~vamos.exceptions.ConfigurationError when the run starts, where VAMOS 1.4.0 created
the directory.
Populations with weight vectors¶
VAMOS 1.5.0: moead_populations(n_obj, max_pop_size=1000)
lists the populations that MOEA/D runs without weight options, as
MOEADConfig.default(pop_size=...) and optimize build them: every size from
2 with one or two objectives, and with more the sizes of the complete lattices
and of the packaged jMetal files. With four objectives up to 200 they are 4, 10,
20, 35, 56, 84, 100, 120 and 165; with six up to 300, 6, 21, 56, 126 and 252;
with eight up to 400, 8, 36, 120, 156 and 330. Other sizes need a file or a two-layer
lattice.
from vamos.algorithms import moead_populations
print(moead_populations(4, max_pop_size=200)) # (4, 10, 20, 35, 56, 84, 100, 120, 165)
moead_populations(n_obj, *, max_pop_size=1000)
¶
Return the populations, up to max_pop_size, for which MOEA/D has weight vectors by default.
MOEA/D gives each individual one weight vector. With one or two objectives every population
from 2 has them (uniform weights). With three or more, a population has them when a complete
Das-Dennis lattice has exactly that many vectors (comb(H + n_obj - 1, n_obj - 1) for H
divisions) or when VAMOS ships jMetal's file W{n_obj}D_{size}.dat (100 with three or four
objectives, 156 with eight). MOEADConfig.default(pop_size=...) and optimize accept exactly
these sizes, and vamos tune runs the largest one up to the sampled population.
Other populations need explicit weights: weight_vectors(path=...) with a file, or
weight_vectors(divisions=H1, inner_divisions=H2) with Deb and Jain's two-layer lattice of
comb(H1 + n_obj - 1, n_obj - 1) + comb(H2 + n_obj - 1, n_obj - 1) vectors.
VAMOS 1.5.0: new.
Examples:
>>> moead_populations(4, max_pop_size=200)
(4, 10, 20, 35, 56, 84, 100, 120, 165)