Simple disciplinary DOE example on the Sobieski SSBJ test case

from __future__ import annotations

from gemseo.api import configure_logger
from gemseo.api import create_discipline
from gemseo.api import create_scenario
from gemseo.problems.sobieski.core.problem import SobieskiProblem

configure_logger()
<RootLogger root (INFO)>

Instantiate the discipline

discipline = create_discipline("SobieskiMission")

Create the design space

design_space = SobieskiProblem().design_space
design_space.filter(["y_24", "y_34"])
<gemseo.algos.design_space.DesignSpace object at 0x7ff1aea1f6d0>

Create the scenario

Build scenario which links the disciplines with the formulation and The DOE algorithm.

scenario = create_scenario(
    [discipline],
    formulation="DisciplinaryOpt",
    objective_name="y_4",
    design_space=design_space,
    maximize_objective=True,
    scenario_type="DOE",
)

Execute the scenario

Here we use a latin hypercube sampling algorithm with 30 samples.

scenario.execute({"n_samples": 30, "algo": "lhs"})
    INFO - 16:00:54:
    INFO - 16:00:54: *** Start DOEScenario execution ***
    INFO - 16:00:54: DOEScenario
    INFO - 16:00:54:    Disciplines: SobieskiMission
    INFO - 16:00:54:    MDO formulation: DisciplinaryOpt
    INFO - 16:00:54: Optimization problem:
    INFO - 16:00:54:    minimize -y_4(y_24, y_34)
    INFO - 16:00:54:    with respect to y_24, y_34
    INFO - 16:00:54:    over the design space:
    INFO - 16:00:54:    +------+-------------+------------+-------------+-------+
    INFO - 16:00:54:    | name | lower_bound |   value    | upper_bound | type  |
    INFO - 16:00:54:    +------+-------------+------------+-------------+-------+
    INFO - 16:00:54:    | y_24 |     0.44    | 4.15006276 |    11.13    | float |
    INFO - 16:00:54:    | y_34 |     0.44    | 1.10754577 |     1.98    | float |
    INFO - 16:00:54:    +------+-------------+------------+-------------+-------+
    INFO - 16:00:54: Solving optimization problem with algorithm lhs:
    INFO - 16:00:54: ...   0%|          | 0/30 [00:00<?, ?it]
    INFO - 16:00:54: ...   3%|▎         | 1/30 [00:00<00:00, 269.89 it/sec, obj=-1.53e+3]
    INFO - 16:00:54: ...   7%|▋         | 2/30 [00:00<00:00, 450.64 it/sec, obj=-1.66e+3]
    INFO - 16:00:54: ...  10%|█         | 3/30 [00:00<00:00, 583.49 it/sec, obj=-832]
    INFO - 16:00:54: ...  13%|█▎        | 4/30 [00:00<00:00, 685.20 it/sec, obj=-1.62e+3]
    INFO - 16:00:54: ...  17%|█▋        | 5/30 [00:00<00:00, 759.34 it/sec, obj=-994]
    INFO - 16:00:54: ...  20%|██        | 6/30 [00:00<00:00, 824.06 it/sec, obj=-601]
    INFO - 16:00:54: ...  23%|██▎       | 7/30 [00:00<00:00, 878.23 it/sec, obj=-180]
    INFO - 16:00:54: ...  27%|██▋       | 8/30 [00:00<00:00, 924.03 it/sec, obj=-755]
    INFO - 16:00:54: ...  30%|███       | 9/30 [00:00<00:00, 962.98 it/sec, obj=-691]
    INFO - 16:00:54: ...  33%|███▎      | 10/30 [00:00<00:00, 1002.32 it/sec, obj=-393]
    INFO - 16:00:54: ...  37%|███▋      | 11/30 [00:00<00:00, 1028.06 it/sec, obj=-362]
    INFO - 16:00:54: ...  40%|████      | 12/30 [00:00<00:00, 1052.77 it/sec, obj=-748]
    INFO - 16:00:54: ...  43%|████▎     | 13/30 [00:00<00:00, 1075.08 it/sec, obj=-719]
    INFO - 16:00:54: ...  47%|████▋     | 14/30 [00:00<00:00, 1073.24 it/sec, obj=-293]
    INFO - 16:00:54: ...  50%|█████     | 15/30 [00:00<00:00, 1091.94 it/sec, obj=-931]
    INFO - 16:00:54: ...  53%|█████▎    | 16/30 [00:00<00:00, 1102.48 it/sec, obj=-264]
    INFO - 16:00:54: ...  57%|█████▋    | 17/30 [00:00<00:00, 1116.85 it/sec, obj=-1.17e+3]
    INFO - 16:00:54: ...  60%|██████    | 18/30 [00:00<00:00, 1131.12 it/sec, obj=-495]
    INFO - 16:00:54: ...  63%|██████▎   | 19/30 [00:00<00:00, 1145.44 it/sec, obj=-189]
    INFO - 16:00:54: ...  67%|██████▋   | 20/30 [00:00<00:00, 1158.60 it/sec, obj=-2.23e+3]
    INFO - 16:00:54: ...  70%|███████   | 21/30 [00:00<00:00, 1170.86 it/sec, obj=-344]
    INFO - 16:00:54: ...  73%|███████▎  | 22/30 [00:00<00:00, 1178.18 it/sec, obj=-799]
    INFO - 16:00:54: ...  77%|███████▋  | 23/30 [00:00<00:00, 1187.59 it/sec, obj=-55.9]
    INFO - 16:00:54: ...  80%|████████  | 24/30 [00:00<00:00, 1197.90 it/sec, obj=-123]
    INFO - 16:00:54: ...  83%|████████▎ | 25/30 [00:00<00:00, 1207.87 it/sec, obj=-875]
    INFO - 16:00:54: ...  87%|████████▋ | 26/30 [00:00<00:00, 1215.32 it/sec, obj=-726]
    INFO - 16:00:54: ...  90%|█████████ | 27/30 [00:00<00:00, 1223.62 it/sec, obj=-69.6]
    INFO - 16:00:54: ...  93%|█████████▎| 28/30 [00:00<00:00, 1228.02 it/sec, obj=-1.51e+3]
    INFO - 16:00:54: ...  97%|█████████▋| 29/30 [00:00<00:00, 1234.22 it/sec, obj=-1.15e+3]
    INFO - 16:00:54: ... 100%|██████████| 30/30 [00:00<00:00, 1234.87 it/sec, obj=-2.73e+3]
    INFO - 16:00:54: Optimization result:
    INFO - 16:00:54:    Optimizer info:
    INFO - 16:00:54:       Status: None
    INFO - 16:00:54:       Message: None
    INFO - 16:00:54:       Number of calls to the objective function by the optimizer: 30
    INFO - 16:00:54:    Solution:
    INFO - 16:00:54:       Objective: -2726.3660548732214
    INFO - 16:00:54:       Design space:
    INFO - 16:00:54:       +------+-------------+--------------------+-------------+-------+
    INFO - 16:00:54:       | name | lower_bound |       value        | upper_bound | type  |
    INFO - 16:00:54:       +------+-------------+--------------------+-------------+-------+
    INFO - 16:00:54:       | y_24 |     0.44    | 9.094543945649603  |    11.13    | float |
    INFO - 16:00:54:       | y_34 |     0.44    | 0.4769766573300308 |     1.98    | float |
    INFO - 16:00:54:       +------+-------------+--------------------+-------------+-------+
    INFO - 16:00:54: *** End DOEScenario execution (time: 0:00:00.033612) ***

{'eval_jac': False, 'algo': 'lhs', 'n_samples': 30}

Plot optimization history view

scenario.post_process("OptHistoryView", save=False, show=True)
  • Evolution of the optimization variables
  • Evolution of the objective value
  • Distance to the optimum
<gemseo.post.opt_history_view.OptHistoryView object at 0x7ff1afa41100>

Plot parallel coordinates

scenario.post_process(
    "ScatterPlotMatrix",
    variable_names=["y_4", "y_24", "y_34"],
    save=False,
    show=True,
)
plot sobieski doe disc example
<gemseo.post.scatter_mat.ScatterPlotMatrix object at 0x7ff1afa41130>

Total running time of the script: ( 0 minutes 1.312 seconds)

Gallery generated by Sphinx-Gallery