Note
Go to the end to download the full example code
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.design_space import SobieskiDesignSpace
configure_logger()
<RootLogger root (INFO)>
Instantiate the discipline¶
discipline = create_discipline("SobieskiMission")
Create the design space¶
design_space = SobieskiDesignSpace()
design_space.filter(["y_24", "y_34"])
Create the scenario¶
Build scenario which links the disciplines with the formulation and The DOE algorithm.
scenario = create_scenario(
[discipline],
"DisciplinaryOpt",
"y_4",
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 - 09:00:52:
INFO - 09:00:52: *** Start DOEScenario execution ***
INFO - 09:00:52: DOEScenario
INFO - 09:00:52: Disciplines: SobieskiMission
INFO - 09:00:52: MDO formulation: DisciplinaryOpt
INFO - 09:00:52: Optimization problem:
INFO - 09:00:52: minimize -y_4(y_24, y_34)
INFO - 09:00:52: with respect to y_24, y_34
INFO - 09:00:52: over the design space:
INFO - 09:00:52: +------+-------------+------------+-------------+-------+
INFO - 09:00:52: | Name | Lower bound | Value | Upper bound | Type |
INFO - 09:00:52: +------+-------------+------------+-------------+-------+
INFO - 09:00:52: | y_24 | 0.44 | 4.15006276 | 11.13 | float |
INFO - 09:00:52: | y_34 | 0.44 | 1.10754577 | 1.98 | float |
INFO - 09:00:52: +------+-------------+------------+-------------+-------+
INFO - 09:00:52: Solving optimization problem with algorithm lhs:
INFO - 09:00:52: 3%|▎ | 1/30 [00:00<00:00, 253.22 it/sec, obj=-1.53e+3]
INFO - 09:00:52: 7%|▋ | 2/30 [00:00<00:00, 414.31 it/sec, obj=-1.66e+3]
INFO - 09:00:52: 10%|█ | 3/30 [00:00<00:00, 542.02 it/sec, obj=-832]
INFO - 09:00:52: 13%|█▎ | 4/30 [00:00<00:00, 646.30 it/sec, obj=-1.62e+3]
INFO - 09:00:52: 17%|█▋ | 5/30 [00:00<00:00, 726.21 it/sec, obj=-994]
INFO - 09:00:52: 20%|██ | 6/30 [00:00<00:00, 796.54 it/sec, obj=-601]
INFO - 09:00:52: 23%|██▎ | 7/30 [00:00<00:00, 856.40 it/sec, obj=-180]
INFO - 09:00:52: 27%|██▋ | 8/30 [00:00<00:00, 907.59 it/sec, obj=-755]
INFO - 09:00:52: 30%|███ | 9/30 [00:00<00:00, 949.06 it/sec, obj=-691]
INFO - 09:00:52: 33%|███▎ | 10/30 [00:00<00:00, 986.83 it/sec, obj=-393]
INFO - 09:00:52: 37%|███▋ | 11/30 [00:00<00:00, 1014.63 it/sec, obj=-362]
INFO - 09:00:52: 40%|████ | 12/30 [00:00<00:00, 1043.79 it/sec, obj=-748]
INFO - 09:00:52: 43%|████▎ | 13/30 [00:00<00:00, 1070.52 it/sec, obj=-719]
INFO - 09:00:52: 47%|████▋ | 14/30 [00:00<00:00, 1094.77 it/sec, obj=-293]
INFO - 09:00:52: 50%|█████ | 15/30 [00:00<00:00, 1114.28 it/sec, obj=-931]
INFO - 09:00:52: 53%|█████▎ | 16/30 [00:00<00:00, 1133.96 it/sec, obj=-264]
INFO - 09:00:52: 57%|█████▋ | 17/30 [00:00<00:00, 1147.87 it/sec, obj=-1.17e+3]
INFO - 09:00:52: 60%|██████ | 18/30 [00:00<00:00, 1163.97 it/sec, obj=-495]
INFO - 09:00:52: 63%|██████▎ | 19/30 [00:00<00:00, 1179.47 it/sec, obj=-189]
INFO - 09:00:52: 67%|██████▋ | 20/30 [00:00<00:00, 1193.65 it/sec, obj=-2.23e+3]
INFO - 09:00:52: 70%|███████ | 21/30 [00:00<00:00, 1205.29 it/sec, obj=-344]
INFO - 09:00:52: 73%|███████▎ | 22/30 [00:00<00:00, 1217.30 it/sec, obj=-799]
INFO - 09:00:52: 77%|███████▋ | 23/30 [00:00<00:00, 1226.08 it/sec, obj=-55.9]
INFO - 09:00:52: 80%|████████ | 24/30 [00:00<00:00, 1236.67 it/sec, obj=-123]
INFO - 09:00:52: 83%|████████▎ | 25/30 [00:00<00:00, 1247.01 it/sec, obj=-875]
INFO - 09:00:52: 87%|████████▋ | 26/30 [00:00<00:00, 1254.64 it/sec, obj=-726]
INFO - 09:00:52: 90%|█████████ | 27/30 [00:00<00:00, 1260.60 it/sec, obj=-69.6]
INFO - 09:00:52: 93%|█████████▎| 28/30 [00:00<00:00, 1265.77 it/sec, obj=-1.51e+3]
INFO - 09:00:52: 97%|█████████▋| 29/30 [00:00<00:00, 1271.00 it/sec, obj=-1.15e+3]
INFO - 09:00:52: 100%|██████████| 30/30 [00:00<00:00, 1278.43 it/sec, obj=-2.73e+3]
INFO - 09:00:52: Optimization result:
INFO - 09:00:52: Optimizer info:
INFO - 09:00:52: Status: None
INFO - 09:00:52: Message: None
INFO - 09:00:52: Number of calls to the objective function by the optimizer: 30
INFO - 09:00:52: Solution:
INFO - 09:00:52: Objective: -2726.3660548732214
INFO - 09:00:52: Design space:
INFO - 09:00:52: +------+-------------+--------------------+-------------+-------+
INFO - 09:00:52: | Name | Lower bound | Value | Upper bound | Type |
INFO - 09:00:52: +------+-------------+--------------------+-------------+-------+
INFO - 09:00:52: | y_24 | 0.44 | 9.094543945649603 | 11.13 | float |
INFO - 09:00:52: | y_34 | 0.44 | 0.4769766573300308 | 1.98 | float |
INFO - 09:00:52: +------+-------------+--------------------+-------------+-------+
INFO - 09:00:52: *** End DOEScenario execution (time: 0:00:00.037659) ***
{'eval_jac': False, 'n_samples': 30, 'algo': 'lhs'}
Plot optimization history view¶
scenario.post_process("OptHistoryView", save=False, show=True)
<gemseo.post.opt_history_view.OptHistoryView object at 0x7f8ade6780d0>
Plot parallel coordinates¶
scenario.post_process(
"ScatterPlotMatrix",
variable_names=["y_4", "y_24", "y_34"],
save=False,
show=True,
)
<gemseo.post.scatter_mat.ScatterPlotMatrix object at 0x7f8ae33655e0>
Total running time of the script: (0 minutes 1.506 seconds)