@File : dominated.py @Time : 2026/05/22 12:51:26 @Author : Alejandro Marrero (amarrerd@ull.edu.es) @Version : 1.0 @Contact : amarrerd@ull.edu.es @License : (C)Copyright 2026, Alejandro Marrero @Desc : None
DNSResult
dataclass
Container for the outputs of a Dominated Novelty Search computation.
Bundles together the descriptors, performance values, and competition
fitness scores produced by dominated_novelty_search for a pooled set
of individuals (e.g. a population merged with its offspring). All three
arrays are aligned by index — that is, descriptors[i],
performances[i], and competition_fitness[i] all refer to the same
individual — and are sorted in descending order of competition_fitness,
so the most competitive (highest-fitness) individual is always at index 0.
Source code in digneapy/generators/dominated.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
competition_fitness
instance-attribute
np.ndarray: Combined fitness score (comp_f) for each individual,
derived from both performance and local novelty against its k
nearest neighbours in descriptor space. This is the value used to rank
and select individuals during survival/replacement. Shape is
(n_individuals,).
descriptors
instance-attribute
np.ndarray: Descriptor vectors of each individual, used to measure
novelty/diversity relative to its neighbours. Shape is
(n_individuals, descriptor_dim).
performances
instance-attribute
np.ndarray: Performance bias (or raw solver performance score) of each
individual. Shape is (n_individuals,).
Dominated
Bases: Evolutionary
Quality-Diversity instance generator using Dominated Novelty Search.
Dominated is a variant of :class:Evolutionary that replaces the
archive-based novelty mechanism with Dominated Novelty Search (DNS): at
each generation, parents and offspring are pooled together and ranked
using a combined fitness (comp_f) computed by
dominated_novelty_search from each individual's descriptor and
performance bias relative to its k nearest neighbours in the pooled
set. The top pop_size individuals by combined fitness survive into
the next generation, acting simultaneously as both selection and
replacement.
Because DNS computes novelty directly from the pooled population/offspring
rather than from a persistent archive, this class does not maintain an
Archive for novelty purposes: the inherited self._archive is
explicitly deleted after initialisation, and no solution_set support
is exposed.
Source code in digneapy/generators/dominated.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | |
__call__(verbose=False)
Run the Dominated Novelty Search evolutionary process.
The algorithm proceeds as follows:
1. Validates that a domain and a non-empty solver portfolio were
provided.
2. Samples an initial population of pop_size instances and
evaluates it against the portfolio to obtain performance biases
and per-solver scores, then computes descriptors for it.
3. For each of the self._generations generations:
- Generates an offspring population of size pop_size via
:meth:Evolutionary.generate (inherited selection + crossover
+ mutation).
- Evaluates the offspring and computes its descriptors.
- Concatenates the current population and the offspring into a
single pool of descriptors, performance biases, portfolio
scores, and genotypes.
- Runs dominated_novelty_search over the pooled descriptors
and performances (using self._k neighbours) to obtain a
combined fitness (comp_f) for every pooled individual.
- Selects the indices of the top pop_size individuals by
combined fitness (via np.argpartition followed by a sort of
just that subset, for efficiency) to form the next generation.
- Rebuilds the survivors as Instance objects (with diversity
scores set to zero, since DNS folds novelty into comp_f
rather than tracking it separately) and assigns them to
self._population.
- Records progress for the generation in self._logbook.
4. After all generations, returns a :class:GenerationResult
containing the solver names, the final surviving population, and
the evolutionary history.
| Parameters: |
|
|---|
| Raises: |
|
|---|
| Returns: |
|
|---|
Source code in digneapy/generators/dominated.py
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | |
__init__(domain, portfolio, pop_size=np.uint32(128), performance_function=maximise_perf_gap_easy, generations=np.uint32(1000), repetitions=np.uint16(1), k=np.uint32(15), descriptor_pipe=DescriptorPipeline('features'), cxrate=0.5, mutrate=0.8, crossover=UCX(), mutation=UMut(), selection=BinarySelection(), seed=None)
Creates a Evolutionary Instance Generator based on Novelty Search
Internally this delegates to Evolutionary.__init__ with a
throwaway UnstructuredArchive (since the parent class requires
one), which is then discarded via del self._archive once
construction completes, as Dominated computes novelty directly
from the pooled population/offspring rather than from a persistent
archive.
| Parameters: |
|
|---|
| Raises: |
|
|---|
Source code in digneapy/generators/dominated.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |
dominated_novelty_search(descriptors, performances, k)
Dominated Novelty Search (DNS) Bahlous-Boldi, R., Faldor, M., Grillotti, L., Janmohamed, H., Coiffard, L., Spector, L., & Cully, A. (2025). Dominated Novelty Search: Rethinking Local Competition in Quality-Diversity. 1. https://arxiv.org/abs/2502.00593v1
Quality-Diversity algorithm that implements local competition through dynamic fitness transformations,
eliminating the need for predefined bounds or parameters. The competition fitness, also known as the dominated novelty score,
is calculated as the average distance to the k nearest neighbors with higher fitness.
The method returns a descending sorted list of instances by their competition fitness value. For each instance ``i'' in the sequence, we calculate all the other instances that dominate it. Then, we compute the distances between their descriptors using the norm of the difference for each dimension of the descriptors. Novel instances will get a competition fitness of np.inf (assuring they will survive). Less novel instances will be selected by their competition fitness value. This competition mechanism creates two complementary evolutionary pressures: individuals must either improve their fitness or discover distinct behaviors that differ from better-performing solutions. Solutions that have no fitter neighbors (D𝑖 = ∅) receive an infinite competition fitness, ensuring their preservation in the population.
| Parameters: |
|
|---|
Raises: ValueError: If len(d) where d is the descriptor of each instance i differs from another
| Returns: |
|
|---|
Source code in digneapy/generators/dominated.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |