RVEA configuration¶
Configure rvea through vamos.algorithms.RVEAConfig. 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 RVEAConfig
Configuration overview · Algorithm contracts · Optimization
Development after 1.4.0: reference_vectors gives RVEA the reference
vectors of a file, a directory or a two-layer lattice, with the keys of MOEA/D's
weight_vectors and NSGA-III's reference_directions (see
reference vectors), so that
the three algorithms can start from the same vectors, as jMetal and Evolver
configure them:
from vamos import optimize
from vamos.algorithms import RVEAConfig
config = (
RVEAConfig.builder()
.pop_size(100)
.reference_vectors(path="weights/W3D_100.dat") # a copy of jMetal's file, which VAMOS also ships
.alpha(2.0)
.adapt_freq(0.1)
.crossover("sbx", prob=0.9, eta=30.0)
.mutation("pm", prob="1/n", eta=20.0)
.build()
)
result = optimize("dtlz2", algorithm="rvea", algorithm_config=config, max_evaluations=1000, seed=1)
RVEA keeps one individual per vector, so the file must hold pop_size
vectors; a directory is searched for W{n_obj}D_{pop_size}.dat, and a missing
or mismatching file raises before any evaluation. n_partitions is not used
with reference_vectors; the builder does not need it and records the
divisions (12 for a file). reference_vectors(divisions=12) runs the same
lattice as n_partitions(12). to_dict() leaves the field out while it is
None, so a configuration without it keeps the resolved specification, and the
task id, of VAMOS 1.4.0. The resolved spec of a run with a file records it in
algorithm.resolution.reference_vectors, for example
{"source": "file", "file": "W3D_100.dat", "vectors": 100}. Study planning
rejects a path, as it does for NSGA-III, and checks that pop_size equals the
vectors of divisions and inner_divisions.
RVEAConfig
dataclass
¶
Bases: _SerializableConfig
Configuration of RVEA.
RVEA keeps one individual per reference vector, so pop_size must equal their number. By
default the vectors are the complete Das-Dennis lattice of n_partitions.
Development after 1.4.0: reference_vectors takes the vectors from elsewhere, with the
keys of MOEA/D's weight_vectors and NSGA-III's reference_directions:
path: a file with one vector per line, its components separated by whitespace or commas, or a directory with jMetal'sW{n_obj}D_{pop_size}.datfiles, such as the jMetal files VAMOS ships (W3D_100.datruns 100 individuals with three objectives). The file must exist and holdpop_sizevectors;divisions: the lattice of that many divisions, asn_partitions;divisionsandinner_divisions: Deb and Jain's two-layer lattice, the boundary layer ofdivisionsand an inside layer ofinner_divisions(see :func:~vamos.engine.reference_directions.two_layer_lattice).
With reference_vectors, n_partitions is not used. to_dict() leaves the field out
while it is None, so a configuration without it keeps the resolved specification, and the
task id, of VAMOS 1.4.0.
default(pop_size=None, n_var=None, n_obj=3, encoding=None)
classmethod
¶
Create a default RVEA configuration.
RVEA needs one individual per reference vector. With pop_size,
n_partitions is the Das-Dennis lattice of exactly that size, and a size
that matches no lattice raises :class:~vamos.exceptions.ConfigurationError
naming the nearest valid ones. Without it, n_partitions is 99 for two
objectives, 12 for three and 6 for four or more. Discrete and mixed
encoding values take their crossover and mutation from the shared
encoding table.
Builder methods¶
Use RVEAConfig.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, _ConstraintHandlingBuilder, _ConstraintModeBuilder, _TrackGenealogyBuilder, _ResultArchiveBuilder
Declarative configuration holder for RVEA settings.
Examples: cfg = RVEAConfig.default() cfg = RVEAConfig.builder().pop_size(100).n_partitions(12).build()
reference_vectors(*, path=None, divisions=None, inner_divisions=None)
¶
Development after 1.4.0: the reference vectors: a file or directory, or a lattice.
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; the file must exist
and hold pop_size vectors. Without it, divisions gives the lattice, and with
inner_divisions Deb and Jain's two-layer lattice. n_partitions is then not needed:
without it, the configuration records divisions, or 12 for a file.