Parameter space

In this example, we will see the basics of ParameterSpace.

from __future__ import annotations

from gemseo import configure_logger
from gemseo import create_discipline
from gemseo import create_scenario
from gemseo.algos.parameter_space import ParameterSpace
from gemseo.post.dataset.scatter_plot_matrix import ScatterMatrix

configure_logger()
<RootLogger root (INFO)>

Firstly, a ParameterSpace does not require any mandatory argument.

Create a parameter space

parameter_space = ParameterSpace()

Then, we can add either deterministic variables from their lower and upper bounds (use ParameterSpace.add_variable()):

parameter_space.add_variable("x", l_b=-2.0, u_b=2.0)

or uncertain variables from their distribution names and parameters (use ParameterSpace.add_random_variable()):

parameter_space.add_random_variable("y", "SPNormalDistribution", mu=0.0, sigma=1.0)
parameter_space
Parameter space:
Name Lower bound Value Upper bound Type Distribution
x -2 None 2 float
y -inf 0 inf float norm(mu=0.0, sigma=1.0)


Warning

We cannot mix probability distributions from different families, e.g. an OTDistribution and a SPDistribution.

We can check that the variables x and y are implemented as deterministic and uncertain variables respectively:

parameter_space.is_deterministic("x"), parameter_space.is_uncertain("y")
(True, True)

Note that when GEMSEO does not offer a class for the SciPy distribution, we can use the generic GEMSEO class SPDistribution to create any SciPy distribution by setting interfaced_distribution to its SciPy name and parameters as a dictionary of SciPy parameter names and values (see the documentation of SciPy).

# parameter_space.add_random_variable(
#     "y",
#     "SPDistribution",
#     interfaced_distribution="norm",
#     parameters={"loc": 1.0, "scale": 2.0},
# )

A similar procedure can be followed for OpenTURNS distributions for which GEMSEO does not offer a class directly. We can use the generic GEMSEO class OTDistribution to create any OpenTURNS distribution by setting interfaced_distribution to its OpenTURNS name and parameters as a tuple of OpenTURNS parameter values (see the documentation of OpenTURNS).

# parameter_space.add_random_variable(
#     "y",
#     "OTDistribution",
#     interfaced_distribution="Normal",
#     parameters=(1.0, 2.0),
# )

Sample from the parameter space

We can sample the uncertain variables from the ParameterSpace and get values either as an array (default value):

sample = parameter_space.compute_samples(n_samples=2, as_dict=True)
sample
[{'y': array([-1.48921944])}, {'y': array([0.98435788])}]

or as a dictionary:

sample = parameter_space.compute_samples(n_samples=4)
sample
array([[ 0.1842264 ],
       [-0.66728834],
       [ 1.01831895],
       [-0.8882144 ]])

Sample a discipline over the parameter space

We can also sample a discipline over the parameter space. For simplicity, we instantiate an AnalyticDiscipline from a dictionary of expressions.

discipline = create_discipline("AnalyticDiscipline", expressions={"z": "x+y"})

From these parameter space and discipline, we build a DOEScenario and execute it with a Latin Hypercube Sampling algorithm and 100 samples.

Warning

A Scenario deals with all variables available in the DesignSpace. By inheritance, a DOEScenario deals with all variables available in the ParameterSpace. Thus, if we do not filter the uncertain variables, the DOEScenario will consider all variables. In particular, the deterministic variables will be considered as uniformly distributed.

scenario = create_scenario(
    [discipline], "DisciplinaryOpt", "z", parameter_space, scenario_type="DOE"
)
scenario.execute({"algo": "lhs", "n_samples": 100})
    INFO - 13:56:52:
    INFO - 13:56:52: *** Start DOEScenario execution ***
    INFO - 13:56:52: DOEScenario
    INFO - 13:56:52:    Disciplines: AnalyticDiscipline
    INFO - 13:56:52:    MDO formulation: DisciplinaryOpt
    INFO - 13:56:52: Optimization problem:
    INFO - 13:56:52:    minimize z(x, y)
    INFO - 13:56:52:    with respect to x, y
    INFO - 13:56:52:    over the design space:
    INFO - 13:56:52:       +------+-------------+-------+-------------+-------+-------------------------+
    INFO - 13:56:52:       | Name | Lower bound | Value | Upper bound | Type  |       Distribution      |
    INFO - 13:56:52:       +------+-------------+-------+-------------+-------+-------------------------+
    INFO - 13:56:52:       | x    |      -2     |  None |      2      | float |                         |
    INFO - 13:56:52:       | y    |     -inf    |   0   |     inf     | float | norm(mu=0.0, sigma=1.0) |
    INFO - 13:56:52:       +------+-------------+-------+-------------+-------+-------------------------+
    INFO - 13:56:52: Solving optimization problem with algorithm lhs:
    INFO - 13:56:52:      1%|          | 1/100 [00:00<00:00, 351.49 it/sec, obj=3.12]
    INFO - 13:56:52:      2%|▏         | 2/100 [00:00<00:00, 551.56 it/sec, obj=1.72]
    INFO - 13:56:52:      3%|▎         | 3/100 [00:00<00:00, 706.23 it/sec, obj=0.181]
    INFO - 13:56:52:      4%|▍         | 4/100 [00:00<00:00, 823.58 it/sec, obj=3.76]
    INFO - 13:56:52:      5%|▌         | 5/100 [00:00<00:00, 906.45 it/sec, obj=2.15]
    INFO - 13:56:52:      6%|▌         | 6/100 [00:00<00:00, 979.33 it/sec, obj=-0.666]
    INFO - 13:56:52:      7%|▋         | 7/100 [00:00<00:00, 1040.44 it/sec, obj=1.53]
    INFO - 13:56:52:      8%|▊         | 8/100 [00:00<00:00, 1091.70 it/sec, obj=1.7]
    INFO - 13:56:52:      9%|▉         | 9/100 [00:00<00:00, 1135.40 it/sec, obj=-2.27]
    INFO - 13:56:52:     10%|█         | 10/100 [00:00<00:00, 1172.77 it/sec, obj=-2.08]
    INFO - 13:56:52:     11%|█         | 11/100 [00:00<00:00, 1199.87 it/sec, obj=-2.8]
    INFO - 13:56:52:     12%|█▏        | 12/100 [00:00<00:00, 1227.93 it/sec, obj=-1.31]
    INFO - 13:56:52:     13%|█▎        | 13/100 [00:00<00:00, 1253.21 it/sec, obj=1.1]
    INFO - 13:56:52:     14%|█▍        | 14/100 [00:00<00:00, 1275.72 it/sec, obj=0.38]
    INFO - 13:56:52:     15%|█▌        | 15/100 [00:00<00:00, 1295.98 it/sec, obj=1.68]
    INFO - 13:56:52:     16%|█▌        | 16/100 [00:00<00:00, 1314.42 it/sec, obj=0.672]
    INFO - 13:56:52:     17%|█▋        | 17/100 [00:00<00:00, 1330.98 it/sec, obj=0.643]
    INFO - 13:56:52:     18%|█▊        | 18/100 [00:00<00:00, 1341.41 it/sec, obj=0.568]
    INFO - 13:56:52:     19%|█▉        | 19/100 [00:00<00:00, 1355.16 it/sec, obj=-0.277]
    INFO - 13:56:52:     20%|██        | 20/100 [00:00<00:00, 1367.80 it/sec, obj=1.51]
    INFO - 13:56:52:     21%|██        | 21/100 [00:00<00:00, 1379.60 it/sec, obj=1.83]
    INFO - 13:56:52:     22%|██▏       | 22/100 [00:00<00:00, 1390.85 it/sec, obj=2.12]
    INFO - 13:56:52:     23%|██▎       | 23/100 [00:00<00:00, 1401.35 it/sec, obj=0.526]
    INFO - 13:56:52:     24%|██▍       | 24/100 [00:00<00:00, 1407.21 it/sec, obj=1.47]
    INFO - 13:56:52:     25%|██▌       | 25/100 [00:00<00:00, 1415.48 it/sec, obj=-1.49]
    INFO - 13:56:52:     26%|██▌       | 26/100 [00:00<00:00, 1423.75 it/sec, obj=-1.58]
    INFO - 13:56:52:     27%|██▋       | 27/100 [00:00<00:00, 1431.70 it/sec, obj=1.59]
    INFO - 13:56:52:     28%|██▊       | 28/100 [00:00<00:00, 1438.99 it/sec, obj=0.329]
    INFO - 13:56:52:     29%|██▉       | 29/100 [00:00<00:00, 1445.92 it/sec, obj=-1.46]
    INFO - 13:56:52:     30%|███       | 30/100 [00:00<00:00, 1452.34 it/sec, obj=-0.045]
    INFO - 13:56:52:     31%|███       | 31/100 [00:00<00:00, 1455.74 it/sec, obj=-0.736]
    INFO - 13:56:52:     32%|███▏      | 32/100 [00:00<00:00, 1461.06 it/sec, obj=0.867]
    INFO - 13:56:52:     33%|███▎      | 33/100 [00:00<00:00, 1466.52 it/sec, obj=-3.12]
    INFO - 13:56:52:     34%|███▍      | 34/100 [00:00<00:00, 1471.73 it/sec, obj=-0.252]
    INFO - 13:56:52:     35%|███▌      | 35/100 [00:00<00:00, 1476.90 it/sec, obj=1.46]
    INFO - 13:56:52:     36%|███▌      | 36/100 [00:00<00:00, 1481.65 it/sec, obj=-2.02]
    INFO - 13:56:52:     37%|███▋      | 37/100 [00:00<00:00, 1486.06 it/sec, obj=-1.68]
    INFO - 13:56:52:     38%|███▊      | 38/100 [00:00<00:00, 1475.60 it/sec, obj=-0.913]
    INFO - 13:56:52:     39%|███▉      | 39/100 [00:00<00:00, 1479.00 it/sec, obj=-2.38]
    INFO - 13:56:52:     40%|████      | 40/100 [00:00<00:00, 1483.02 it/sec, obj=1.07]
    INFO - 13:56:52:     41%|████      | 41/100 [00:00<00:00, 1486.74 it/sec, obj=3.77]
    INFO - 13:56:52:     42%|████▏     | 42/100 [00:00<00:00, 1490.48 it/sec, obj=-1.88]
    INFO - 13:56:52:     43%|████▎     | 43/100 [00:00<00:00, 1493.83 it/sec, obj=0.116]
    INFO - 13:56:52:     44%|████▍     | 44/100 [00:00<00:00, 1494.36 it/sec, obj=-1.51]
    INFO - 13:56:52:     45%|████▌     | 45/100 [00:00<00:00, 1497.35 it/sec, obj=-0.0194]
    INFO - 13:56:52:     46%|████▌     | 46/100 [00:00<00:00, 1500.25 it/sec, obj=0.984]
    INFO - 13:56:52:     47%|████▋     | 47/100 [00:00<00:00, 1503.05 it/sec, obj=-0.34]
    INFO - 13:56:52:     48%|████▊     | 48/100 [00:00<00:00, 1504.73 it/sec, obj=-0.941]
    INFO - 13:56:52:     49%|████▉     | 49/100 [00:00<00:00, 1507.20 it/sec, obj=0.363]
    INFO - 13:56:52:     50%|█████     | 50/100 [00:00<00:00, 1507.95 it/sec, obj=-1.01]
    INFO - 13:56:52:     51%|█████     | 51/100 [00:00<00:00, 1510.28 it/sec, obj=-0.359]
    INFO - 13:56:52:     52%|█████▏    | 52/100 [00:00<00:00, 1512.89 it/sec, obj=-3.06]
    INFO - 13:56:52:     53%|█████▎    | 53/100 [00:00<00:00, 1515.26 it/sec, obj=2.34]
    INFO - 13:56:52:     54%|█████▍    | 54/100 [00:00<00:00, 1517.76 it/sec, obj=-0.262]
    INFO - 13:56:52:     55%|█████▌    | 55/100 [00:00<00:00, 1520.07 it/sec, obj=0.812]
    INFO - 13:56:52:     56%|█████▌    | 56/100 [00:00<00:00, 1522.34 it/sec, obj=-2.47]
    INFO - 13:56:52:     57%|█████▋    | 57/100 [00:00<00:00, 1522.34 it/sec, obj=1.49]
    INFO - 13:56:52:     58%|█████▊    | 58/100 [00:00<00:00, 1524.36 it/sec, obj=0.268]
    INFO - 13:56:52:     59%|█████▉    | 59/100 [00:00<00:00, 1526.37 it/sec, obj=0.559]
    INFO - 13:56:52:     60%|██████    | 60/100 [00:00<00:00, 1523.71 it/sec, obj=-2.01]
    INFO - 13:56:52:     61%|██████    | 61/100 [00:00<00:00, 1513.80 it/sec, obj=-0.854]
    INFO - 13:56:52:     62%|██████▏   | 62/100 [00:00<00:00, 1504.03 it/sec, obj=1.61]
    INFO - 13:56:52:     63%|██████▎   | 63/100 [00:00<00:00, 1496.64 it/sec, obj=-2.64]
    INFO - 13:56:52:     64%|██████▍   | 64/100 [00:00<00:00, 1489.62 it/sec, obj=0.818]
    INFO - 13:56:52:     65%|██████▌   | 65/100 [00:00<00:00, 1483.68 it/sec, obj=1.04]
    INFO - 13:56:52:     66%|██████▌   | 66/100 [00:00<00:00, 1478.22 it/sec, obj=-0.832]
    INFO - 13:56:52:     67%|██████▋   | 67/100 [00:00<00:00, 1469.55 it/sec, obj=0.692]
    INFO - 13:56:52:     68%|██████▊   | 68/100 [00:00<00:00, 1461.95 it/sec, obj=-3.33]
    INFO - 13:56:52:     69%|██████▉   | 69/100 [00:00<00:00, 1455.26 it/sec, obj=0.47]
    INFO - 13:56:52:     70%|███████   | 70/100 [00:00<00:00, 1448.52 it/sec, obj=0.445]
    INFO - 13:56:52:     71%|███████   | 71/100 [00:00<00:00, 1440.56 it/sec, obj=0.402]
    INFO - 13:56:52:     72%|███████▏  | 72/100 [00:00<00:00, 1434.70 it/sec, obj=2.77]
    INFO - 13:56:52:     73%|███████▎  | 73/100 [00:00<00:00, 1429.60 it/sec, obj=-0.256]
    INFO - 13:56:52:     74%|███████▍  | 74/100 [00:00<00:00, 1423.85 it/sec, obj=3.36]
    INFO - 13:56:52:     75%|███████▌  | 75/100 [00:00<00:00, 1419.18 it/sec, obj=-0.229]
    INFO - 13:56:52:     76%|███████▌  | 76/100 [00:00<00:00, 1412.86 it/sec, obj=-0.739]
    INFO - 13:56:52:     77%|███████▋  | 77/100 [00:00<00:00, 1408.12 it/sec, obj=0.808]
    INFO - 13:56:52:     78%|███████▊  | 78/100 [00:00<00:00, 1403.39 it/sec, obj=-0.377]
    INFO - 13:56:52:     79%|███████▉  | 79/100 [00:00<00:00, 1399.34 it/sec, obj=0.708]
    INFO - 13:56:52:     80%|████████  | 80/100 [00:00<00:00, 1394.65 it/sec, obj=-0.874]
    INFO - 13:56:52:     81%|████████  | 81/100 [00:00<00:00, 1390.35 it/sec, obj=-1.29]
    INFO - 13:56:52:     82%|████████▏ | 82/100 [00:00<00:00, 1386.63 it/sec, obj=0.505]
    INFO - 13:56:52:     83%|████████▎ | 83/100 [00:00<00:00, 1382.41 it/sec, obj=1.99]
    INFO - 13:56:52:     84%|████████▍ | 84/100 [00:00<00:00, 1377.39 it/sec, obj=0.574]
    INFO - 13:56:52:     85%|████████▌ | 85/100 [00:00<00:00, 1373.04 it/sec, obj=-2.06]
    INFO - 13:56:52:     86%|████████▌ | 86/100 [00:00<00:00, 1371.77 it/sec, obj=-1.49]
    INFO - 13:56:52:     87%|████████▋ | 87/100 [00:00<00:00, 1374.47 it/sec, obj=0.61]
    INFO - 13:56:52:     88%|████████▊ | 88/100 [00:00<00:00, 1377.04 it/sec, obj=0.542]
    INFO - 13:56:52:     89%|████████▉ | 89/100 [00:00<00:00, 1379.57 it/sec, obj=-1.5]
    INFO - 13:56:52:     90%|█████████ | 90/100 [00:00<00:00, 1380.79 it/sec, obj=0.201]
    INFO - 13:56:52:     91%|█████████ | 91/100 [00:00<00:00, 1383.62 it/sec, obj=0.949]
    INFO - 13:56:52:     92%|█████████▏| 92/100 [00:00<00:00, 1386.00 it/sec, obj=-1.86]
    INFO - 13:56:52:     93%|█████████▎| 93/100 [00:00<00:00, 1388.47 it/sec, obj=-0.0722]
    INFO - 13:56:52:     94%|█████████▍| 94/100 [00:00<00:00, 1390.86 it/sec, obj=-0.407]
    INFO - 13:56:52:     95%|█████████▌| 95/100 [00:00<00:00, 1393.28 it/sec, obj=0.194]
    INFO - 13:56:52:     96%|█████████▌| 96/100 [00:00<00:00, 1395.63 it/sec, obj=-0.207]
    INFO - 13:56:52:     97%|█████████▋| 97/100 [00:00<00:00, 1396.84 it/sec, obj=0.462]
    INFO - 13:56:52:     98%|█████████▊| 98/100 [00:00<00:00, 1398.57 it/sec, obj=-2.37]
    INFO - 13:56:52:     99%|█████████▉| 99/100 [00:00<00:00, 1400.76 it/sec, obj=1.32]
    INFO - 13:56:52:    100%|██████████| 100/100 [00:00<00:00, 1402.90 it/sec, obj=-2.21]
    INFO - 13:56:52: Optimization result:
    INFO - 13:56:52:    Optimizer info:
    INFO - 13:56:52:       Status: None
    INFO - 13:56:52:       Message: None
    INFO - 13:56:52:       Number of calls to the objective function by the optimizer: 100
    INFO - 13:56:52:    Solution:
    INFO - 13:56:52:       Objective: -3.3284373246961634
    INFO - 13:56:52:       Design space:
    INFO - 13:56:52:          +------+-------------+--------------------+-------------+-------+-------------------------+
    INFO - 13:56:52:          | Name | Lower bound |       Value        | Upper bound | Type  |       Distribution      |
    INFO - 13:56:52:          +------+-------------+--------------------+-------------+-------+-------------------------+
    INFO - 13:56:52:          | x    |      -2     | -1.959995425007306 |      2      | float |                         |
    INFO - 13:56:52:          | y    |     -inf    | -1.368441899688857 |     inf     | float | norm(mu=0.0, sigma=1.0) |
    INFO - 13:56:52:          +------+-------------+--------------------+-------------+-------+-------------------------+
    INFO - 13:56:52: *** End DOEScenario execution (time: 0:00:00.096368) ***

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

We can visualize the result by encapsulating the database in a Dataset:

dataset = scenario.to_dataset(opt_naming=False)

This visualization can be tabular for example:

dataset
GROUP inputs outputs
VARIABLE x y z
COMPONENT 0 0 0
0 1.869403 1.246453 3.115855
1 -1.567970 3.285041 1.717071
2 0.282640 -0.101706 0.180934
3 1.916313 1.848317 3.764630
4 1.562653 0.586038 2.148691
... ... ... ...
95 0.120633 -0.327477 -0.206844
96 -0.999225 1.461403 0.462178
97 -1.396066 -0.972779 -2.368845
98 1.090093 0.225565 1.315658
99 -1.433207 -0.779330 -2.212536

100 rows × 3 columns



or graphical by means of a scatter plot matrix for example:

ScatterMatrix(dataset).execute(save=False, show=True)
plot parameter space
[<Figure size 640x480 with 9 Axes>]

Sample a discipline over the uncertain space

If we want to sample a discipline over the uncertain space, we need to filter the uncertain variables:

parameter_space.filter(parameter_space.uncertain_variables)
Parameter space:
Name Lower bound Value Upper bound Type Distribution
y -inf -1.368441899688857 inf float norm(mu=0.0, sigma=1.0)


Then, we create a new scenario from this parameter space containing only the uncertain variables and execute it.

scenario = create_scenario(
    [discipline], "DisciplinaryOpt", "z", parameter_space, scenario_type="DOE"
)
scenario.execute({"algo": "lhs", "n_samples": 100})
    INFO - 13:56:53:
    INFO - 13:56:53: *** Start DOEScenario execution ***
    INFO - 13:56:53: DOEScenario
    INFO - 13:56:53:    Disciplines: AnalyticDiscipline
    INFO - 13:56:53:    MDO formulation: DisciplinaryOpt
    INFO - 13:56:53: Optimization problem:
    INFO - 13:56:53:    minimize z(y)
    INFO - 13:56:53:    with respect to y
    INFO - 13:56:53:    over the design space:
    INFO - 13:56:53:       +------+-------------------------+
    INFO - 13:56:53:       | Name |       Distribution      |
    INFO - 13:56:53:       +------+-------------------------+
    INFO - 13:56:53:       |  y   | norm(mu=0.0, sigma=1.0) |
    INFO - 13:56:53:       +------+-------------------------+
    INFO - 13:56:53: Solving optimization problem with algorithm lhs:
    INFO - 13:56:53:      1%|          | 1/100 [00:00<00:00, 1248.30 it/sec, obj=-0.641]
    INFO - 13:56:53:      2%|▏         | 2/100 [00:00<00:00, 1263.53 it/sec, obj=-0.394]
    INFO - 13:56:53:      3%|▎         | 3/100 [00:00<00:00, 1229.28 it/sec, obj=0.551]
    INFO - 13:56:53:      4%|▍         | 4/100 [00:00<00:00, 1303.19 it/sec, obj=0.944]
    INFO - 13:56:53:      5%|▌         | 5/100 [00:00<00:00, 1358.79 it/sec, obj=-2.12]
    INFO - 13:56:53:      6%|▌         | 6/100 [00:00<00:00, 1399.50 it/sec, obj=-1.64]
    INFO - 13:56:53:      7%|▋         | 7/100 [00:00<00:00, 1414.47 it/sec, obj=0.656]
    INFO - 13:56:53:      8%|▊         | 8/100 [00:00<00:00, 1438.50 it/sec, obj=-0.612]
    INFO - 13:56:53:      9%|▉         | 9/100 [00:00<00:00, 1459.17 it/sec, obj=0.736]
    INFO - 13:56:53:     10%|█         | 10/100 [00:00<00:00, 1476.82 it/sec, obj=0.36]
    INFO - 13:56:53:     11%|█         | 11/100 [00:00<00:00, 1491.62 it/sec, obj=-0.31]
    INFO - 13:56:53:     12%|█▏        | 12/100 [00:00<00:00, 1504.91 it/sec, obj=0.324]
    INFO - 13:56:53:     13%|█▎        | 13/100 [00:00<00:00, 1312.52 it/sec, obj=-1.73]
    INFO - 13:56:53:     14%|█▍        | 14/100 [00:00<00:00, 1327.73 it/sec, obj=0.494]
    INFO - 13:56:53:     15%|█▌        | 15/100 [00:00<00:00, 1343.73 it/sec, obj=-0.148]
    INFO - 13:56:53:     16%|█▌        | 16/100 [00:00<00:00, 1358.75 it/sec, obj=1.1]
    INFO - 13:56:53:     17%|█▋        | 17/100 [00:00<00:00, 1369.53 it/sec, obj=-0.716]
    INFO - 13:56:53:     18%|█▊        | 18/100 [00:00<00:00, 1379.15 it/sec, obj=0.0421]
    INFO - 13:56:53:     19%|█▉        | 19/100 [00:00<00:00, 1390.42 it/sec, obj=0.256]
    INFO - 13:56:53:     20%|██        | 20/100 [00:00<00:00, 1401.11 it/sec, obj=-1.45]
    INFO - 13:56:53:     21%|██        | 21/100 [00:00<00:00, 1411.16 it/sec, obj=0.637]
    INFO - 13:56:53:     22%|██▏       | 22/100 [00:00<00:00, 1415.84 it/sec, obj=1.97]
    INFO - 13:56:53:     23%|██▎       | 23/100 [00:00<00:00, 1420.94 it/sec, obj=-0.208]
    INFO - 13:56:53:     24%|██▍       | 24/100 [00:00<00:00, 1424.76 it/sec, obj=0.18]
    INFO - 13:56:53:     25%|██▌       | 25/100 [00:00<00:00, 1410.82 it/sec, obj=0.000485]
    INFO - 13:56:53:     26%|██▌       | 26/100 [00:00<00:00, 1416.37 it/sec, obj=1.17]
    INFO - 13:56:53:     27%|██▋       | 27/100 [00:00<00:00, 1423.23 it/sec, obj=-0.305]
    INFO - 13:56:53:     28%|██▊       | 28/100 [00:00<00:00, 1429.60 it/sec, obj=0.68]
    INFO - 13:56:53:     29%|██▉       | 29/100 [00:00<00:00, 1435.86 it/sec, obj=-0.932]
    INFO - 13:56:53:     30%|███       | 30/100 [00:00<00:00, 1439.05 it/sec, obj=0.901]
    INFO - 13:56:53:     31%|███       | 31/100 [00:00<00:00, 1444.61 it/sec, obj=0.454]
    INFO - 13:56:53:     32%|███▏      | 32/100 [00:00<00:00, 1450.12 it/sec, obj=-1.16]
    INFO - 13:56:53:     33%|███▎      | 33/100 [00:00<00:00, 1455.21 it/sec, obj=1.44]
    INFO - 13:56:53:     34%|███▍      | 34/100 [00:00<00:00, 1460.22 it/sec, obj=0.798]
    INFO - 13:56:53:     35%|███▌      | 35/100 [00:00<00:00, 1464.99 it/sec, obj=1.59]
    INFO - 13:56:53:     36%|███▌      | 36/100 [00:00<00:00, 1467.21 it/sec, obj=2.05]
    INFO - 13:56:53:     37%|███▋      | 37/100 [00:00<00:00, 1471.24 it/sec, obj=-0.26]
    INFO - 13:56:53:     38%|███▊      | 38/100 [00:00<00:00, 1473.82 it/sec, obj=0.874]
    INFO - 13:56:53:     39%|███▉      | 39/100 [00:00<00:00, 1475.88 it/sec, obj=0.832]
    INFO - 13:56:53:     40%|████      | 40/100 [00:00<00:00, 1466.71 it/sec, obj=-1.38]
    INFO - 13:56:53:     41%|████      | 41/100 [00:00<00:00, 1469.07 it/sec, obj=1.52]
    INFO - 13:56:53:     42%|████▏     | 42/100 [00:00<00:00, 1470.53 it/sec, obj=-0.522]
    INFO - 13:56:53:     43%|████▎     | 43/100 [00:00<00:00, 1473.57 it/sec, obj=1.4]
    INFO - 13:56:53:     44%|████▍     | 44/100 [00:00<00:00, 1474.21 it/sec, obj=-0.484]
    INFO - 13:56:53:     45%|████▌     | 45/100 [00:00<00:00, 1477.17 it/sec, obj=-0.91]
    INFO - 13:56:53:     46%|████▌     | 46/100 [00:00<00:00, 1480.41 it/sec, obj=0.343]
    INFO - 13:56:53:     47%|████▋     | 47/100 [00:00<00:00, 1483.36 it/sec, obj=-0.441]
    INFO - 13:56:53:     48%|████▊     | 48/100 [00:00<00:00, 1486.21 it/sec, obj=-0.871]
    INFO - 13:56:53:     49%|████▉     | 49/100 [00:00<00:00, 1486.95 it/sec, obj=2.67]
    INFO - 13:56:53:     50%|█████     | 50/100 [00:00<00:00, 1489.56 it/sec, obj=0.217]
    INFO - 13:56:53:     51%|█████     | 51/100 [00:00<00:00, 1492.24 it/sec, obj=-0.425]
    INFO - 13:56:53:     52%|█████▏    | 52/100 [00:00<00:00, 1495.01 it/sec, obj=0.113]
    INFO - 13:56:53:     53%|█████▎    | 53/100 [00:00<00:00, 1497.54 it/sec, obj=-0.377]
    INFO - 13:56:53:     54%|█████▍    | 54/100 [00:00<00:00, 1500.09 it/sec, obj=-1.19]
    INFO - 13:56:53:     55%|█████▌    | 55/100 [00:00<00:00, 1500.84 it/sec, obj=-0.528]
    INFO - 13:56:53:     56%|█████▌    | 56/100 [00:00<00:00, 1503.00 it/sec, obj=-2.64]
    INFO - 13:56:53:     57%|█████▋    | 57/100 [00:00<00:00, 1505.47 it/sec, obj=-0.0776]
    INFO - 13:56:53:     58%|█████▊    | 58/100 [00:00<00:00, 1507.76 it/sec, obj=1.08]
    INFO - 13:56:53:     59%|█████▉    | 59/100 [00:00<00:00, 1510.00 it/sec, obj=-2.05]
    INFO - 13:56:53:     60%|██████    | 60/100 [00:00<00:00, 1512.31 it/sec, obj=0.0555]
    INFO - 13:56:53:     61%|██████    | 61/100 [00:00<00:00, 1514.54 it/sec, obj=-1.84]
    INFO - 13:56:53:     62%|██████▏   | 62/100 [00:00<00:00, 1515.04 it/sec, obj=0.4]
    INFO - 13:56:53:     63%|██████▎   | 63/100 [00:00<00:00, 1516.99 it/sec, obj=-0.195]
    INFO - 13:56:53:     64%|██████▍   | 64/100 [00:00<00:00, 1518.91 it/sec, obj=-0.578]
    INFO - 13:56:53:     65%|██████▌   | 65/100 [00:00<00:00, 1520.72 it/sec, obj=-0.977]
    INFO - 13:56:53:     66%|██████▌   | 66/100 [00:00<00:00, 1522.42 it/sec, obj=-0.114]
    INFO - 13:56:53:     67%|██████▋   | 67/100 [00:00<00:00, 1524.13 it/sec, obj=0.587]
    INFO - 13:56:53:     68%|██████▊   | 68/100 [00:00<00:00, 1524.13 it/sec, obj=-0.0679]
    INFO - 13:56:53:     69%|██████▉   | 69/100 [00:00<00:00, 1526.68 it/sec, obj=-0.0218]
    INFO - 13:56:53:     70%|███████   | 70/100 [00:00<00:00, 1528.74 it/sec, obj=-0.228]
    INFO - 13:56:53:     71%|███████   | 71/100 [00:00<00:00, 1530.41 it/sec, obj=1.21]
    INFO - 13:56:53:     72%|███████▏  | 72/100 [00:00<00:00, 1532.07 it/sec, obj=-0.34]
    INFO - 13:56:53:     73%|███████▎  | 73/100 [00:00<00:00, 1533.70 it/sec, obj=0.513]
    INFO - 13:56:53:     74%|███████▍  | 74/100 [00:00<00:00, 1535.20 it/sec, obj=1.67]
    INFO - 13:56:53:     75%|███████▌  | 75/100 [00:00<00:00, 1535.12 it/sec, obj=0.557]
    INFO - 13:56:53:     76%|███████▌  | 76/100 [00:00<00:00, 1536.42 it/sec, obj=0.431]
    INFO - 13:56:53:     77%|███████▋  | 77/100 [00:00<00:00, 1537.75 it/sec, obj=-1.31]
    INFO - 13:56:53:     78%|███████▊  | 78/100 [00:00<00:00, 1539.09 it/sec, obj=-0.678]
    INFO - 13:56:53:     79%|███████▉  | 79/100 [00:00<00:00, 1540.49 it/sec, obj=-1.01]
    INFO - 13:56:53:     80%|████████  | 80/100 [00:00<00:00, 1541.88 it/sec, obj=0.246]
    INFO - 13:56:53:     81%|████████  | 81/100 [00:00<00:00, 1542.00 it/sec, obj=1.29]
    INFO - 13:56:53:     82%|████████▏ | 82/100 [00:00<00:00, 1543.06 it/sec, obj=0.75]
    INFO - 13:56:53:     83%|████████▎ | 83/100 [00:00<00:00, 1544.36 it/sec, obj=-1.54]
    INFO - 13:56:53:     84%|████████▍ | 84/100 [00:00<00:00, 1545.57 it/sec, obj=-0.156]
    INFO - 13:56:53:     85%|████████▌ | 85/100 [00:00<00:00, 1546.76 it/sec, obj=1.87]
    INFO - 13:56:53:     86%|████████▌ | 86/100 [00:00<00:00, 1547.45 it/sec, obj=-1.08]
    INFO - 13:56:53:     87%|████████▋ | 87/100 [00:00<00:00, 1548.62 it/sec, obj=-0.647]
    INFO - 13:56:53:     88%|████████▊ | 88/100 [00:00<00:00, 1548.62 it/sec, obj=0.968]
    INFO - 13:56:53:     89%|████████▉ | 89/100 [00:00<00:00, 1549.63 it/sec, obj=-0.773]
    INFO - 13:56:53:     90%|█████████ | 90/100 [00:00<00:00, 1550.71 it/sec, obj=1.26]
    INFO - 13:56:53:     91%|█████████ | 91/100 [00:00<00:00, 1551.77 it/sec, obj=0.166]
    INFO - 13:56:53:     92%|█████████▏| 92/100 [00:00<00:00, 1552.85 it/sec, obj=0.29]
    INFO - 13:56:53:     93%|█████████▎| 93/100 [00:00<00:00, 1553.93 it/sec, obj=0.127]
    INFO - 13:56:53:     94%|█████████▍| 94/100 [00:00<00:00, 1553.89 it/sec, obj=-1.26]
    INFO - 13:56:53:     95%|█████████▌| 95/100 [00:00<00:00, 1554.74 it/sec, obj=1.01]
    INFO - 13:56:53:     96%|█████████▌| 96/100 [00:00<00:00, 1555.77 it/sec, obj=0.0819]
    INFO - 13:56:53:     97%|█████████▋| 97/100 [00:00<00:00, 1556.78 it/sec, obj=-1.09]
    INFO - 13:56:53:     98%|█████████▊| 98/100 [00:00<00:00, 1557.72 it/sec, obj=-0.762]
    INFO - 13:56:53:     99%|█████████▉| 99/100 [00:00<00:00, 1558.68 it/sec, obj=-0.0429]
    INFO - 13:56:53:    100%|██████████| 100/100 [00:00<00:00, 1559.56 it/sec, obj=-0.813]
    INFO - 13:56:53: Optimization result:
    INFO - 13:56:53:    Optimizer info:
    INFO - 13:56:53:       Status: None
    INFO - 13:56:53:       Message: None
    INFO - 13:56:53:       Number of calls to the objective function by the optimizer: 100
    INFO - 13:56:53:    Solution:
    INFO - 13:56:53:       Objective: -2.6379682068246657
    INFO - 13:56:53:       Design space:
    INFO - 13:56:53:          +------+-------------------------+
    INFO - 13:56:53:          | Name |       Distribution      |
    INFO - 13:56:53:          +------+-------------------------+
    INFO - 13:56:53:          |  y   | norm(mu=0.0, sigma=1.0) |
    INFO - 13:56:53:          +------+-------------------------+
    INFO - 13:56:53: *** End DOEScenario execution (time: 0:00:00.087398) ***

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

Finally, we build a dataset from the disciplinary cache and visualize it. We can see that the deterministic variable ‘x’ is set to its default value for all evaluations, contrary to the previous case where we were considering the whole parameter space.

dataset = scenario.to_dataset(opt_naming=False)
dataset
GROUP inputs outputs
VARIABLE y z
COMPONENT 0 0
0 -0.640726 -0.640726
1 -0.393653 -0.393653
2 0.550565 0.550565
3 0.944369 0.944369
4 -2.115275 -2.115275
... ... ...
95 0.081947 0.081947
96 -1.085812 -1.085812
97 -0.761651 -0.761651
98 -0.042932 -0.042932
99 -0.813354 -0.813354

100 rows × 2 columns



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

Gallery generated by Sphinx-Gallery