Containers¶
DominatedNoveltyRepertoire
¶
Bases: GARepertoire
Repertoire that keeps the individuals with highest dominated novelty.
| Parameters: |
|
|---|
Source code in qdax/core/containers/dns_repertoire.py
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 154 155 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 | |
add(batch_of_genotypes, batch_of_descriptors, batch_of_fitnesses, batch_of_extra_scores=None)
¶
Add a batch and keep the top individuals by dominated novelty.
Parents and offsprings are gathered and only the population_size best according to dominated novelty are kept.
Source code in qdax/core/containers/dns_repertoire.py
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 154 155 156 157 158 159 160 161 162 163 164 165 | |
init(genotypes, fitnesses, descriptors, population_size, k, *args, extra_scores=None, keys_extra_scores=(), **kwargs)
classmethod
¶
Initialize the repertoire and add the first batch.
| Parameters: |
|
|---|
Source code in qdax/core/containers/dns_repertoire.py
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 | |
init_default(genotype, descriptor_dim, population_size, one_extra_score=None, keys_extra_scores=(), k=15)
classmethod
¶
Create a DNS repertoire with default values.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in qdax/core/containers/dns_repertoire.py
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 | |
GARepertoire
¶
Bases: Repertoire
Class for a simple repertoire for a simple genetic algorithm.
| Parameters: |
|
|---|
Source code in qdax/core/containers/ga_repertoire.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 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 74 75 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 154 155 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 | |
size
property
¶
Gives the size of the population.
add(batch_of_genotypes, batch_of_fitnesses, batch_of_extra_scores=None)
¶
Implements the repertoire addition rules.
Parents and offsprings are gathered and only the population_size bests are kept. The others are killed.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in qdax/core/containers/ga_repertoire.py
66 67 68 69 70 71 72 73 74 75 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 | |
init(genotypes, fitnesses, population_size, *args, extra_scores=None, keys_extra_scores=(), **kwargs)
classmethod
¶
Initializes the repertoire.
Start with default values and adds a first batch of genotypes to the repertoire.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in qdax/core/containers/ga_repertoire.py
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 154 155 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 | |
MELSRepertoire
¶
Bases: MapElitesRepertoire
Class for the repertoire in MAP-Elites Low-Spread.
This class inherits from MapElitesRepertoire. In addition to the stored data in MapElitesRepertoire (genotypes, fitnesses, descriptors, centroids), this repertoire also maintains an array of spreads. We overload the add, and init_default methods of MapElitesRepertoire.
Refer to Mace 2023 for more info on MAP-Elites Low-Spread: https://dl.acm.org/doi/abs/10.1145/3583131.3590433
| Parameters: |
|
|---|
Source code in qdax/core/containers/mels_repertoire.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 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 154 155 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 | |
add(batch_of_genotypes, batch_of_descriptors, batch_of_fitnesses, batch_of_extra_scores=None)
¶
Add a batch of elements to the repertoire.
The key difference between this method and the default add() in
MapElitesRepertoire is that it expects each individual to be evaluated
num_samples times, resulting in num_samples fitnesses and
num_samples descriptors per individual.
If multiple individuals may be added to a single cell, this method will arbitrarily pick one -- the exact choice depends on the implementation of jax.at[].set(), which can be non-deterministic: https://jax.readthedocs.io/en/latest/_autosummary/jax.numpy.ndarray.at.html We do not currently check if one of the multiple individuals dominates the others (dominate means that the individual has both highest fitness and lowest spread among the individuals for that cell).
If num_samples is only 1, the spreads will default to 0.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in qdax/core/containers/mels_repertoire.py
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 154 155 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 | |
init_default(genotype, centroids, one_extra_score=None, keys_extra_scores=())
classmethod
¶
Initialize a MAP-Elites Low-Spread repertoire with an initial population of genotypes. Requires the definition of centroids that can be computed with any method such as CVT or Euclidean mapping.
Note: this function has been kept outside of the object MELS, so it can be called easily called from other modules.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in qdax/core/containers/mels_repertoire.py
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 | |
MOMERepertoire
¶
Bases: MapElitesRepertoire
Class for the repertoire in Multi Objective Map Elites
This class inherits from MAPElitesRepertoire. The stored data is the same: genotypes, fitnesses, descriptors, centroids.
The shape of genotypes is (in the case where it's an array): (num_centroids, pareto_front_length, genotype_dim). When the genotypes is a PyTree, the two first dimensions are the same but the third will depend on the leafs.
The shape of fitnesses is: (num_centroids, pareto_front_length, num_criteria)
The shape of descriptors and centroids are: (num_centroids, num_descriptors, pareto_front_length).
Source code in qdax/core/containers/mome_repertoire.py
35 36 37 38 39 40 41 42 43 44 45 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 74 75 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 154 155 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 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | |
repertoire_capacity
property
¶
Returns the maximum number of solutions the repertoire can contain which corresponds to the number of cells times the maximum pareto front length.
| Returns: |
|
|---|
add(batch_of_genotypes, batch_of_descriptors, batch_of_fitnesses, batch_of_extra_scores=None)
¶
Insert a batch of elements in the repertoire.
Shape of the batch_of_genotypes (if an array): (batch_size, genotypes_dim) Shape of the batch_of_descriptors: (batch_size, num_descriptors) Shape of the batch_of_fitnesses: (batch_size, num_criteria)
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in qdax/core/containers/mome_repertoire.py
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 | |
compute_global_pareto_front()
¶
Merge all the pareto fronts of the MOME repertoire into a single one called global pareto front.
| Returns: |
|
|---|
Source code in qdax/core/containers/mome_repertoire.py
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | |
init(genotypes, fitnesses, descriptors, centroids, pareto_front_max_length, *args, extra_scores=None, keys_extra_scores=(), **kwargs)
classmethod
¶
Initialize a Multi Objective Map-Elites repertoire with an initial population of genotypes. Requires the definition of centroids that can be computed with any method such as CVT or Euclidean mapping.
Note: this function has been kept outside of the object MapElites, so it can be called easily called from other modules.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in qdax/core/containers/mome_repertoire.py
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 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | |
MapElitesRepertoire
¶
Bases: GARepertoire
Class for the repertoire in Map Elites.
| Parameters: |
|
|---|
Source code in qdax/core/containers/mapelites_repertoire.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 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 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | |
add(batch_of_genotypes, batch_of_descriptors, batch_of_fitnesses, batch_of_extra_scores=None)
¶
Add a batch of elements to the repertoire.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in qdax/core/containers/mapelites_repertoire.py
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 | |
init(genotypes, fitnesses, descriptors, centroids, *args, extra_scores=None, keys_extra_scores=(), **kwargs)
classmethod
¶
Initialize a Map-Elites repertoire with an initial population of genotypes. Requires the definition of centroids that can be computed with any method such as CVT or Euclidean mapping.
Note: this function has been kept outside of the object MapElites, so it can be called easily called from other modules.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in qdax/core/containers/mapelites_repertoire.py
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 | |
init_default(genotype, centroids, one_extra_score=None, keys_extra_scores=())
classmethod
¶
Initialize a Map-Elites repertoire with an initial population of genotypes. Requires the definition of centroids that can be computed with any method such as CVT or Euclidean mapping.
Note: this function has been kept outside of the object MapElites, so it can be called easily called from other modules.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in qdax/core/containers/mapelites_repertoire.py
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 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | |
NSGA2Repertoire
¶
Bases: GARepertoire
Repertoire used for the NSGA2 algorithm.
Inherits from the GARepertoire. The data stored are the genotypes and there fitness. Several functions are inherited from GARepertoire, including size, sample and init.
Source code in qdax/core/containers/nsga2_repertoire.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 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 74 75 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 154 155 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 | |
add(batch_of_genotypes, batch_of_fitnesses, batch_of_extra_scores=None)
¶
Implements the repertoire addition rules.
The population is sorted in successive pareto front. The first one is the global pareto front. The second one is the pareto front of the population where the first pareto front has been removed, etc...
The successive pareto fronts are kept until the moment where adding a full pareto front would exceed the population size.
To decide the survival of this pareto front, a crowding distance is computed in order to keep individuals that are spread in this last pareto front. Hence, the individuals with the biggest crowding distances are added until the population size is reached.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in qdax/core/containers/nsga2_repertoire.py
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 154 155 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 | |
Repertoire
¶
Bases: PyTreeNode, ABC
Abstract class for any repertoire of genotypes.
We decided not to add the attributes Genotypes even if it will be shared by all children classes because we want to keep the parent classes explicit and transparent.
Source code in qdax/core/containers/repertoire.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
add()
abstractmethod
¶
Implements the rule to add new genotypes to a repertoire.
| Returns: |
|
|---|
Source code in qdax/core/containers/repertoire.py
49 50 51 52 53 54 55 56 57 | |
init()
abstractmethod
classmethod
¶
Create a repertoire.
Source code in qdax/core/containers/repertoire.py
24 25 26 27 28 | |
select(key, num_samples, selector=None)
abstractmethod
¶
Selects individuals from the repertoire.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in qdax/core/containers/repertoire.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
SPEA2Repertoire
¶
Bases: GARepertoire
Repertoire used for the SPEA2 algorithm.
Inherits from the GARepertoire. The data stored are the genotypes and there fitness. Several functions are inherited from GARepertoire, including size, sample.
Source code in qdax/core/containers/spea2_repertoire.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 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 74 75 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 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
add(batch_of_genotypes, batch_of_fitnesses, batch_of_extra_scores=None)
¶
Updates the population with the new solutions.
To decide which individuals to keep, we count, for each solution, the number of solutions by which they are dominated. We keep only the solutions that are the less dominated ones.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in qdax/core/containers/spea2_repertoire.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 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 | |
init(genotypes, fitnesses, population_size, num_neighbours, *args, extra_scores=None, keys_extra_scores=(), **kwargs)
classmethod
¶
Initializes the repertoire.
Start with default values and adds a first batch of genotypes to the repertoire.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in qdax/core/containers/spea2_repertoire.py
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 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
UniformReplacementArchive
¶
Bases: Archive
Stores jax.Array and use a uniform replacement when the maximum size is reached.
Instead of replacing elements in a FIFO manner, like the Archive, this implementation removes elements uniformly to replace them by the newly added ones.
Most methods are inherited from Archive.
Source code in qdax/core/containers/uniform_replacement_archive.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 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 74 75 76 77 78 79 80 81 82 | |
create(acceptance_threshold, state_descriptor_size, max_size, key)
classmethod
¶
Create an Archive instance.
This class method provides a convenient way to create the archive while keeping the init function for more general way to init an archive.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in qdax/core/containers/uniform_replacement_archive.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
UnstructuredRepertoire
¶
Bases: GARepertoire
Class for the unstructured repertoire in Map Elites.
| Parameters: |
|
|---|
Source code in qdax/core/containers/unstructured_repertoire.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 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 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | |
add(batch_of_genotypes, batch_of_descriptors, batch_of_fitnesses, batch_of_extra_scores=None)
¶
Adds a batch of genotypes to the repertoire.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in qdax/core/containers/unstructured_repertoire.py
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 | |
get_maximal_size()
¶
Returns the maximal number of individuals in the repertoire.
Source code in qdax/core/containers/unstructured_repertoire.py
154 155 156 | |
get_number_genotypes()
¶
Returns the number of genotypes in the repertoire.
Source code in qdax/core/containers/unstructured_repertoire.py
158 159 160 | |
init(genotypes, fitnesses, descriptors, l_value, max_size, *args, extra_scores=None, keys_extra_scores=(), **kwargs)
classmethod
¶
Initialize a Map-Elites repertoire with an initial population of genotypes. Requires the definition of centroids that can be computed with any method such as CVT or Euclidean mapping.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in qdax/core/containers/unstructured_repertoire.py
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | |
select(key, num_samples, selector=None)
¶
Select elements in the repertoire.
This method sample a non-empty pareto front, and then sample genotypes from this pareto front.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in qdax/core/containers/unstructured_repertoire.py
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 | |