Simple disciplinary DOE example on the Sobieski SSBJ test case

from __future__ import annotations

from gemseo import configure_logger
from gemseo import create_discipline
from gemseo 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"])
Design space:
name lower_bound value upper_bound type
y_24 0.44 4.15006276 11.13 float
y_34 0.44 1.10754577 1.98 float


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 - 08:24:59:
    INFO - 08:24:59: *** Start DOEScenario execution ***
    INFO - 08:24:59: DOEScenario
    INFO - 08:24:59:    Disciplines: SobieskiMission
    INFO - 08:24:59:    MDO formulation: DisciplinaryOpt
    INFO - 08:24:59: Optimization problem:
    INFO - 08:24:59:    minimize -y_4(y_24, y_34)
    INFO - 08:24:59:    with respect to y_24, y_34
    INFO - 08:24:59:    over the design space:
    INFO - 08:24:59:    +------+-------------+------------+-------------+-------+
    INFO - 08:24:59:    | name | lower_bound |   value    | upper_bound | type  |
    INFO - 08:24:59:    +------+-------------+------------+-------------+-------+
    INFO - 08:24:59:    | y_24 |     0.44    | 4.15006276 |    11.13    | float |
    INFO - 08:24:59:    | y_34 |     0.44    | 1.10754577 |     1.98    | float |
    INFO - 08:24:59:    +------+-------------+------------+-------------+-------+
    INFO - 08:24:59: Solving optimization problem with algorithm lhs:
    INFO - 08:24:59: ...   0%|          | 0/30 [00:00<?, ?it]
    INFO - 08:24:59: ...   3%|▎         | 1/30 [00:00<00:00, 289.76 it/sec, obj=-1.53e+3]
    INFO - 08:24:59: ...   7%|▋         | 2/30 [00:00<00:00, 482.27 it/sec, obj=-1.66e+3]
    INFO - 08:24:59: ...  10%|█         | 3/30 [00:00<00:00, 623.60 it/sec, obj=-832]
    INFO - 08:24:59: ...  13%|█▎        | 4/30 [00:00<00:00, 734.59 it/sec, obj=-1.62e+3]
    INFO - 08:24:59: ...  17%|█▋        | 5/30 [00:00<00:00, 823.22 it/sec, obj=-994]
    INFO - 08:24:59: ...  20%|██        | 6/30 [00:00<00:00, 894.66 it/sec, obj=-601]
    INFO - 08:24:59: ...  23%|██▎       | 7/30 [00:00<00:00, 946.34 it/sec, obj=-180]
    INFO - 08:24:59: ...  27%|██▋       | 8/30 [00:00<00:00, 995.86 it/sec, obj=-755]
    INFO - 08:24:59: ...  30%|███       | 9/30 [00:00<00:00, 1036.97 it/sec, obj=-691]
    INFO - 08:24:59: ...  33%|███▎      | 10/30 [00:00<00:00, 1074.28 it/sec, obj=-393]
    INFO - 08:24:59: ...  37%|███▋      | 11/30 [00:00<00:00, 1106.65 it/sec, obj=-362]
    INFO - 08:24:59: ...  40%|████      | 12/30 [00:00<00:00, 1135.44 it/sec, obj=-748]
    INFO - 08:24:59: ...  43%|████▎     | 13/30 [00:00<00:00, 1157.98 it/sec, obj=-719]
    INFO - 08:24:59: ...  47%|████▋     | 14/30 [00:00<00:00, 1180.26 it/sec, obj=-293]
    INFO - 08:24:59: ...  50%|█████     | 15/30 [00:00<00:00, 1199.19 it/sec, obj=-931]
    INFO - 08:24:59: ...  53%|█████▎    | 16/30 [00:00<00:00, 1217.86 it/sec, obj=-264]
    INFO - 08:24:59: ...  57%|█████▋    | 17/30 [00:00<00:00, 1235.09 it/sec, obj=-1.17e+3]
    INFO - 08:24:59: ...  60%|██████    | 18/30 [00:00<00:00, 1250.75 it/sec, obj=-495]
    INFO - 08:24:59: ...  63%|██████▎   | 19/30 [00:00<00:00, 1265.19 it/sec, obj=-189]
    INFO - 08:24:59: ...  67%|██████▋   | 20/30 [00:00<00:00, 1275.83 it/sec, obj=-2.23e+3]
    INFO - 08:24:59: ...  70%|███████   | 21/30 [00:00<00:00, 1286.77 it/sec, obj=-344]
    INFO - 08:24:59: ...  73%|███████▎  | 22/30 [00:00<00:00, 1297.89 it/sec, obj=-799]
    INFO - 08:24:59: ...  77%|███████▋  | 23/30 [00:00<00:00, 1308.62 it/sec, obj=-55.9]
    INFO - 08:24:59: ...  80%|████████  | 24/30 [00:00<00:00, 1318.77 it/sec, obj=-123]
    INFO - 08:24:59: ...  83%|████████▎ | 25/30 [00:00<00:00, 1328.07 it/sec, obj=-875]
    INFO - 08:24:59: ...  87%|████████▋ | 26/30 [00:00<00:00, 1333.58 it/sec, obj=-726]
    INFO - 08:24:59: ...  90%|█████████ | 27/30 [00:00<00:00, 1341.10 it/sec, obj=-69.6]
    INFO - 08:24:59: ...  93%|█████████▎| 28/30 [00:00<00:00, 1347.17 it/sec, obj=-1.51e+3]
    INFO - 08:24:59: ...  97%|█████████▋| 29/30 [00:00<00:00, 1353.95 it/sec, obj=-1.15e+3]
    INFO - 08:24:59: ... 100%|██████████| 30/30 [00:00<00:00, 1360.49 it/sec, obj=-2.73e+3]
    INFO - 08:24:59: Optimization result:
    INFO - 08:24:59:    Optimizer info:
    INFO - 08:24:59:       Status: None
    INFO - 08:24:59:       Message: None
    INFO - 08:24:59:       Number of calls to the objective function by the optimizer: 30
    INFO - 08:24:59:    Solution:
    INFO - 08:24:59:       Objective: -2726.3660548732214
    INFO - 08:24:59:       Design space:
    INFO - 08:24:59:       +------+-------------+--------------------+-------------+-------+
    INFO - 08:24:59:       | name | lower_bound |       value        | upper_bound | type  |
    INFO - 08:24:59:       +------+-------------+--------------------+-------------+-------+
    INFO - 08:24:59:       | y_24 |     0.44    | 9.094543945649603  |    11.13    | float |
    INFO - 08:24:59:       | y_34 |     0.44    | 0.4769766573300308 |     1.98    | float |
    INFO - 08:24:59:       +------+-------------+--------------------+-------------+-------+
    INFO - 08:24:59: *** End DOEScenario execution (time: 0:00:00.032617) ***

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

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 0x7f0cb5343d90>

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 0x7f0cbac32eb0>

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

Gallery generated by Sphinx-Gallery