BayesianOptimizer
The optimizer API supports:
- Local and remote evaluation backends.
- Typed
ObjectiveSpecandConstraintSpecinputs (<=and>=, with an optional per-constraint tolerance) and the design variables resolved from the study schema. - A result with the best point, its feasibility and constraint margins, the Pareto front of multi-objective runs, a trial history with one record per trial (
phase,status,parameters,objectives,constraints), thestop_reasonand the evaluation counts. - Typed failures for configuration, transport, contract, and execution errors; the execution errors carry the
partial_resultof the run.
mdo_framework.optimization.optimizer.BayesianOptimizer
Bayesian optimizer on the backend-neutral driver of GEMSEO.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
evaluator
|
Evaluator
|
Local or remote implementation of the Evaluator protocol. |
required |
design_variables
|
Sequence[DesignVariable]
|
Design variables, in the order of the design space. |
required |
objectives
|
Sequence[ObjectiveSpec]
|
Objectives to optimize, at least one. |
required |
constraints
|
Sequence[ConstraintSpec]
|
Inequality constraints on the outputs. |
()
|
parameter_constraints
|
Sequence[str]
|
Linear constraints between design variables. |
()
|
use_bonsai
|
bool
|
Whether to use the experimental BONSAI acquisition of Ax. |
False
|
algorithm
|
str
|
Backend, a key of |
'Ax_Bayesian'
|
Raises:
| Type | Description |
|---|---|
OptimizationConfigurationError
|
If there is no design variable or
objective, the algorithm is unknown, or |
Source code in src/mdo_framework/optimization/optimizer.py
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 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 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 | |
explore(n_samples=10, n_processes=1)
Runs a Design of Experiments (DOE) exploration using GEMSEO DOEScenario.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_samples
|
int
|
Number of samples to evaluate. |
10
|
n_processes
|
int
|
Number of concurrent processes. |
1
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
A dictionary containing the exploration history. |
Source code in src/mdo_framework/optimization/optimizer.py
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 | |
optimize(n_steps=10, n_init=5, evaluate_x0=None, max_consecutive_failures=5, seed=None)
Runs Bayesian optimization using a GEMSEO MDOScenario.
The tools are called n_init + n_steps times, plus once for the
start point x0 when it is evaluated. Fewer calls happen only when the
run stops early: the search space is exhausted, max_consecutive_failures
trials fail in a row or the time limit is reached.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_steps
|
int
|
Model-driven trials, at least 1. |
10
|
n_init
|
int
|
Initial trials, at least 1. |
5
|
evaluate_x0
|
bool | None
|
Whether to evaluate the start point first. |
None
|
max_consecutive_failures
|
int
|
Failed trials in a row that end the run, at least 1. |
5
|
seed
|
int | None
|
Seed of the backend, |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The result: |
dict[str, Any]
|
name), |
dict[str, Any]
|
tolerance at the best point), |
dict[str, Any]
|
only), |
dict[str, Any]
|
|
Raises:
| Type | Description |
|---|---|
OptimizationConfigurationError
|
If a budget is < 1, or the design space or the backend settings are invalid. |
OptimizationExecutionError
|
If no trial completed or the run was
aborted. Its |
Source code in src/mdo_framework/optimization/optimizer.py
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 | |
Evaluator
mdo_framework.optimization.optimizer.Evaluator
Bases: Protocol
Source code in src/mdo_framework/optimization/optimizer.py
147 148 149 150 151 152 153 154 | |
evaluate(parameters, objectives)
Evaluates the requested objectives given the design parameters.
Source code in src/mdo_framework/optimization/optimizer.py
148 149 150 151 152 153 154 | |
LocalEvaluator
mdo_framework.core.evaluators.LocalEvaluator
Evaluates the design parameters locally using a GEMSEO MDA instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Discipline
|
An instantiated GEMSEO MDA (or Discipline) object. |
required |
variable_specs
|
dict[str, ParameterDefinition] | None
|
Optional parameter definitions per variable name
( |
None
|
Source code in src/mdo_framework/core/evaluators.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
RemoteEvaluator
RemoteEvaluator distinguishes transport failures from invalid execution-service responses so service layers can map them to different HTTP statuses.
mdo_framework.optimization.optimizer.RemoteEvaluator
Evaluates the design parameters remotely by communicating with the Execution microservice.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
service_url
|
str
|
The URL of the execution service. |
required |
Source code in src/mdo_framework/optimization/optimizer.py
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 | |