emo
Methods
desdeo.emo.methods.EAs
[Deprecated] Implements common evolutionary algorithms for multi-objective optimization.
Use desdeo.emo.options.algorithms instead.
ibea
ibea(
*,
problem: Problem,
population_size: int = 100,
n_generations: int = 100,
max_evaluations: int | None = None,
kappa: float = 0.05,
binary_indicator: Callable[
[ndarray], ndarray
] = self_epsilon,
seed: int = 0,
forced_verbosity: int | None = None,
) -> tuple[Callable[[], EMOResult], Publisher]
Implements the Indicator-Based Evolutionary Algorithm (IBEA).
References
Zitzler, E., Künzli, S. (2004). Indicator-Based Selection in Multiobjective Search. In: Yao, X., et al. Parallel Problem Solving from Nature - PPSN VIII. PPSN 2004. Lecture Notes in Computer Science, vol 3242. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-30217-9_84
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
The problem to be solved. |
required |
population_size
|
int
|
The size of the population. Defaults to 100. |
100
|
n_generations
|
int
|
The number of generations to run the algorithm. Defaults to 100. |
100
|
max_evaluations
|
int | None
|
The maximum number of evaluations to run the algorithm. If None, the algorithm will run for n_generations. Defaults to None. If both n_generations and max_evaluations are provided, the algorithm will run until max_evaluations is reached. |
None
|
kappa
|
float
|
The kappa value for the IBEA selection. Defaults to 0.05. |
0.05
|
binary_indicator
|
Callable[[ndarray], ndarray]
|
A binary indicator function that takes the target values and returns a binary indicator for each individual. Defaults to self_epsilon with uses binary adaptive epsilon indicator. |
self_epsilon
|
seed
|
int
|
The seed for the random number generator. Defaults to 0. |
0
|
forced_verbosity
|
int | None
|
If not None, the verbosity of the algorithm is forced to this value. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Callable[[], EMOResult], Publisher]
|
tuple[Callable[[], EMOResult], Publisher]: A tuple containing the function to run the algorithm and the publisher object. The publisher object can be used to subscribe to the topics of the algorithm components, as well as to inject additional functionality such as archiving the results. |
Source code in desdeo/emo/methods/EAs.py
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 | |
nsga3
nsga3(
*,
problem: Problem,
seed: int = 0,
n_generations: int = 100,
max_evaluations: int | None = None,
reference_vector_options: ReferenceVectorOptions = None,
forced_verbosity: int | None = None,
) -> tuple[Callable[[], EMOResult], Publisher]
Implements the NSGA-III algorithm as well as its interactive version.
References
K. Deb and H. Jain, “An Evolutionary Many-Objective Optimization Algorithm Using Reference-Point-Based Nondominated Sorting Approach, Part I: Solving Problems With Box Constraints,” IEEE Transactions on Evolutionary Computation, vol. 18, no. 4, pp. 577-601, Aug. 2014.
J. Hakanen, T. Chugh, K. Sindhya, Y. Jin, and K. Miettinen, “Connections of reference vectors and different types of preference information in interactive multiobjective evolutionary algorithms,” in 2016 IEEE Symposium Series on Computational Intelligence (SSCI), Athens, Greece: IEEE, Dec. 2016, pp. 1-8.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
The problem to be solved. |
required |
seed
|
int
|
The seed for the random number generator. Defaults to 0. |
0
|
n_generations
|
int
|
The number of generations to run the algorithm. Defaults to 100. |
100
|
max_evaluations
|
int
|
The maximum number of evaluations to run the algorithm. If None, the algorithm will run for n_generations. Defaults to None. If both n_generations and max_evaluations are provided, the algorithm will run until max_evaluations is reached. |
None
|
reference_vector_options
|
ReferenceVectorOptions
|
The options for the reference vectors. Defaults to None. See the ReferenceVectorOptions class for the defaults. This option can be used to run an interactive version of the algorithm, using preferences provided by the user. |
None
|
forced_verbosity
|
int
|
If not None, the verbosity of the algorithm is forced to this value. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Callable[[], EMOResult], Publisher]
|
tuple[Callable[[], EMOResult], Publisher]: A tuple containing the function to run the algorithm and the publisher object. The publisher object can be used to subscribe to the topics of the algorithm components, as well as to inject additional functionality such as archiving the results. |
Source code in desdeo/emo/methods/EAs.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 | |
nsga3_mixed_integer
nsga3_mixed_integer(
*,
problem: Problem,
seed: int = 0,
n_generations: int = 100,
max_evaluations: int | None = None,
reference_vector_options: ReferenceVectorOptions = None,
forced_verbosity: int | None = None,
) -> tuple[Callable[[], EMOResult], Publisher]
Implements the NSGA-III algorithm as well as its interactive version for mixed-integer problems.
References
K. Deb and H. Jain, “An Evolutionary Many-Objective Optimization Algorithm Using Reference-Point-Based Nondominated Sorting Approach, Part I: Solving Problems With Box Constraints,” IEEE Transactions on Evolutionary Computation, vol. 18, no. 4, pp. 577-601, Aug. 2014.
J. Hakanen, T. Chugh, K. Sindhya, Y. Jin, and K. Miettinen, “Connections of reference vectors and different types of preference information in interactive multiobjective evolutionary algorithms,” in 2016 IEEE Symposium Series on Computational Intelligence (SSCI), Athens, Greece: IEEE, Dec. 2016, pp. 1-8.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
The problem to be solved. |
required |
seed
|
int
|
The seed for the random number generator. Defaults to 0. |
0
|
n_generations
|
int
|
The number of generations to run the algorithm. Defaults to 100. |
100
|
max_evaluations
|
int
|
The maximum number of evaluations to run the algorithm. If None, the algorithm will run for n_generations. Defaults to None. If both n_generations and max_evaluations are provided, the algorithm will run until max_evaluations is reached. |
None
|
reference_vector_options
|
ReferenceVectorOptions
|
The options for the reference vectors. Defaults to None. See the ReferenceVectorOptions class for the defaults. This option can be used to run an interactive version of the algorithm, using preferences provided by the user. |
None
|
forced_verbosity
|
int
|
If not None, the verbosity of the algorithm is forced to this value. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Callable[[], EMOResult], Publisher]
|
tuple[Callable[[], EMOResult], Publisher]: A tuple containing the function to run the algorithm and the publisher object. The publisher object can be used to subscribe to the topics of the algorithm components, as well as to inject additional functionality such as archiving the results. |
Source code in desdeo/emo/methods/EAs.py
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 438 439 440 441 | |
rvea
rvea(
*,
problem: Problem,
seed: int = 0,
n_generations=100,
max_evaluations: int | None = None,
reference_vector_options: ReferenceVectorOptions = None,
forced_verbosity: int | None = None,
) -> tuple[Callable[[], EMOResult], Publisher]
Implements the Reference Vector Guided Evolutionary Algorithm (RVEA), as well as its interactive version.
References
R. Cheng, Y. Jin, M. Olhofer and B. Sendhoff, "A Reference Vector Guided Evolutionary Algorithm for Many- Objective Optimization," in IEEE Transactions on Evolutionary Computation, vol. 20, no. 5, pp. 773-791, Oct. 2016, doi: 10.1109/TEVC.2016.2519378.
J. Hakanen, T. Chugh, K. Sindhya, Y. Jin, and K. Miettinen, “Connections of reference vectors and different types of preference information in interactive multiobjective evolutionary algorithms,” in 2016 IEEE Symposium Series on Computational Intelligence (SSCI), Athens, Greece: IEEE, Dec. 2016, pp. 1-8.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
The problem to be solved. |
required |
seed
|
int
|
The seed for the random number generator. Defaults to 0. |
0
|
n_generations
|
int
|
The number of generations to run the algorithm. Defaults to 100. |
100
|
max_evaluations
|
int
|
The maximum number of evaluations to run the algorithm. If None, the algorithm will run for n_generations. Defaults to None. If both n_generations and max_evaluations are provided, the algorithm will run until max_evaluations is reached. |
None
|
reference_vector_options
|
ReferenceVectorOptions
|
The options for the reference vectors. Defaults to None. See the ReferenceVectorOptions class for the defaults. This option can be used to run an interactive version of the algorithm, using preferences provided by the user. |
None
|
forced_verbosity
|
int
|
If not None, the verbosity of the algorithm is forced to this value. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Callable[[], EMOResult], Publisher]
|
tuple[Callable[[], EMOResult], Publisher]: A tuple containing the function to run the algorithm and the publisher object. The publisher object can be used to subscribe to the topics of the algorithm components, as well as to inject additional functionality such as archiving the results. |
Source code in desdeo/emo/methods/EAs.py
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 | |
rvea_mixed_integer
rvea_mixed_integer(
*,
problem: Problem,
seed: int = 0,
n_generations=100,
max_evaluations: int | None = None,
reference_vector_options: ReferenceVectorOptions = None,
forced_verbosity: int | None = None,
) -> tuple[Callable[[], EMOResult], Publisher]
Implements the mixed-integer variant of RVEA, as well as its interactive version.
References
R. Cheng, Y. Jin, M. Olhofer and B. Sendhoff, "A Reference Vector Guided Evolutionary Algorithm for Many- Objective Optimization," in IEEE Transactions on Evolutionary Computation, vol. 20, no. 5, pp. 773-791, Oct. 2016, doi: 10.1109/TEVC.2016.2519378.
J. Hakanen, T. Chugh, K. Sindhya, Y. Jin, and K. Miettinen, “Connections of reference vectors and different types of preference information in interactive multiobjective evolutionary algorithms,” in 2016 IEEE Symposium Series on Computational Intelligence (SSCI), Athens, Greece: IEEE, Dec. 2016, pp. 1-8.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
The problem to be solved. |
required |
seed
|
int
|
The seed for the random number generator. Defaults to 0. |
0
|
n_generations
|
int
|
The number of generations to run the algorithm. Defaults to 100. |
100
|
max_evaluations
|
int
|
The maximum number of evaluations to run the algorithm. If None, the algorithm will run for n_generations. Defaults to None. If both n_generations and max_evaluations are provided, the algorithm will run until max_evaluations is reached. |
None
|
reference_vector_options
|
ReferenceVectorOptions
|
The options for the reference vectors. Defaults to None. See the ReferenceVectorOptions class for the defaults. This option can be used to run an interactive version of the algorithm, using preferences provided by the user. |
None
|
forced_verbosity
|
int
|
If not None, the verbosity of the algorithm is forced to this value. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Callable[[], EMOResult], Publisher]
|
tuple[Callable[[], EMOResult], Publisher]: A tuple containing the function to run the algorithm and the publisher object. The publisher object can be used to subscribe to the topics of the algorithm components, as well as to inject additional functionality such as archiving the results. |
Source code in desdeo/emo/methods/EAs.py
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 | |
Templates
desdeo.emo.methods.templates
This module contains the basic functional implementations for the EMO methods.
This can be used as a template for the implementation of the EMO methods.
template1
template1(
evaluator: EMOEvaluator,
crossover: BaseCrossover,
mutation: BaseMutation,
generator: BaseGenerator,
selection: BaseSelector,
terminator: BaseTerminator,
repair: Callable[[DataFrame], DataFrame] = lambda x: x,
) -> EMOResult
Implements a template that many EMO methods, such as RVEA and NSGA-III, follow.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
evaluator
|
EMOEvaluator
|
A class that evaluates the solutions and provides the objective vectors, constraint vectors, and targets. |
required |
crossover
|
BaseCrossover
|
The crossover operator. |
required |
mutation
|
BaseMutation
|
The mutation operator. |
required |
generator
|
BaseGenerator
|
A class that generates the initial population. |
required |
selection
|
BaseSelector
|
The selection operator. |
required |
terminator
|
BaseTerminator
|
The termination operator. |
required |
repair
|
Callable
|
A function that repairs the offspring if they go out of bounds. Defaults to an
identity function, meaning no repair is done. See |
lambda x: x
|
Returns:
| Name | Type | Description |
|---|---|---|
EMOResult |
EMOResult
|
The final population and their objective vectors, constraint vectors, and targets |
Source code in desdeo/emo/methods/templates.py
template2
template2(
evaluator: EMOEvaluator,
crossover: BaseCrossover,
mutation: BaseMutation,
generator: BaseGenerator,
selection: BaseSelector,
mate_selection: BaseScalarSelector,
terminator: BaseTerminator,
repair: Callable[[DataFrame], DataFrame] = lambda x: x,
) -> EMOResult
Implements a template that many EMO methods, such as IBEA, follow.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
evaluator
|
EMOEvaluator
|
A class that evaluates the solutions and provides the objective vectors, constraint vectors, and targets. |
required |
crossover
|
BaseCrossover
|
The crossover operator. |
required |
mutation
|
BaseMutation
|
The mutation operator. |
required |
generator
|
BaseGenerator
|
A class that generates the initial population. |
required |
selection
|
BaseSelector
|
The selection operator. |
required |
mate_selection
|
BaseScalarSelector
|
The mating selection operator, which selects parents for mating. This is typically a scalar selector that selects parents based on their fitness. |
required |
terminator
|
BaseTerminator
|
The termination operator. |
required |
repair
|
Callable
|
A function that repairs the offspring if they go out of bounds. Defaults to an
identity function, meaning no repair is done. See |
lambda x: x
|
Returns:
| Name | Type | Description |
|---|---|---|
EMOResult |
EMOResult
|
The final population and their objective vectors, constraint vectors, and targets |
Source code in desdeo/emo/methods/templates.py
Generators
desdeo.emo.operators.generator
Class for generating initial population for the evolutionary optimization algorithms.
ArchiveGenerator
Bases: BaseGenerator
Class for getting initial population from an archive.
Source code in desdeo/emo/operators/generator.py
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 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | |
__init__
__init__(
problem: Problem,
evaluator: EMOEvaluator,
publisher: Publisher,
verbosity: int,
solutions: DataFrame,
**kwargs: dict,
)
Initialize the ArchiveGenerator class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
The problem to solve. |
required |
evaluator
|
BaseEvaluator
|
The evaluator to evaluate the population. Only used to check that the outputs have the correct variables. |
required |
publisher
|
Publisher
|
The publisher to publish the messages. |
required |
verbosity
|
int
|
The verbosity level of the generator. A verbosity of 2 is needed if you want to maintain an external archive. Otherwise, a verbosity of 1 is sufficient. |
required |
solutions
|
DataFrame
|
The decision variable vectors to use as the initial population. |
required |
kwargs
|
dict
|
Other keyword arguments to pass, e.g., a random seed. |
{}
|
Source code in desdeo/emo/operators/generator.py
do
Get the initial population from the archive.
Returns:
| Type | Description |
|---|---|
tuple[DataFrame, DataFrame]
|
tuple[pl.DataFrame, pl.DataFrame]: The initial population as the first element, the corresponding objectives, the constraint violations, and the targets as the second element. |
Source code in desdeo/emo/operators/generator.py
state
Return the state of the generator.
This method overrides the state method of the BaseGenerator class, because the solutions and outputs are already provided and not generated by the generator.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Sequence[Message]
|
The state of the generator. |
Source code in desdeo/emo/operators/generator.py
BaseGenerator
Bases: Subscriber
Base class for generating initial population for the evolutionary optimization algorithms.
This class should be inherited by the classes that implement the initial population generation for the evolutionary optimization algorithms.
Source code in desdeo/emo/operators/generator.py
interested_topics
property
Return the message topics that the generator is interested in.
provided_topics
property
Return the topics provided by the generator.
Returns:
| Type | Description |
|---|---|
dict[int, Sequence[GeneratorMessageTopics]]
|
dict[int, Sequence[GeneratorMessageTopics]]: The topics provided by the generator. |
__init__
Initialize the BaseGenerator class.
Source code in desdeo/emo/operators/generator.py
do
abstractmethod
Generate the initial population.
This method should be implemented by the inherited classes.
Returns:
| Type | Description |
|---|---|
tuple[DataFrame, DataFrame]
|
tuple[pl.DataFrame, pl.DataFrame]: The initial population as the first element, the corresponding objectives, the constraint violations, and the targets as the second element. |
Source code in desdeo/emo/operators/generator.py
state
Return the state of the generator.
This method should be implemented by the inherited classes.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Sequence[Message]
|
The state of the generator. |
Source code in desdeo/emo/operators/generator.py
LHSGenerator
Bases: BaseGenerator
Class for generating Latin Hypercube Sampling (LHS) initial population for the MOEAs.
This class generates the initial population by using the Latin Hypercube Sampling (LHS) method. If the seed is not provided, the seed is set to 0.
Source code in desdeo/emo/operators/generator.py
__init__
__init__(
problem: Problem,
evaluator: EMOEvaluator,
n_points: int,
seed: int,
verbosity: int,
publisher: Publisher,
)
Initialize the LHSGenerator class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
The problem to solve. |
required |
evaluator
|
BaseEvaluator
|
The evaluator to evaluate the population. |
required |
n_points
|
int
|
The number of points to generate for the initial population. |
required |
seed
|
int
|
The seed for the random number generator. |
required |
verbosity
|
int
|
The verbosity level of the generator. A verbosity of 2 is needed if you want to maintain an external archive. Otherwise, a verbosity of 1 is sufficient. |
required |
publisher
|
Publisher
|
The publisher to publish the messages. |
required |
Source code in desdeo/emo/operators/generator.py
do
Generate the initial population.
This method should be implemented by the inherited classes.
Returns:
| Type | Description |
|---|---|
tuple[DataFrame, DataFrame]
|
tuple[pl.DataFrame, pl.DataFrame]: The initial population as the first element, the corresponding objectives, the constraint violations, and the targets as the second element. |
Source code in desdeo/emo/operators/generator.py
RandomBinaryGenerator
Bases: BaseGenerator
Class for generating random initial population for problems with binary variables.
This class generates an initial population by randomly setting variable values to be either 0 or 1.
Source code in desdeo/emo/operators/generator.py
__init__
__init__(
problem: Problem,
evaluator: EMOEvaluator,
n_points: int,
seed: int,
verbosity: int,
publisher: Publisher,
)
Initialize the RandomBinaryGenerator class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
The problem to solve. |
required |
evaluator
|
BaseEvaluator
|
The evaluator to evaluate the population. |
required |
n_points
|
int
|
The number of points to generate for the initial population. |
required |
seed
|
int
|
The seed for the random number generator. |
required |
verbosity
|
int
|
The verbosity level of the generator. A verbosity of 2 is needed if you want to maintain an external archive. Otherwise, a verbosity of 1 is sufficient. |
required |
publisher
|
Publisher
|
The publisher to publish the messages. |
required |
Source code in desdeo/emo/operators/generator.py
do
Generate the initial population.
Returns:
| Type | Description |
|---|---|
tuple[DataFrame, DataFrame]
|
tuple[pl.DataFrame, pl.DataFrame]: The initial population as the first element, the corresponding objectives, the constraint violations, and the targets as the second element. |
Source code in desdeo/emo/operators/generator.py
RandomGenerator
Bases: BaseGenerator
Class for generating random initial population for the evolutionary optimization algorithms.
This class generates the initial population by randomly sampling the points from the variable bounds. The distribution of the points is uniform. If the seed is not provided, the seed is set to 0.
Source code in desdeo/emo/operators/generator.py
__init__
__init__(
problem: Problem,
evaluator: EMOEvaluator,
n_points: int,
seed: int,
verbosity: int,
publisher: Publisher,
)
Initialize the RandomGenerator class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
The problem to solve. |
required |
evaluator
|
BaseEvaluator
|
The evaluator to evaluate the population. |
required |
n_points
|
int
|
The number of points to generate for the initial population. |
required |
seed
|
int
|
The seed for the random number generator. |
required |
verbosity
|
int
|
The verbosity level of the generator. A verbosity of 2 is needed if you want to maintain an external archive. Otherwise, a verbosity of 1 is sufficient. |
required |
publisher
|
Publisher
|
The publisher to publish the messages. |
required |
Source code in desdeo/emo/operators/generator.py
do
Generate the initial population.
This method should be implemented by the inherited classes.
Returns:
| Type | Description |
|---|---|
tuple[DataFrame, DataFrame]
|
tuple[pl.DataFrame, pl.DataFrame]: The initial population as the first element, the corresponding objectives, the constraint violations, and the targets as the second element. |
Source code in desdeo/emo/operators/generator.py
RandomIntegerGenerator
Bases: BaseGenerator
Class for generating random initial population for problems with integer variables.
This class generates an initial population by randomly setting variable values to be integers between the bounds of the variables.
Source code in desdeo/emo/operators/generator.py
__init__
__init__(
problem: Problem,
evaluator: EMOEvaluator,
n_points: int,
seed: int,
verbosity: int,
publisher: Publisher,
)
Initialize the RandomIntegerGenerator class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
The problem to solve. |
required |
evaluator
|
BaseEvaluator
|
The evaluator to evaluate the population. |
required |
n_points
|
int
|
The number of points to generate for the initial population. |
required |
seed
|
int
|
The seed for the random number generator. |
required |
verbosity
|
int
|
The verbosity level of the generator. A verbosity of 2 is needed if you want to maintain an external archive. Otherwise, a verbosity of 1 is sufficient. |
required |
publisher
|
Publisher
|
The publisher to publish the messages. |
required |
Source code in desdeo/emo/operators/generator.py
do
Generate the initial population.
Returns:
| Type | Description |
|---|---|
tuple[DataFrame, DataFrame]
|
tuple[pl.DataFrame, pl.DataFrame]: The initial population as the first element, the corresponding objectives, the constraint violations, and the targets as the second element. |
Source code in desdeo/emo/operators/generator.py
RandomMixedIntegerGenerator
Bases: BaseGenerator
Class for generating random initial population for problems with mixed-integer variables.
This class generates an initial population by randomly setting variable values to be integers or floats between the bounds of the variables.
Source code in desdeo/emo/operators/generator.py
__init__
__init__(
problem: Problem,
evaluator: EMOEvaluator,
n_points: int,
seed: int,
verbosity: int,
publisher: Publisher,
)
Initialize the RandomMixedIntegerGenerator class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
The problem to solve. |
required |
evaluator
|
BaseEvaluator
|
The evaluator to evaluate the population. |
required |
n_points
|
int
|
The number of points to generate for the initial population. |
required |
seed
|
int
|
The seed for the random number generator. |
required |
verbosity
|
int
|
The verbosity level of the generator. A verbosity of 2 is needed if you want to maintain an external archive. Otherwise, a verbosity of 1 is sufficient. |
required |
publisher
|
Publisher
|
The publisher to publish the messages. |
required |
Source code in desdeo/emo/operators/generator.py
do
Generate the initial population.
Returns:
| Type | Description |
|---|---|
tuple[DataFrame, DataFrame]
|
tuple[pl.DataFrame, pl.DataFrame]: The initial population as the first element, the corresponding objectives, the constraint violations, and the targets as the second element. |
Source code in desdeo/emo/operators/generator.py
SeededHybridGenerator
Bases: BaseGenerator
Generates an initial population using a mix of seeded, perturbed, and random solutions.
Source code in desdeo/emo/operators/generator.py
463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 | |
__init__
__init__(
problem,
evaluator,
publisher,
verbosity,
seed: int,
n_points: int,
seed_solution: DataFrame,
perturb_fraction: float = 0.2,
sigma: float = 0.02,
flip_prob: float = 0.1,
)
Initialize the seeded hybrid generator.
The generator always includes the provided seed solution in the initial population, fills a fraction of the population with small perturbations around the seed, and fills the remainder with randomly generated solutions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
The optimization problem. |
required |
evaluator
|
EMOEvaluator
|
Evaluator used to compute objectives and constraints. |
required |
publisher
|
Publisher
|
Publisher used for emitting generator messages. |
required |
verbosity
|
int
|
Verbosity level of the generator. |
required |
seed
|
int
|
Seed used for random number generation. |
required |
n_points
|
int
|
Total size of the initial population. |
required |
seed_solution
|
DataFrame
|
A single-row DataFrame containing a seed decision variable vector. |
required |
perturb_fraction
|
float
|
Fraction of the population generated by perturbing the seed solution. Defaults to 0.2. |
0.2
|
sigma
|
float
|
Relative perturbation scale with respect to variable ranges. Defaults to 0.02. |
0.02
|
flip_prob
|
float
|
Probability of flipping a binary variable when perturbing the seed. Defaults to 0.1. |
0.1
|
Raises:
| Type | Description |
|---|---|
TypeError
|
If |
ValueError
|
If |
ValueError
|
If |
ValueError
|
If |
ValueError
|
If |
ValueError
|
If |
ValueError
|
If |
Source code in desdeo/emo/operators/generator.py
do
Generate a population.
Returns:
| Type | Description |
|---|---|
tuple[DataFrame, DataFrame]
|
tuple[pl.DataFrame, pl.DataFrame]: the population. |
Source code in desdeo/emo/operators/generator.py
Evaluator
desdeo.emo.operators.evaluator
Classes for evaluating the objectives and constraints of the individuals in the population.
EMOEvaluator
Bases: Subscriber
Base class for evaluating the objectives and constraints of the individuals in the population.
This class should be inherited by the classes that implement the evaluation of the objectives and constraints of the individuals in the population.
Source code in desdeo/emo/operators/evaluator.py
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 | |
provided_topics
property
The topics provided by the Evaluator.
__init__
Initialize the EMOEvaluator class.
Source code in desdeo/emo/operators/evaluator.py
evaluate
Evaluate and return the objectives.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
population
|
Dataframe
|
The set of decision variables to evaluate. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.Dataframe: A dataframe of objective vectors, target vectors, and constraint vectors. |
Source code in desdeo/emo/operators/evaluator.py
state
The state of the evaluator sent to the Publisher.
Source code in desdeo/emo/operators/evaluator.py
Crossover operators
desdeo.emo.operators.crossover
Evolutionary operators for recombination.
Various evolutionary operators for recombination in multiobjective optimization are defined here.
BaseCrossover
Bases: Subscriber
A base class for crossover operators.
Source code in desdeo/emo/operators/crossover.py
__init__
Initialize a crossover operator.
Source code in desdeo/emo/operators/crossover.py
do
abstractmethod
Perform the crossover operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
population
|
DataFrame
|
the population to perform the crossover with. The DataFrame contains the decision vectors, the target vectors, and the constraint vectors. |
required |
to_mate
|
list[int] | None
|
the indices of the population members that should
participate in the crossover. If |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: the offspring resulting from the crossover. |
Source code in desdeo/emo/operators/crossover.py
BlendAlphaCrossover
Bases: BaseCrossover
Blend-alpha (BLX-alpha) crossover for continuous problems.
Source code in desdeo/emo/operators/crossover.py
618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 | |
interested_topics
property
The message topics provided by the blend alpha crossover operator.
provided_topics
property
The message topics provided by the blend alpha crossover operator.
__init__
__init__(
*,
problem: Problem,
verbosity: int,
publisher: Publisher,
seed: int,
alpha: float = 0.5,
xover_probability: float = 1.0,
)
Initialize the blend alpha crossover operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
the problem object. |
required |
verbosity
|
int
|
the verbosity level of the component. The keys in |
required |
publisher
|
Publisher
|
the publisher to which the operator will publish messages. |
required |
seed
|
int
|
the seed used in the random number generator for choosing the crossover point. |
required |
alpha
|
float
|
non-negative blending factor 'alpha' that controls the extent to which offspring may be sampled outside the interval defined by each pair of parent genes. alpha = 0 restricts children strictly within the parents range, larger alpha allows some outliers. Defaults to 0.5. |
0.5
|
xover_probability
|
float
|
the crossover probability parameter. Ranges between 0 and 1.0. Defaults to 1.0. |
1.0
|
Source code in desdeo/emo/operators/crossover.py
do
Perform BLX-alpha crossover.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
population
|
DataFrame
|
the population to perform the crossover with. The DataFrame contains the decision vectors, the target vectors, and the constraint vectors. |
required |
to_mate
|
list[int] | None
|
the indices of the population members that should
participate in the crossover. If |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: the offspring resulting from the crossover. |
Source code in desdeo/emo/operators/crossover.py
state
Return the state of the blend-alpha crossover operator.
Source code in desdeo/emo/operators/crossover.py
BoundedExponentialCrossover
Bases: BaseCrossover
Bounded‐exponential (BEX) crossover for continuous problems.
Source code in desdeo/emo/operators/crossover.py
1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
interested_topics
property
The message topics provided by the bounded exponential crossover operator.
provided_topics
property
The message topics provided by the bounded exponential crossover operator.
__init__
__init__(
*,
problem: Problem,
verbosity: int,
publisher: Publisher,
seed: int,
lambda_: float = 1.0,
xover_probability: float = 1.0,
)
Initialize the bounded‐exponential crossover operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
the problem object. |
required |
verbosity
|
int
|
the verbosity level of the component. The keys in |
required |
publisher
|
Publisher
|
the publisher to which the operator will publish messages. |
required |
seed
|
int
|
random seed for the internal generator. |
required |
lambda_
|
float
|
positive scale λ for the exponential distribution. Defaults to 1.0. |
1.0
|
xover_probability
|
float
|
probability of applying crossover to each pair. Defaults to 1.0. |
1.0
|
Source code in desdeo/emo/operators/crossover.py
do
Perform bounded‐exponential crossover.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
population
|
DataFrame
|
the population to perform the crossover with. The DataFrame contains the decision vectors, the target vectors, and the constraint vectors. |
required |
to_mate
|
list[int] | None
|
the indices of the population members that should
participate in the crossover. If |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: the offspring resulting from the crossover. |
Source code in desdeo/emo/operators/crossover.py
1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 | |
state
Return the state of the crossover operator.
Source code in desdeo/emo/operators/crossover.py
LocalCrossover
Bases: BaseCrossover
Local Crossover for continuous problems.
Source code in desdeo/emo/operators/crossover.py
956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 | |
interested_topics
property
The message topics that the local crossover operator is interested in.
provided_topics
property
The message topics provided by the local crossover operator.
__init__
__init__(
problem: Problem,
verbosity: int,
publisher: Publisher,
seed: int,
xover_probability: float = 1.0,
)
Initialize the local crossover operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
the problem object. |
required |
verbosity
|
int
|
the verbosity level of the component. The keys in |
required |
publisher
|
Publisher
|
the publisher to which the operator will publish messages. |
required |
xover_probability
|
float
|
probability of performing crossover. |
1.0
|
seed
|
int
|
random seed for reproducibility. |
required |
Source code in desdeo/emo/operators/crossover.py
do
Perform Local Crossover.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
population
|
DataFrame
|
the population to perform the crossover with. The DataFrame contains the decision vectors, the target vectors, and the constraint vectors. |
required |
to_mate
|
list[int] | None
|
the indices of the population members that should
participate in the crossover. If |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: the offspring resulting from the crossover. |
Source code in desdeo/emo/operators/crossover.py
state
Return the state of the local crossover operator.
Source code in desdeo/emo/operators/crossover.py
SimulatedBinaryCrossover
Bases: BaseCrossover
A class for creating a simulated binary crossover operator.
Reference
Kalyanmoy Deb and Ram Bhushan Agrawal. 1995. Simulated binary crossover for continuous search space. Complex Systems 9, 2 (1995), 115-148.
Source code in desdeo/emo/operators/crossover.py
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 | |
interested_topics
property
The message topics the crossover operator is interested in.
provided_topics
property
The message topics provided by the crossover operator.
__init__
__init__(
*,
problem: Problem,
seed: int,
verbosity: int,
publisher: Publisher,
xover_probability: float = 1.0,
xover_distribution: float = 30,
)
Initialize a simulated binary crossover operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
the problem object. |
required |
seed
|
int
|
the seed for the random number generator. |
required |
verbosity
|
int
|
the verbosity level of the component. The keys in |
required |
publisher
|
Publisher
|
the publisher to which the operator will publish messages. |
required |
xover_probability
|
float
|
the crossover probability parameter. Ranges between 0 and 1.0. Defaults to 1.0. |
1.0
|
xover_distribution
|
float
|
the crossover distribution parameter. Must be positive. Defaults to 30. |
30
|
Source code in desdeo/emo/operators/crossover.py
do
Perform the simulated binary crossover operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
population
|
DataFrame
|
the population to perform the crossover with. The DataFrame contains the decision vectors, the target vectors, and the constraint vectors. |
required |
to_mate
|
list[int] | None
|
the indices of the population members that should
participate in the crossover. If |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: the offspring resulting from the crossover. |
Source code in desdeo/emo/operators/crossover.py
state
Return the state of the crossover operator.
Source code in desdeo/emo/operators/crossover.py
SingleArithmeticCrossover
Bases: BaseCrossover
Single Arithmetic Crossover for continuous problems.
Source code in desdeo/emo/operators/crossover.py
794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 | |
interested_topics
property
The message topics that the single arithmetic crossover operator is interested in.
provided_topics
property
The message topics provided by the single arithmetic crossover operator.
__init__
__init__(
problem: Problem,
verbosity: int,
publisher: Publisher,
seed: int,
xover_probability: float = 1.0,
)
Initialize the single arithmetic crossover operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
the problem object. |
required |
verbosity
|
int
|
the verbosity level of the component. The keys in |
required |
publisher
|
Publisher
|
the publisher to which the operator will publish messages. |
required |
xover_probability
|
float
|
probability of performing crossover. |
1.0
|
seed
|
int
|
random seed for reproducibility. |
required |
Source code in desdeo/emo/operators/crossover.py
do
Perform Single Arithmetic Crossover.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
population
|
DataFrame
|
the population to perform the crossover with. The DataFrame contains the decision vectors, the target vectors, and the constraint vectors. |
required |
to_mate
|
list[int] | None
|
the indices of the population members that should
participate in the crossover. If |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: the offspring resulting from the crossover. |
Source code in desdeo/emo/operators/crossover.py
state
Return the state of the single arithmetic crossover operator.
Source code in desdeo/emo/operators/crossover.py
SinglePointBinaryCrossover
Bases: BaseCrossover
A class that defines the single point binary crossover operation.
Source code in desdeo/emo/operators/crossover.py
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 | |
interested_topics
property
The message topics the single point binary crossover operator is interested in.
provided_topics
property
The message topics provided by the single point binary crossover operator.
__init__
Initialize the single point binary crossover operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
the problem object. |
required |
seed
|
int
|
the seed used in the random number generator for choosing the crossover point. |
required |
verbosity
|
int
|
the verbosity level of the component. The keys in |
required |
publisher
|
Publisher
|
the publisher to which the operator will publish messages. |
required |
Source code in desdeo/emo/operators/crossover.py
do
Perform single point binary crossover.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
population
|
DataFrame
|
the population to perform the crossover with. |
required |
to_mate
|
list[int] | None
|
indices. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: the offspring from the crossover. |
Source code in desdeo/emo/operators/crossover.py
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 | |
state
Return the state of the single ponit binary crossover operator.
Source code in desdeo/emo/operators/crossover.py
UniformIntegerCrossover
Bases: BaseCrossover
A class that defines the uniform integer crossover operation.
Source code in desdeo/emo/operators/crossover.py
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 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | |
interested_topics
property
The message topics the single point binary crossover operator is interested in.
provided_topics
property
The message topics provided by the single point binary crossover operator.
__init__
Initialize the uniform integer crossover operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
the problem object. |
required |
seed
|
int
|
the seed used in the random number generator for choosing the crossover point. |
required |
verbosity
|
int
|
the verbosity level of the component. The keys in |
required |
publisher
|
Publisher
|
the publisher to which the operator will publish messages. |
required |
Source code in desdeo/emo/operators/crossover.py
do
Perform single point binary crossover.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
population
|
DataFrame
|
the population to perform the crossover with. |
required |
to_mate
|
list[int] | None
|
indices. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: the offspring from the crossover. |
Source code in desdeo/emo/operators/crossover.py
state
Return the state of the single ponit binary crossover operator.
Source code in desdeo/emo/operators/crossover.py
UniformMixedIntegerCrossover
Bases: BaseCrossover
A class that defines the uniform mixed-integer crossover operation.
TODO: This is virtually identical to UniformIntegerCrossover. The only
difference is that the parent_decision_vars in do are not casted to
int. This is not an ideal way to implement crossover for mixed-integer
stuff...
Source code in desdeo/emo/operators/crossover.py
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | |
interested_topics
property
The message topics the single point binary crossover operator is interested in.
provided_topics
property
The message topics provided by the single point binary crossover operator.
__init__
Initialize the uniform integer crossover operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
the problem object. |
required |
seed
|
int
|
the seed used in the random number generator for choosing the crossover point. |
required |
verbosity
|
int
|
the verbosity level of the component. The keys in |
required |
publisher
|
Publisher
|
the publisher to which the operator will publish messages. |
required |
Source code in desdeo/emo/operators/crossover.py
do
Perform single point binary crossover.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
population
|
DataFrame
|
the population to perform the crossover with. |
required |
to_mate
|
list[int] | None
|
indices. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: the offspring from the crossover. |
Source code in desdeo/emo/operators/crossover.py
state
Return the state of the single point binary crossover operator.
Source code in desdeo/emo/operators/crossover.py
Mutation operators
desdeo.emo.operators.mutation
Evolutionary operators for mutation.
Various evolutionary operators for mutation in multiobjective optimization are defined here.
BaseMutation
Bases: Subscriber
A base class for mutation operators.
Source code in desdeo/emo/operators/mutation.py
__init__
abstractmethod
Initialize a mutation operator.
Source code in desdeo/emo/operators/mutation.py
do
abstractmethod
Perform the mutation operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
offsprings
|
DataFrame
|
the offspring population to mutate. |
required |
parents
|
DataFrame
|
the parent population from which the offspring was generated (via crossover). |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: the offspring resulting from the mutation. |
Source code in desdeo/emo/operators/mutation.py
BinaryFlipMutation
Bases: BaseMutation
Implements the bit flip mutation operator for binary variables.
The binary flip mutation will mutate each binary decision variable, by flipping it (0 to 1, 1 to 0) with a provided probability.
Source code in desdeo/emo/operators/mutation.py
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 | |
interested_topics
property
The message topics that the mutation operator is interested in.
provided_topics
property
The message topics provided by the mutation operator.
__init__
__init__(
*,
problem: Problem,
seed: int,
verbosity: int,
publisher: Publisher,
mutation_probability: float | None = None,
)
Initialize a binary flip mutation operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
The problem object. |
required |
seed
|
int
|
The seed for the random number generator. |
required |
mutation_probability
|
float | None
|
The probability of mutation. If None, the probability will be set to be 1/n, where n is the number of decision variables in the problem. Defaults to None. |
None
|
verbosity
|
int
|
The verbosity level of the operator. See the |
required |
publisher
|
Publisher
|
The publisher to which the operator will send messages. |
required |
Source code in desdeo/emo/operators/mutation.py
do
Perform the binary flip mutation operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
offsprings
|
DataFrame
|
the offspring population to mutate. |
required |
parents
|
DataFrame
|
the parent population from which the offspring was generated (via crossover). Not used in the mutation operator. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: the offspring resulting from the mutation. |
Source code in desdeo/emo/operators/mutation.py
state
Return the state of the mutation operator.
Source code in desdeo/emo/operators/mutation.py
BoundedPolynomialMutation
Bases: BaseMutation
Implements the bounded polynomial mutation operator.
Reference
Deb, K., & Goyal, M. (1996). A combined genetic adaptive search (GeneAS) for engineering design. Computer Science and informatics, 26(4), 30-45, 1996.
Source code in desdeo/emo/operators/mutation.py
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 | |
interested_topics
property
The message topics that the mutation operator is interested in.
provided_topics
property
The message topics provided by the mutation operator.
__init__
__init__(
*,
problem: Problem,
seed: int,
verbosity: int,
publisher: Publisher,
mutation_probability: float | None = None,
distribution_index: float = 20,
)
Initialize a bounded polynomial mutation operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
The problem object. |
required |
seed
|
int
|
The seed for the random number generator. |
required |
verbosity
|
int
|
The verbosity level of the operator. See the |
required |
publisher
|
Publisher
|
The publisher to which the operator will send messages. |
required |
mutation_probability
|
float | None
|
The probability of mutation. Defaults to None. |
None
|
distribution_index
|
float
|
The distribution index for polynomial mutation. Defaults to 20. |
20
|
Source code in desdeo/emo/operators/mutation.py
do
Perform the mutation operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
offsprings
|
DataFrame
|
the offspring population to mutate. |
required |
parents
|
DataFrame
|
the parent population from which the offspring was generated (via crossover). |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: the offspring resulting from the mutation. |
Source code in desdeo/emo/operators/mutation.py
state
Return the state of the mutation operator.
Source code in desdeo/emo/operators/mutation.py
IntegerRandomMutation
Bases: BaseMutation
Implements a random mutation operator for integer variables.
The mutation will mutate each binary integer variable, by changing its value to a random value bounded by the variable's bounds with a provided probability.
Source code in desdeo/emo/operators/mutation.py
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 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 | |
interested_topics
property
The message topics that the mutation operator is interested in.
provided_topics
property
The message topics provided by the mutation operator.
__init__
__init__(
*,
problem: Problem,
seed: int,
verbosity: int,
publisher: Publisher,
mutation_probability: float | None = None,
)
Initialize a random integer mutation operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
The problem object. |
required |
seed
|
int
|
The seed for the random number generator. |
required |
mutation_probability
|
float | None
|
The probability of mutation. If None, the probability will be set to be 1/n, where n is the number of decision variables in the problem. Defaults to None. |
None
|
verbosity
|
int
|
The verbosity level of the operator. See the |
required |
publisher
|
Publisher
|
The publisher to which the operator will send messages. |
required |
Source code in desdeo/emo/operators/mutation.py
do
Perform the random integer mutation operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
offsprings
|
DataFrame
|
the offspring population to mutate. |
required |
parents
|
DataFrame
|
the parent population from which the offspring was generated (via crossover). Not used in the mutation operator. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: the offspring resulting from the mutation. |
Source code in desdeo/emo/operators/mutation.py
state
Return the state of the mutation operator.
Source code in desdeo/emo/operators/mutation.py
MPTMutation
Bases: BaseMutation
Makinen, Periaux and Toivanen (MTP) mutation.
Applies small mutations to mixed-integer variables using a mutation exponent strategy.
Source code in desdeo/emo/operators/mutation.py
632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 | |
interested_topics
property
The message topics that the mutation operator is interested in.
provided_topics
property
The message topics provided by the mutation operator.
__init__
__init__(
*,
problem: Problem,
seed: int,
verbosity: int,
publisher: Publisher,
mutation_probability: float | None = None,
mutation_exponent: float = 2.0,
)
Initialize a small mutation operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
Optimization problem. |
required |
seed
|
int
|
RNG seed. |
required |
mutation_probability
|
float | None
|
Probability of mutation per gene. |
None
|
mutation_exponent
|
float
|
Controls strength of small mutation (larger means smaller mutations). |
2.0
|
verbosity
|
int
|
The verbosity level of the operator. See the |
required |
publisher
|
Publisher
|
The publisher to which the operator will send messages. publisher must be passed. See the Subscriber class for more information. |
required |
Source code in desdeo/emo/operators/mutation.py
_mutate_value
Apply small mutation to a single float value using mutation exponent.
Source code in desdeo/emo/operators/mutation.py
do
Perform the MPT mutation operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
offsprings
|
DataFrame
|
the offspring population to mutate. |
required |
parents
|
DataFrame
|
the parent population from which the offspring was generated (via crossover). Not used in the mutation operator. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: the offspring resulting from the mutation. |
Source code in desdeo/emo/operators/mutation.py
state
Return the state of the mutation operator.
Source code in desdeo/emo/operators/mutation.py
MixedIntegerRandomMutation
Bases: BaseMutation
Implements a random mutation operator for mixed-integer variables.
The mutation will mutate each mixed-integer variable, by changing its value to a random value bounded by the variable's bounds with a provided probability.
Source code in desdeo/emo/operators/mutation.py
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 | |
interested_topics
property
The message topics that the mutation operator is interested in.
provided_topics
property
The message topics provided by the mutation operator.
__init__
__init__(
*,
problem: Problem,
seed: int,
verbosity: int,
publisher: Publisher,
mutation_probability: float | None = None,
)
Initialize a random mixed_integer mutation operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
The problem object. |
required |
seed
|
int
|
The seed for the random number generator. |
required |
mutation_probability
|
float | None
|
The probability of mutation. If None, the probability will be set to be 1/n, where n is the number of decision variables in the problem. Defaults to None. |
None
|
verbosity
|
int
|
The verbosity level of the operator. See the |
required |
publisher
|
Publisher
|
The publisher to which the operator will send messages. |
required |
Source code in desdeo/emo/operators/mutation.py
do
Perform the random integer mutation operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
offsprings
|
DataFrame
|
the offspring population to mutate. |
required |
parents
|
DataFrame
|
the parent population from which the offspring was generated (via crossover). Not used in the mutation operator. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: the offspring resulting from the mutation. |
Source code in desdeo/emo/operators/mutation.py
state
Return the state of the mutation operator.
Source code in desdeo/emo/operators/mutation.py
NonUniformMutation
Bases: BaseMutation
Non-uniform mutation operator.
The mutation strength decays over generations.
Source code in desdeo/emo/operators/mutation.py
775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 | |
interested_topics
property
The message topics that the mutation operator is interested in.
provided_topics
property
The message topics provided by the mutation operator.
__init__
__init__(
*,
problem: Problem,
seed: int,
max_generations: int,
verbosity: int,
publisher: Publisher,
mutation_probability: float | None = None,
b: float = 5.0,
)
Initialize a Non-uniform mutation operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
The optimization problem definition. |
required |
seed
|
int
|
Random number generator seed for reproducibility. |
required |
mutation_probability
|
float | None
|
Probability of mutating each gene. If None, defaults to 1 / number of variables. |
None
|
b
|
float
|
Non-uniform mutation decay parameter. Higher values cause faster reduction in mutation strength over generations. |
5.0
|
max_generations
|
int
|
Maximum number of generations in the evolutionary run. Used to scale mutation decay. |
required |
verbosity
|
int
|
The verbosity level of the operator. See the |
required |
publisher
|
Publisher
|
The publisher to which the operator will send messages. |
required |
Source code in desdeo/emo/operators/mutation.py
_mutate_value
_mutate_value(
x: float,
lower_bound: float,
upper_bound: float,
mutation_threshold: float = 0.5,
) -> float
Apply non-uniform mutation to a single float value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
The current value of the gene to be mutated. |
required |
lower_bound
|
float
|
The lower bound of the gene. |
required |
upper_bound
|
float
|
The upper bound of the gene. |
required |
mutation_threshold
|
float
|
The mutation threshold. Defaults to 0.5. |
0.5
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The mutated gene value, clipped within the bounds [l, u]. |
Source code in desdeo/emo/operators/mutation.py
do
Perform non-uniform mutation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
offsprings
|
DataFrame
|
The current offspring population to mutate. Each row corresponds to one individual. |
required |
parents
|
DataFrame
|
The parent population (not used in mutation but passed for interface consistency). |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: A new offspring population with mutated values applied. Returned as a Polars DataFrame. |
Source code in desdeo/emo/operators/mutation.py
state
Return state messages.
Source code in desdeo/emo/operators/mutation.py
update
Update current generation (used to reduce mutation strength over time).
Source code in desdeo/emo/operators/mutation.py
PowerMutation
Bases: BaseMutation
Implements the Power Mutation (PM) operator for real and integer variables.
Source code in desdeo/emo/operators/mutation.py
1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 | |
interested_topics
property
The message topics that the mutation operator listens to (none in this case).
provided_topics
property
The message topics provided by the mutation operator.
__init__
__init__(
*,
problem: Problem,
seed: int,
verbosity: int,
publisher: Publisher,
p: float = 1.5,
mutation_probability: float | None = None,
)
Initialize the PowerMutation operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
The problem definition containing variable bounds and types. |
required |
seed
|
int
|
Random seed for reproducibility. |
required |
p
|
float
|
Power distribution parameter. Controls the perturbation magnitude. Default is 1.5. |
1.5
|
mutation_probability
|
float | None
|
Per-variable mutation probability. Defaults to 1/n. |
None
|
verbosity
|
int
|
The verbosity level of the operator. See the |
required |
publisher
|
Publisher
|
The publisher to which the operator will send messages. |
required |
Source code in desdeo/emo/operators/mutation.py
do
Apply Power Mutation to the given offspring population.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
offsprings
|
DataFrame
|
The offspring population to mutate. |
required |
parents
|
DataFrame
|
The parent population |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: Mutated offspring population. |
Source code in desdeo/emo/operators/mutation.py
state
Return mutation-related state messages based on verbosity level.
Returns:
| Type | Description |
|---|---|
Sequence[Message]
|
List of messages reporting mutation probability, input, and output (at higher verbosity). |
Source code in desdeo/emo/operators/mutation.py
SelfAdaptiveGaussianMutation
Bases: BaseMutation
Self-adaptive Gaussian mutation for real-coded evolutionary algorithms.
Evolves both solution vector and mutation step sizes (strategy parameters).
Source code in desdeo/emo/operators/mutation.py
919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 | |
interested_topics
property
The message topics that the mutation operator is interested in.
provided_topics
property
The message topics provided by the mutation operator.
__init__
__init__(
*,
problem: Problem,
seed: int,
verbosity: int,
publisher: Publisher,
mutation_probability: float | None = None,
)
Initialize the self-adaptive Gaussian mutation operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
The optimization problem definition, including variable bounds and types. |
required |
seed
|
int
|
Seed for the random number generator to ensure reproducibility. |
required |
mutation_probability
|
float | None
|
Probability of mutating each gene. If None, it defaults to 1 divided by the number of variables. |
None
|
verbosity
|
int
|
The verbosity level of the operator. See the |
required |
publisher
|
Publisher
|
The publisher to which the operator will send messages. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
rng |
Generator
|
NumPy random number generator initialized with the given seed. |
seed |
int
|
The seed used for reproducibility. |
num_vars |
int
|
Number of variables in the problem. |
mutation_probability |
float
|
Probability of mutating each gene. |
tau_prime |
float
|
Global learning rate, used in step size adaptation. |
tau |
float
|
Local learning rate, used in step size adaptation. |
Source code in desdeo/emo/operators/mutation.py
_mutation
Perform the self-adaptive mutation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
variables
|
ndarray
|
Current offspring population as a NumPy array. |
required |
eta
|
ndarray
|
Current step sizes for mutation. |
required |
Returns:
| Type | Description |
|---|---|
tuple[ndarray, ndarray]
|
tuple[np.ndarray, np.ndarray]: Mutated population and updated step sizes. |
Source code in desdeo/emo/operators/mutation.py
do
do(
offsprings: DataFrame,
parents: DataFrame,
step_sizes: ndarray | None = None,
) -> tuple[pl.DataFrame, np.ndarray]
Apply self-adaptive Gaussian mutation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
offsprings
|
DataFrame
|
Current offspring population. |
required |
parents
|
DataFrame
|
Parent population. |
required |
step_sizes
|
ndarray | None
|
Step sizes for each gene of each individual. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
tuple[DataFrame, ndarray]
|
|
Source code in desdeo/emo/operators/mutation.py
state
Return the state of the mutation operator.
Source code in desdeo/emo/operators/mutation.py
Selection operators
desdeo.emo.operators.selection
The base class for selection operators.
Some operators should be rewritten. TODO:@light-weaver
BaseDecompositionSelector
Bases: BaseSelector
Base class for decomposition based selection operators.
Source code in desdeo/emo/operators/selection.py
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 | |
_create_simplex
Create the reference vectors using simplex lattice design.
Source code in desdeo/emo/operators/selection.py
_normalize_rvs
Normalize the reference vectors to a unit hypersphere.
Source code in desdeo/emo/operators/selection.py
add_edge_vectors
Add edge vectors to the list of reference vectors.
Used to cover the entire orthant when preference information is provided.
Source code in desdeo/emo/operators/selection.py
interactive_adapt_1
Adapt reference vectors using the information about prefererred solution(s) selected by the Decision maker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
ndarray
|
Preferred solution(s). |
required |
translation_param
|
float
|
Parameter determining how close the reference vectors are to the central vector v defined by using the selected solution(s) z. |
required |
Source code in desdeo/emo/operators/selection.py
interactive_adapt_2
Adapt reference vectors by using the information about non-preferred solution(s) selected by the Decision maker.
After the Decision maker has specified non-preferred solution(s), Euclidian distance between normalized solution vector(s) and each of the reference vectors are calculated. Those reference vectors that are closer than a predefined distance are either removed or re-positioned somewhere else.
Note
At the moment, only the removal of reference vectors is supported. Repositioning of the reference vectors is not supported.
Note
In case the Decision maker specifies multiple non-preferred solutions, the reference vector(s) for which the distance to any of the non-preferred solutions is less than predefined distance are removed.
Note
Future developer should implement a way for a user to say: "Remove some percentage of objecive space/reference vectors" rather than giving a predefined distance value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
ndarray
|
Non-preferred solution(s). |
required |
predefined_distance
|
float
|
The reference vectors that are closer than this distance are either removed or re-positioned somewhere else. Default value: 0.2 |
required |
ord
|
int
|
Order of the norm. Default is 2, i.e., Euclidian distance. |
required |
Source code in desdeo/emo/operators/selection.py
interactive_adapt_3
Adapt reference vectors linearly towards a reference point. Then normalize.
The details can be found in the following paper: Hakanen, Jussi & Chugh, Tinkle & Sindhya, Karthik & Jin, Yaochu & Miettinen, Kaisa. (2016). Connections of Reference Vectors and Different Types of Preference Information in Interactive Multiobjective Evolutionary Algorithms.
Parameters
ref_point :
translation_param
(Default value = 0.2)
Source code in desdeo/emo/operators/selection.py
interactive_adapt_4
Adapt reference vectors by using the information about the Decision maker's preferred range for each of the objective.
Using these ranges, Latin hypercube sampling is applied to generate m number of samples between within these ranges, where m is the number of reference vectors. Normalized vectors constructed of these samples are then set as new reference vectors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
preferred_ranges
|
ndarray
|
Preferred lower and upper bound for each of the objective function values. |
required |
Source code in desdeo/emo/operators/selection.py
BaseSelector
Bases: Subscriber
A base class for selection operators.
Source code in desdeo/emo/operators/selection.py
__init__
Initialize a selection operator.
Source code in desdeo/emo/operators/selection.py
do
abstractmethod
do(
parents: tuple[SolutionType, DataFrame],
offsprings: tuple[SolutionType, DataFrame],
) -> tuple[SolutionType, pl.DataFrame]
Perform the selection operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parents
|
tuple[SolutionType, DataFrame]
|
the decision variables as the first element. The second element is the objective values, targets, and constraint violations. |
required |
offsprings
|
tuple[SolutionType, DataFrame]
|
the decision variables as the first element. The second element is the objective values, targets, and constraint violations. |
required |
Returns:
| Type | Description |
|---|---|
tuple[SolutionType, DataFrame]
|
tuple[SolutionType, pl.DataFrame]: The selected decision variables and their objective values, targets, and constraint violations. |
Source code in desdeo/emo/operators/selection.py
IBEASelector
Bases: BaseSelector
The adaptive IBEA selection operator.
Reference: Zitzler, E., Künzli, S. (2004). Indicator-Based Selection in Multiobjective Search. In: Yao, X., et al. Parallel Problem Solving from Nature - PPSN VIII. PPSN 2004. Lecture Notes in Computer Science, vol 3242. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-30217-9_84
Source code in desdeo/emo/operators/selection.py
1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 | |
__init__
__init__(
problem: Problem,
verbosity: int,
publisher: Publisher,
population_size: int,
kappa: float = 0.05,
binary_indicator: Callable[
[ndarray], ndarray
] = self_epsilon,
seed: int = 0,
)
Initialize the IBEA selector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
The problem to solve. |
required |
verbosity
|
int
|
The verbosity level of the selector. |
required |
publisher
|
Publisher
|
The publisher to send messages to. |
required |
population_size
|
int
|
The size of the population to select. |
required |
kappa
|
float
|
The kappa value for the IBEA selection. Defaults to 0.05. |
0.05
|
binary_indicator
|
Callable[[ndarray], ndarray]
|
The binary indicator function to use. Defaults to self_epsilon with uses binary addaptive epsilon indicator. |
self_epsilon
|
Source code in desdeo/emo/operators/selection.py
do
do(
parents: tuple[SolutionType, DataFrame],
offsprings: tuple[SolutionType, DataFrame],
) -> tuple[SolutionType, pl.DataFrame]
Perform the selection operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parents
|
tuple[SolutionType, DataFrame]
|
the decision variables as the first element. The second element is the objective values, targets, and constraint violations. |
required |
offsprings
|
tuple[SolutionType, DataFrame]
|
the decision variables as the first element. The second element is the objective values, targets, and constraint violations. |
required |
Returns:
| Type | Description |
|---|---|
tuple[SolutionType, DataFrame]
|
tuple[SolutionType, pl.DataFrame]: The selected decision variables and their objective values, targets, and constraint violations. |
Source code in desdeo/emo/operators/selection.py
state
Return the state of the selector.
Source code in desdeo/emo/operators/selection.py
NSGA2Selector
Bases: BaseSelector
Implements the selection operator defined for NSGA2.
Implements the selection operator defined for NSGA2, which included the crowding distance calculation.
Deb, K., Pratap, A., Agarwal, S., & Meyarivan, T. A. M. T.
(2002). A fast and elitist multiobjective genetic algorithm: NSGA-II. IEEE transactions on evolutionary computation, 6(2), 182-197.
Source code in desdeo/emo/operators/selection.py
1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 | |
do
do(
parents: tuple[SolutionType, DataFrame],
offsprings: tuple[SolutionType, DataFrame],
) -> tuple[SolutionType, pl.DataFrame]
Perform the selection operation.
Source code in desdeo/emo/operators/selection.py
1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 | |
state
Return the state of the selector.
Source code in desdeo/emo/operators/selection.py
NSGA3Selector
Bases: BaseDecompositionSelector
The NSGA-III selection operator, heavily based on the version of nsga3 in the pymoo package by msu-coinlab.
Source code in desdeo/emo/operators/selection.py
848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 | |
__init__
__init__(
problem: Problem,
verbosity: int,
publisher: Publisher,
reference_vector_options: ReferenceVectorOptions
| None = None,
invert_reference_vectors: bool = False,
seed: int = 0,
)
Initialize the NSGA-III selection operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
The optimization problem to be solved. |
required |
verbosity
|
int
|
The verbosity level of the operator. |
required |
publisher
|
Publisher
|
The publisher to use for communication. |
required |
reference_vector_options
|
ReferenceVectorOptions | None
|
Options for the reference vectors. Defaults to None. |
None
|
invert_reference_vectors
|
bool
|
Whether to invert the reference vectors. Defaults to False. |
False
|
seed
|
int
|
The random seed to use. Defaults to 0. |
0
|
Source code in desdeo/emo/operators/selection.py
do
do(
parents: tuple[SolutionType, DataFrame],
offsprings: tuple[SolutionType, DataFrame],
) -> tuple[SolutionType, pl.DataFrame]
Perform the selection operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parents
|
tuple[SolutionType, DataFrame]
|
the decision variables as the first element. The second element is the objective values, targets, and constraint violations. |
required |
offsprings
|
tuple[SolutionType, DataFrame]
|
the decision variables as the first element. The second element is the objective values, targets, and constraint violations. |
required |
Returns:
| Type | Description |
|---|---|
tuple[SolutionType, DataFrame]
|
tuple[SolutionType, pl.DataFrame]: The selected decision variables and their objective values, targets, and constraint violations. |
Source code in desdeo/emo/operators/selection.py
914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 | |
get_extreme_points_c
Taken from pymoo
Source code in desdeo/emo/operators/selection.py
ParameterAdaptationStrategy
Bases: StrEnum
The parameter adaptation strategies for the RVEA selector.
Source code in desdeo/emo/operators/selection.py
RVEASelector
Bases: BaseDecompositionSelector
Source code in desdeo/emo/operators/selection.py
541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 | |
_partial_penalty_factor
Calculate and return the partial penalty factor for APD calculation.
This calculation does not include the angle related terms, hence the name.
If the calculated penalty is outside [0, 1], it will round it up/down to 0/1
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The partial penalty factor |
Source code in desdeo/emo/operators/selection.py
do
do(
parents: tuple[SolutionType, DataFrame],
offsprings: tuple[SolutionType, DataFrame],
) -> tuple[SolutionType, pl.DataFrame]
Perform the selection operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parents
|
tuple[SolutionType, DataFrame]
|
the decision variables as the first element. The second element is the objective values, targets, and constraint violations. |
required |
offsprings
|
tuple[SolutionType, DataFrame]
|
the decision variables as the first element. The second element is the objective values, targets, and constraint violations. |
required |
Returns:
| Type | Description |
|---|---|
tuple[SolutionType, DataFrame]
|
tuple[SolutionType, pl.DataFrame]: The selected decision variables and their objective values, targets, and constraint violations. |
Source code in desdeo/emo/operators/selection.py
616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 | |
update
Update the parameters of the RVEA APD calculation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
Message
|
The message to update the parameters. The message should be coming from the Terminator operator (via the Publisher). |
required |
Source code in desdeo/emo/operators/selection.py
ReferenceVectorOptions
Bases: BaseModel
Pydantic model for Reference Vector arguments.
Source code in desdeo/emo/operators/selection.py
adaptation_distance
class-attribute
instance-attribute
Distance parameter for the interactive adaptation methods. Defaults to 0.2.
adaptation_frequency
class-attribute
instance-attribute
Number of generations between reference vector adaptation. If set to 0, no adaptation occurs. Defaults to 0. Only used if no preference is provided.
creation_type
class-attribute
instance-attribute
The method for creating reference vectors. Defaults to "simplex". Currently only "simplex" is implemented. Future versions will include "s_energy".
If set to "simplex", the reference vectors are created using the simplex lattice design method. This method is generates distributions with specific numbers of reference vectors. Check: https://www.itl.nist.gov/div898/handbook/pri/section5/pri542.htm for more information. If set to "s_energy", the reference vectors are created using the Riesz s-energy criterion. This method is used to distribute an arbitrary number of reference vectors in the objective space while minimizing the s-energy. Currently not implemented.
lattice_resolution
class-attribute
instance-attribute
Number of divisions along an axis when creating the simplex lattice. This is not required/used for the "s_energy"
method. If not specified, the lattice resolution is calculated based on the number_of_vectors. If "spherical" is
selected as the vector_type, this value overrides the number_of_vectors.
non_preferred_solutions
class-attribute
instance-attribute
The non-preferred solutions for interactive adaptation.
number_of_vectors
class-attribute
instance-attribute
Number of reference vectors to be created. If "simplex" is selected as the creation_type, then the closest
lattice_resolution is calculated based on this value. If "s_energy" is selected, then this value is used directly.
Note that if neither lattice_resolution nor number_of_vectors is specified, the number of vectors defaults to
200. Overridden if "spherical" is selected as the vector_type and lattice_resolution is provided.
preferred_ranges
class-attribute
instance-attribute
The preferred ranges for interactive adaptation.
preferred_solutions
class-attribute
instance-attribute
The preferred solutions for interactive adaptation.
reference_point
class-attribute
instance-attribute
The reference point for interactive adaptation.
_ibea_fitness
Calculates the IBEA fitness for each individual based on pairwise fitness components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fitness_components
|
ndarray
|
The pairwise fitness components of the individuals. |
required |
kappa
|
float
|
The kappa value for the IBEA selection. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: The IBEA fitness values for each individual. |
Source code in desdeo/emo/operators/selection.py
_ibea_select
Selects the worst individual based on the IBEA indicator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fitness_components
|
ndarray
|
The pairwise fitness components of the individuals. |
required |
bad_sols
|
ndarray
|
A boolean array indicating which individuals are considered "bad". |
required |
kappa
|
float
|
The kappa value for the IBEA selection. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The index of the selected individual. |
Source code in desdeo/emo/operators/selection.py
_ibea_select_all
Selects all individuals based on the IBEA indicator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fitness_components
|
ndarray
|
The pairwise fitness components of the individuals. |
required |
population_size
|
int
|
The desired size of the population after selection. |
required |
kappa
|
float
|
The kappa value for the IBEA selection. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
list[int]: The list of indices of the selected individuals. |
Source code in desdeo/emo/operators/selection.py
_nsga2_crowding_distance_assignment
_nsga2_crowding_distance_assignment(
non_dominated_front: ndarray,
f_mins: ndarray,
f_maxs: ndarray,
) -> np.ndarray
Computes the crowding distance as pecified in the definition of NSGA2.
This function computed the crowding distances for a non-dominated set of solutions. A smaller value means that a solution is more crowded (worse), while a larger value means it is less crowded (better).
Note
The boundary point in non_dominated_front will be assigned a non-crowding
distance value of np.inf indicating, that they shouls always be included
in later sorting.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
non_dominated_front
|
ndarray
|
a 2D numpy array (size n x m = number of vectors x number of targets (obejctive funcitons)) containing mutually non-dominated vectors. The values of the vectors correspond to the optimization 'target' (usually the minimized objective function values.) |
required |
f_mins
|
ndarray
|
a 1D numpy array of size m containing the minimum objective function
values in |
required |
f_maxs
|
ndarray
|
a 1D numpy array of size m containing the maximum objective function
values in |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: a numpy array of size m containing the crowding distances for each vector
in |
Deb, K., Pratap, A., Agarwal, S., & Meyarivan, T. A. M. T.
(2002). A fast and elitist multiobjective genetic algorithm: NSGA-II. IEEE transactions on evolutionary computation, 6(2), 182-197.
Source code in desdeo/emo/operators/selection.py
_rvea_selection
_rvea_selection(
fitness: ndarray,
reference_vectors: ndarray,
ideal: ndarray,
partial_penalty: float,
gamma: ndarray,
) -> tuple[np.ndarray, np.ndarray]
Select individuals based on their fitness and their distance to the reference vectors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fitness
|
ndarray
|
The fitness values of the individuals. |
required |
reference_vectors
|
ndarray
|
The reference vectors. |
required |
ideal
|
ndarray
|
The ideal point. |
required |
partial_penalty
|
float
|
The partial penalty in APD. |
required |
gamma
|
ndarray
|
The angle between current and closest reference vector. |
required |
Returns:
| Type | Description |
|---|---|
tuple[ndarray, ndarray]
|
tuple[np.ndarray, np.ndarray]: The selected individuals and their APD fitness values. |
Source code in desdeo/emo/operators/selection.py
_rvea_selection_constrained
_rvea_selection_constrained(
fitness: ndarray,
constraints: ndarray,
reference_vectors: ndarray,
ideal: ndarray,
partial_penalty: float,
gamma: ndarray,
) -> tuple[np.ndarray, np.ndarray]
Select individuals based on their fitness and their distance to the reference vectors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fitness
|
ndarray
|
The fitness values of the individuals. |
required |
constraints
|
ndarray
|
The constraint violations of the individuals. |
required |
reference_vectors
|
ndarray
|
The reference vectors. |
required |
ideal
|
ndarray
|
The ideal point. |
required |
partial_penalty
|
float
|
The partial penalty in APD. |
required |
gamma
|
ndarray
|
The angle between current and closest reference vector. |
required |
Returns:
| Type | Description |
|---|---|
tuple[ndarray, ndarray]
|
tuple[np.ndarray, np.ndarray]: The selected individuals and their APD fitness values. |
Source code in desdeo/emo/operators/selection.py
jitted_calc_perpendicular_distance
jitted_calc_perpendicular_distance(
solutions: ndarray,
ref_dirs: ndarray,
invert_reference_vectors: bool,
) -> np.ndarray
Calculate the perpendicular distance between solutions and reference directions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
solutions
|
ndarray
|
The normalized solutions. |
required |
ref_dirs
|
ndarray
|
The reference directions. |
required |
invert_reference_vectors
|
bool
|
Whether to invert the reference vectors. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: The perpendicular distance matrix. |
Source code in desdeo/emo/operators/selection.py
Termination criteria
desdeo.emo.operators.termination
The base class for termination criteria.
The termination criterion is used to determine when the optimization process should stop. In this implementation, it also includes a simple counter for the number of elapsed generations. This counter is increased by one each time the termination criterion is called. The simplest termination criterion is reaching the maximum number of generations. The implementation also contains a counter for the number of evaluations. This counter is updated by the Evaluator and Generator classes. The termination criterion can be based on the number of evaluations as well.
Warning
Each subclass of BaseTerminator must implement the do method. The do method should always call the super().do method to increment the generation counter before conducting the termination check.
BaseTerminator
Bases: Subscriber
The base class for the termination criteria.
Also includes a simple counter for number of elapsed generations. This counter is increased by one each time the termination criterion is called.
Source code in desdeo/emo/operators/termination.py
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 | |
interested_topics
property
Return the message topics that the terminator is interested in.
provided_topics
property
Return the topics provided by the terminator.
Returns:
| Type | Description |
|---|---|
dict[int, Sequence[TerminatorMessageTopics]]
|
dict[int, Sequence[TerminatorMessageTopics]]: The topics provided by the terminator. |
__init__
Initialize a termination criterion.
Source code in desdeo/emo/operators/termination.py
check
Check if the termination criterion is reached.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the termination criterion is reached, False otherwise. |
state
Return the state of the termination criterion.
Source code in desdeo/emo/operators/termination.py
update
Update the number of evaluations.
Note that for this method to work, this class must be registered as an observer of a subject that sends messages with the key "num_evaluations". The Evaluator class does this.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
dict
|
the message from the subject, must contain the key "num_evaluations". |
required |
Source code in desdeo/emo/operators/termination.py
CompositeTerminator
Bases: BaseTerminator
Combines multiple terminators using logical AND or OR.
Source code in desdeo/emo/operators/termination.py
__init__
Initialize a composite termination criterion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
terminators
|
list[BaseTerminator]
|
List of BaseTerminator instances. |
required |
publisher
|
Publisher
|
Publisher for passing messages. |
required |
mode
|
str
|
"any" (terminate if any) or "all" (terminate if all). By default, "any". |
'any'
|
Source code in desdeo/emo/operators/termination.py
check
Check if the termination criterion is reached.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the termination criterion is reached, False otherwise. |
Source code in desdeo/emo/operators/termination.py
ExternalCheckTerminator
Bases: BaseTerminator
A termination criterion that checks an external condition.
Source code in desdeo/emo/operators/termination.py
__init__
Initialize the external check terminator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
check_function
|
callable
|
A function that returns True if the termination condition is met. |
required |
publisher
|
Publisher
|
The publisher to send messages to. |
required |
Source code in desdeo/emo/operators/termination.py
check
Check if the termination condition is met.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the termination condition is met, False otherwise. |
MaxEvaluationsTerminator
Bases: BaseTerminator
A class for a termination criterion based on the number of evaluations.
Source code in desdeo/emo/operators/termination.py
__init__
Initialize a termination criterion based on the number of evaluations.
Looks for messages with key "num_evaluations" to update the number of evaluations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_evaluations
|
int
|
the maximum number of evaluations. |
required |
publisher
|
Publisher
|
The publisher to which the terminator will publish its state. publisher must be passed. See the Subscriber class for more information. |
required |
Source code in desdeo/emo/operators/termination.py
check
Check if the termination criterion based on the number of generations is reached.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the termination criterion is reached, False otherwise. |
Source code in desdeo/emo/operators/termination.py
MaxGenerationsTerminator
Bases: BaseTerminator
A class for a termination criterion based on the number of generations.
Source code in desdeo/emo/operators/termination.py
__init__
Initialize a termination criterion based on the number of generations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_generations
|
int
|
the maximum number of generations. |
required |
publisher
|
Publisher
|
The publisher to which the terminator will publish its state. |
required |
Source code in desdeo/emo/operators/termination.py
check
Check if the termination criterion based on the number of generations is reached.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the termination criterion is reached, False otherwise. |
Source code in desdeo/emo/operators/termination.py
MaxTimeTerminator
Bases: BaseTerminator
A termination criterion based on the maximum elapsed time.
Source code in desdeo/emo/operators/termination.py
provided_topics
property
Return the topics provided by the terminator.
Returns:
| Type | Description |
|---|---|
dict[int, Sequence[TerminatorMessageTopics]]
|
dict[int, Sequence[TerminatorMessageTopics]]: The topics provided by the terminator. |
__init__
Initialize the maximum time terminator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_time_in_seconds
|
float
|
The maximum elapsed time in seconds. |
required |
publisher
|
Publisher
|
The publisher to which the terminator will publish its state. |
required |
Source code in desdeo/emo/operators/termination.py
check
Check if the termination criterion based on the maximum elapsed time is reached.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the termination criterion is reached, False otherwise. |