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.31544203])}, {'y': array([0.48641363])}]

or as a dictionary:

sample = parameter_space.compute_samples(n_samples=4)
sample
array([[-0.00626896],
       [-0.96250565],
       [ 0.80990222],
       [ 1.0258068 ]])

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:11:30:
    INFO - 13:11:30: *** Start DOEScenario execution ***
    INFO - 13:11:30: DOEScenario
    INFO - 13:11:30:    Disciplines: AnalyticDiscipline
    INFO - 13:11:30:    MDO formulation: DisciplinaryOpt
    INFO - 13:11:30: Optimization problem:
    INFO - 13:11:30:    minimize z(x, y)
    INFO - 13:11:30:    with respect to x, y
    INFO - 13:11:30:    over the design space:
    INFO - 13:11:30:       +------+-------------+-------+-------------+-------+-------------------------+
    INFO - 13:11:30:       | Name | Lower bound | Value | Upper bound | Type  |       Distribution      |
    INFO - 13:11:30:       +------+-------------+-------+-------------+-------+-------------------------+
    INFO - 13:11:30:       | x    |      -2     |  None |      2      | float |                         |
    INFO - 13:11:30:       | y    |     -inf    |   0   |     inf     | float | norm(mu=0.0, sigma=1.0) |
    INFO - 13:11:30:       +------+-------------+-------+-------------+-------+-------------------------+
    INFO - 13:11:30: Solving optimization problem with algorithm lhs:
    INFO - 13:11:30:      1%|          | 1/100 [00:00<00:00, 323.53 it/sec, obj=3.12]
    INFO - 13:11:30:      2%|▏         | 2/100 [00:00<00:00, 502.28 it/sec, obj=1.72]
    INFO - 13:11:30:      3%|▎         | 3/100 [00:00<00:00, 647.00 it/sec, obj=0.181]
    INFO - 13:11:30:      4%|▍         | 4/100 [00:00<00:00, 758.22 it/sec, obj=3.76]
    INFO - 13:11:30:      5%|▌         | 5/100 [00:00<00:00, 850.05 it/sec, obj=2.15]
    INFO - 13:11:30:      6%|▌         | 6/100 [00:00<00:00, 925.01 it/sec, obj=-0.666]
    INFO - 13:11:30:      7%|▋         | 7/100 [00:00<00:00, 986.86 it/sec, obj=1.53]
    INFO - 13:11:30:      8%|▊         | 8/100 [00:00<00:00, 1034.61 it/sec, obj=1.7]
    INFO - 13:11:30:      9%|▉         | 9/100 [00:00<00:00, 1079.03 it/sec, obj=-2.27]
    INFO - 13:11:30:     10%|█         | 10/100 [00:00<00:00, 1118.66 it/sec, obj=-2.08]
    INFO - 13:11:30:     11%|█         | 11/100 [00:00<00:00, 1129.43 it/sec, obj=-2.8]
    INFO - 13:11:30:     12%|█▏        | 12/100 [00:00<00:00, 1148.10 it/sec, obj=-1.31]
    INFO - 13:11:30:     13%|█▎        | 13/100 [00:00<00:00, 1175.36 it/sec, obj=1.1]
    INFO - 13:11:30:     14%|█▍        | 14/100 [00:00<00:00, 1196.81 it/sec, obj=0.38]
    INFO - 13:11:30:     15%|█▌        | 15/100 [00:00<00:00, 1219.46 it/sec, obj=1.68]
    INFO - 13:11:30:     16%|█▌        | 16/100 [00:00<00:00, 1238.56 it/sec, obj=0.672]
    INFO - 13:11:30:     17%|█▋        | 17/100 [00:00<00:00, 1257.53 it/sec, obj=0.643]
    INFO - 13:11:30:     18%|█▊        | 18/100 [00:00<00:00, 1275.32 it/sec, obj=0.568]
    INFO - 13:11:30:     19%|█▉        | 19/100 [00:00<00:00, 1292.75 it/sec, obj=-0.277]
    INFO - 13:11:30:     20%|██        | 20/100 [00:00<00:00, 1309.94 it/sec, obj=1.51]
    INFO - 13:11:30:     21%|██        | 21/100 [00:00<00:00, 1320.96 it/sec, obj=1.83]
    INFO - 13:11:30:     22%|██▏       | 22/100 [00:00<00:00, 1333.51 it/sec, obj=2.12]
    INFO - 13:11:30:     23%|██▎       | 23/100 [00:00<00:00, 1343.52 it/sec, obj=0.526]
    INFO - 13:11:30:     24%|██▍       | 24/100 [00:00<00:00, 1353.87 it/sec, obj=1.47]
    INFO - 13:11:30:     25%|██▌       | 25/100 [00:00<00:00, 1364.13 it/sec, obj=-1.49]
    INFO - 13:11:30:     26%|██▌       | 26/100 [00:00<00:00, 1373.88 it/sec, obj=-1.58]
    INFO - 13:11:30:     27%|██▋       | 27/100 [00:00<00:00, 1380.48 it/sec, obj=1.59]
    INFO - 13:11:30:     28%|██▊       | 28/100 [00:00<00:00, 1388.19 it/sec, obj=0.329]
    INFO - 13:11:30:     29%|██▉       | 29/100 [00:00<00:00, 1395.29 it/sec, obj=-1.46]
    INFO - 13:11:30:     30%|███       | 30/100 [00:00<00:00, 1400.78 it/sec, obj=-0.045]
    INFO - 13:11:30:     31%|███       | 31/100 [00:00<00:00, 1391.73 it/sec, obj=-0.736]
    INFO - 13:11:30:     32%|███▏      | 32/100 [00:00<00:00, 1393.23 it/sec, obj=0.867]
    INFO - 13:11:30:     33%|███▎      | 33/100 [00:00<00:00, 1387.21 it/sec, obj=-3.12]
    INFO - 13:11:30:     34%|███▍      | 34/100 [00:00<00:00, 1393.18 it/sec, obj=-0.252]
    INFO - 13:11:30:     35%|███▌      | 35/100 [00:00<00:00, 1398.69 it/sec, obj=1.46]
    INFO - 13:11:30:     36%|███▌      | 36/100 [00:00<00:00, 1404.68 it/sec, obj=-2.02]
    INFO - 13:11:30:     37%|███▋      | 37/100 [00:00<00:00, 1410.43 it/sec, obj=-1.68]
    INFO - 13:11:30:     38%|███▊      | 38/100 [00:00<00:00, 1416.00 it/sec, obj=-0.913]
    INFO - 13:11:30:     39%|███▉      | 39/100 [00:00<00:00, 1420.16 it/sec, obj=-2.38]
    INFO - 13:11:30:     40%|████      | 40/100 [00:00<00:00, 1425.12 it/sec, obj=1.07]
    INFO - 13:11:30:     41%|████      | 41/100 [00:00<00:00, 1430.03 it/sec, obj=3.77]
    INFO - 13:11:30:     42%|████▏     | 42/100 [00:00<00:00, 1433.92 it/sec, obj=-1.88]
    INFO - 13:11:30:     43%|████▎     | 43/100 [00:00<00:00, 1438.42 it/sec, obj=0.116]
    INFO - 13:11:30:     44%|████▍     | 44/100 [00:00<00:00, 1442.93 it/sec, obj=-1.51]
    INFO - 13:11:30:     45%|████▌     | 45/100 [00:00<00:00, 1447.17 it/sec, obj=-0.0194]
    INFO - 13:11:30:     46%|████▌     | 46/100 [00:00<00:00, 1449.97 it/sec, obj=0.984]
    INFO - 13:11:30:     47%|████▋     | 47/100 [00:00<00:00, 1453.70 it/sec, obj=-0.34]
    INFO - 13:11:30:     48%|████▊     | 48/100 [00:00<00:00, 1456.70 it/sec, obj=-0.941]
    INFO - 13:11:30:     49%|████▉     | 49/100 [00:00<00:00, 1460.19 it/sec, obj=0.363]
    INFO - 13:11:30:     50%|█████     | 50/100 [00:00<00:00, 1463.49 it/sec, obj=-1.01]
    INFO - 13:11:30:     51%|█████     | 51/100 [00:00<00:00, 1466.93 it/sec, obj=-0.359]
    INFO - 13:11:30:     52%|█████▏    | 52/100 [00:00<00:00, 1469.20 it/sec, obj=-3.06]
    INFO - 13:11:30:     53%|█████▎    | 53/100 [00:00<00:00, 1472.18 it/sec, obj=2.34]
    INFO - 13:11:30:     54%|█████▍    | 54/100 [00:00<00:00, 1475.36 it/sec, obj=-0.262]
    INFO - 13:11:30:     55%|█████▌    | 55/100 [00:00<00:00, 1477.88 it/sec, obj=0.812]
    INFO - 13:11:30:     56%|█████▌    | 56/100 [00:00<00:00, 1480.95 it/sec, obj=-2.47]
    INFO - 13:11:30:     57%|█████▋    | 57/100 [00:00<00:00, 1483.83 it/sec, obj=1.49]
    INFO - 13:11:30:     58%|█████▊    | 58/100 [00:00<00:00, 1486.71 it/sec, obj=0.268]
    INFO - 13:11:30:     59%|█████▉    | 59/100 [00:00<00:00, 1488.33 it/sec, obj=0.559]
    INFO - 13:11:30:     60%|██████    | 60/100 [00:00<00:00, 1490.92 it/sec, obj=-2.01]
    INFO - 13:11:30:     61%|██████    | 61/100 [00:00<00:00, 1493.05 it/sec, obj=-0.854]
    INFO - 13:11:30:     62%|██████▏   | 62/100 [00:00<00:00, 1495.38 it/sec, obj=1.61]
    INFO - 13:11:30:     63%|██████▎   | 63/100 [00:00<00:00, 1497.81 it/sec, obj=-2.64]
    INFO - 13:11:30:     64%|██████▍   | 64/100 [00:00<00:00, 1500.24 it/sec, obj=0.818]
    INFO - 13:11:30:     65%|██████▌   | 65/100 [00:00<00:00, 1502.61 it/sec, obj=1.04]
    INFO - 13:11:30:     66%|██████▌   | 66/100 [00:00<00:00, 1503.40 it/sec, obj=-0.832]
    INFO - 13:11:30:     67%|██████▋   | 67/100 [00:00<00:00, 1505.52 it/sec, obj=0.692]
    INFO - 13:11:30:     68%|██████▊   | 68/100 [00:00<00:00, 1507.06 it/sec, obj=-3.33]
    INFO - 13:11:30:     69%|██████▉   | 69/100 [00:00<00:00, 1509.00 it/sec, obj=0.47]
    INFO - 13:11:30:     70%|███████   | 70/100 [00:00<00:00, 1511.13 it/sec, obj=0.445]
    INFO - 13:11:30:     71%|███████   | 71/100 [00:00<00:00, 1513.17 it/sec, obj=0.402]
    INFO - 13:11:30:     72%|███████▏  | 72/100 [00:00<00:00, 1514.13 it/sec, obj=2.77]
    INFO - 13:11:30:     73%|███████▎  | 73/100 [00:00<00:00, 1515.97 it/sec, obj=-0.256]
    INFO - 13:11:30:     74%|███████▍  | 74/100 [00:00<00:00, 1517.45 it/sec, obj=3.36]
    INFO - 13:11:30:     75%|███████▌  | 75/100 [00:00<00:00, 1519.01 it/sec, obj=-0.229]
    INFO - 13:11:30:     76%|███████▌  | 76/100 [00:00<00:00, 1520.79 it/sec, obj=-0.739]
    INFO - 13:11:30:     77%|███████▋  | 77/100 [00:00<00:00, 1522.43 it/sec, obj=0.808]
    INFO - 13:11:30:     78%|███████▊  | 78/100 [00:00<00:00, 1524.08 it/sec, obj=-0.377]
    INFO - 13:11:30:     79%|███████▉  | 79/100 [00:00<00:00, 1524.74 it/sec, obj=0.708]
    INFO - 13:11:30:     80%|████████  | 80/100 [00:00<00:00, 1526.33 it/sec, obj=-0.874]
    INFO - 13:11:30:     81%|████████  | 81/100 [00:00<00:00, 1527.48 it/sec, obj=-1.29]
    INFO - 13:11:30:     82%|████████▏ | 82/100 [00:00<00:00, 1528.93 it/sec, obj=0.505]
    INFO - 13:11:30:     83%|████████▎ | 83/100 [00:00<00:00, 1530.40 it/sec, obj=1.99]
    INFO - 13:11:30:     84%|████████▍ | 84/100 [00:00<00:00, 1531.89 it/sec, obj=0.574]
    INFO - 13:11:30:     85%|████████▌ | 85/100 [00:00<00:00, 1532.74 it/sec, obj=-2.06]
    INFO - 13:11:30:     86%|████████▌ | 86/100 [00:00<00:00, 1533.95 it/sec, obj=-1.49]
    INFO - 13:11:30:     87%|████████▋ | 87/100 [00:00<00:00, 1535.40 it/sec, obj=0.61]
    INFO - 13:11:30:     88%|████████▊ | 88/100 [00:00<00:00, 1536.39 it/sec, obj=0.542]
    INFO - 13:11:30:     89%|████████▉ | 89/100 [00:00<00:00, 1537.80 it/sec, obj=-1.5]
    INFO - 13:11:30:     90%|█████████ | 90/100 [00:00<00:00, 1539.14 it/sec, obj=0.201]
    INFO - 13:11:30:     91%|█████████ | 91/100 [00:00<00:00, 1540.52 it/sec, obj=0.949]
    INFO - 13:11:30:     92%|█████████▏| 92/100 [00:00<00:00, 1541.17 it/sec, obj=-1.86]
    INFO - 13:11:30:     93%|█████████▎| 93/100 [00:00<00:00, 1542.50 it/sec, obj=-0.0722]
    INFO - 13:11:30:     94%|█████████▍| 94/100 [00:00<00:00, 1543.30 it/sec, obj=-0.407]
    INFO - 13:11:30:     95%|█████████▌| 95/100 [00:00<00:00, 1544.48 it/sec, obj=0.194]
    INFO - 13:11:30:     96%|█████████▌| 96/100 [00:00<00:00, 1545.62 it/sec, obj=-0.207]
    INFO - 13:11:30:     97%|█████████▋| 97/100 [00:00<00:00, 1546.76 it/sec, obj=0.462]
    INFO - 13:11:30:     98%|█████████▊| 98/100 [00:00<00:00, 1547.98 it/sec, obj=-2.37]
    INFO - 13:11:30:     99%|█████████▉| 99/100 [00:00<00:00, 1548.43 it/sec, obj=1.32]
    INFO - 13:11:30:    100%|██████████| 100/100 [00:00<00:00, 1549.61 it/sec, obj=-2.21]
    INFO - 13:11:30: Optimization result:
    INFO - 13:11:30:    Optimizer info:
    INFO - 13:11:30:       Status: None
    INFO - 13:11:30:       Message: None
    INFO - 13:11:30:       Number of calls to the objective function by the optimizer: 100
    INFO - 13:11:30:    Solution:
    INFO - 13:11:30:       Objective: -3.3284373246961634
    INFO - 13:11:30:       Design space:
    INFO - 13:11:30:          +------+-------------+--------------------+-------------+-------+-------------------------+
    INFO - 13:11:30:          | Name | Lower bound |       Value        | Upper bound | Type  |       Distribution      |
    INFO - 13:11:30:          +------+-------------+--------------------+-------------+-------+-------------------------+
    INFO - 13:11:30:          | x    |      -2     | -1.959995425007306 |      2      | float |                         |
    INFO - 13:11:30:          | y    |     -inf    | -1.368441899688857 |     inf     | float | norm(mu=0.0, sigma=1.0) |
    INFO - 13:11:30:          +------+-------------+--------------------+-------------+-------+-------------------------+
    INFO - 13:11:30: *** End DOEScenario execution (time: 0:00:00.091068) ***

{'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:11:30:
    INFO - 13:11:30: *** Start DOEScenario execution ***
    INFO - 13:11:30: DOEScenario
    INFO - 13:11:30:    Disciplines: AnalyticDiscipline
    INFO - 13:11:30:    MDO formulation: DisciplinaryOpt
    INFO - 13:11:30: Optimization problem:
    INFO - 13:11:30:    minimize z(y)
    INFO - 13:11:30:    with respect to y
    INFO - 13:11:30:    over the design space:
    INFO - 13:11:30:       +------+-------------------------+
    INFO - 13:11:30:       | Name |       Distribution      |
    INFO - 13:11:30:       +------+-------------------------+
    INFO - 13:11:30:       |  y   | norm(mu=0.0, sigma=1.0) |
    INFO - 13:11:30:       +------+-------------------------+
    INFO - 13:11:30: Solving optimization problem with algorithm lhs:
    INFO - 13:11:30:      1%|          | 1/100 [00:00<00:00, 1323.54 it/sec, obj=-0.641]
    INFO - 13:11:30:      2%|▏         | 2/100 [00:00<00:00, 1335.13 it/sec, obj=-0.394]
    INFO - 13:11:30:      3%|▎         | 3/100 [00:00<00:00, 1401.84 it/sec, obj=0.551]
    INFO - 13:11:30:      4%|▍         | 4/100 [00:00<00:00, 1453.20 it/sec, obj=0.944]
    INFO - 13:11:30:      5%|▌         | 5/100 [00:00<00:00, 1485.76 it/sec, obj=-2.12]
    INFO - 13:11:30:      6%|▌         | 6/100 [00:00<00:00, 1510.10 it/sec, obj=-1.64]
    INFO - 13:11:30:      7%|▋         | 7/100 [00:00<00:00, 1518.10 it/sec, obj=0.656]
    INFO - 13:11:30:      8%|▊         | 8/100 [00:00<00:00, 1532.17 it/sec, obj=-0.612]
    INFO - 13:11:30:      9%|▉         | 9/100 [00:00<00:00, 1538.19 it/sec, obj=0.736]
    INFO - 13:11:30:     10%|█         | 10/100 [00:00<00:00, 1547.26 it/sec, obj=0.36]
    INFO - 13:11:30:     11%|█         | 11/100 [00:00<00:00, 1555.12 it/sec, obj=-0.31]
    INFO - 13:11:30:     12%|█▏        | 12/100 [00:00<00:00, 1562.32 it/sec, obj=0.324]
    INFO - 13:11:30:     13%|█▎        | 13/100 [00:00<00:00, 1559.40 it/sec, obj=-1.73]
    INFO - 13:11:30:     14%|█▍        | 14/100 [00:00<00:00, 1563.46 it/sec, obj=0.494]
    INFO - 13:11:30:     15%|█▌        | 15/100 [00:00<00:00, 1567.07 it/sec, obj=-0.148]
    INFO - 13:11:30:     16%|█▌        | 16/100 [00:00<00:00, 1529.48 it/sec, obj=1.1]
    INFO - 13:11:30:     17%|█▋        | 17/100 [00:00<00:00, 1520.68 it/sec, obj=-0.716]
    INFO - 13:11:30:     18%|█▊        | 18/100 [00:00<00:00, 1525.20 it/sec, obj=0.0421]
    INFO - 13:11:30:     19%|█▉        | 19/100 [00:00<00:00, 1526.40 it/sec, obj=0.256]
    INFO - 13:11:30:     20%|██        | 20/100 [00:00<00:00, 1530.94 it/sec, obj=-1.45]
    INFO - 13:11:30:     21%|██        | 21/100 [00:00<00:00, 1533.91 it/sec, obj=0.637]
    INFO - 13:11:30:     22%|██▏       | 22/100 [00:00<00:00, 1537.37 it/sec, obj=1.97]
    INFO - 13:11:30:     23%|██▎       | 23/100 [00:00<00:00, 1541.36 it/sec, obj=-0.208]
    INFO - 13:11:30:     24%|██▍       | 24/100 [00:00<00:00, 1545.24 it/sec, obj=0.18]
    INFO - 13:11:30:     25%|██▌       | 25/100 [00:00<00:00, 1536.69 it/sec, obj=0.000485]
    INFO - 13:11:30:     26%|██▌       | 26/100 [00:00<00:00, 1522.37 it/sec, obj=1.17]
    INFO - 13:11:30:     27%|██▋       | 27/100 [00:00<00:00, 1523.93 it/sec, obj=-0.305]
    INFO - 13:11:30:     28%|██▊       | 28/100 [00:00<00:00, 1527.26 it/sec, obj=0.68]
    INFO - 13:11:30:     29%|██▉       | 29/100 [00:00<00:00, 1530.90 it/sec, obj=-0.932]
    INFO - 13:11:30:     30%|███       | 30/100 [00:00<00:00, 1534.50 it/sec, obj=0.901]
    INFO - 13:11:30:     31%|███       | 31/100 [00:00<00:00, 1537.72 it/sec, obj=0.454]
    INFO - 13:11:30:     32%|███▏      | 32/100 [00:00<00:00, 1537.38 it/sec, obj=-1.16]
    INFO - 13:11:30:     33%|███▎      | 33/100 [00:00<00:00, 1539.86 it/sec, obj=1.44]
    INFO - 13:11:30:     34%|███▍      | 34/100 [00:00<00:00, 1541.26 it/sec, obj=0.798]
    INFO - 13:11:30:     35%|███▌      | 35/100 [00:00<00:00, 1543.48 it/sec, obj=1.59]
    INFO - 13:11:30:     36%|███▌      | 36/100 [00:00<00:00, 1546.11 it/sec, obj=2.05]
    INFO - 13:11:30:     37%|███▋      | 37/100 [00:00<00:00, 1548.55 it/sec, obj=-0.26]
    INFO - 13:11:30:     38%|███▊      | 38/100 [00:00<00:00, 1547.46 it/sec, obj=0.874]
    INFO - 13:11:30:     39%|███▉      | 39/100 [00:00<00:00, 1541.21 it/sec, obj=0.832]
    INFO - 13:11:30:     40%|████      | 40/100 [00:00<00:00, 1532.21 it/sec, obj=-1.38]
    INFO - 13:11:30:     41%|████      | 41/100 [00:00<00:00, 1533.61 it/sec, obj=1.52]
    INFO - 13:11:30:     42%|████▏     | 42/100 [00:00<00:00, 1535.81 it/sec, obj=-0.522]
    INFO - 13:11:30:     43%|████▎     | 43/100 [00:00<00:00, 1537.92 it/sec, obj=1.4]
    INFO - 13:11:30:     44%|████▍     | 44/100 [00:00<00:00, 1538.40 it/sec, obj=-0.484]
    INFO - 13:11:30:     45%|████▌     | 45/100 [00:00<00:00, 1540.34 it/sec, obj=-0.91]
    INFO - 13:11:30:     46%|████▌     | 46/100 [00:00<00:00, 1541.60 it/sec, obj=0.343]
    INFO - 13:11:30:     47%|████▋     | 47/100 [00:00<00:00, 1543.38 it/sec, obj=-0.441]
    INFO - 13:11:30:     48%|████▊     | 48/100 [00:00<00:00, 1545.30 it/sec, obj=-0.871]
    INFO - 13:11:30:     49%|████▉     | 49/100 [00:00<00:00, 1547.19 it/sec, obj=2.67]
    INFO - 13:11:30:     50%|█████     | 50/100 [00:00<00:00, 1547.46 it/sec, obj=0.217]
    INFO - 13:11:30:     51%|█████     | 51/100 [00:00<00:00, 1548.64 it/sec, obj=-0.425]
    INFO - 13:11:30:     52%|█████▏    | 52/100 [00:00<00:00, 1545.17 it/sec, obj=0.113]
    INFO - 13:11:30:     53%|█████▎    | 53/100 [00:00<00:00, 1537.45 it/sec, obj=-0.377]
    INFO - 13:11:30:     54%|█████▍    | 54/100 [00:00<00:00, 1538.38 it/sec, obj=-1.19]
    INFO - 13:11:30:     55%|█████▌    | 55/100 [00:00<00:00, 1539.83 it/sec, obj=-0.528]
    INFO - 13:11:30:     56%|█████▌    | 56/100 [00:00<00:00, 1540.38 it/sec, obj=-2.64]
    INFO - 13:11:30:     57%|█████▋    | 57/100 [00:00<00:00, 1541.79 it/sec, obj=-0.0776]
    INFO - 13:11:30:     58%|█████▊    | 58/100 [00:00<00:00, 1543.42 it/sec, obj=1.08]
    INFO - 13:11:30:     59%|█████▉    | 59/100 [00:00<00:00, 1544.35 it/sec, obj=-2.05]
    INFO - 13:11:30:     60%|██████    | 60/100 [00:00<00:00, 1545.95 it/sec, obj=0.0555]
    INFO - 13:11:30:     61%|██████    | 61/100 [00:00<00:00, 1547.67 it/sec, obj=-1.84]
    INFO - 13:11:30:     62%|██████▏   | 62/100 [00:00<00:00, 1549.18 it/sec, obj=0.4]
    INFO - 13:11:30:     63%|██████▎   | 63/100 [00:00<00:00, 1549.58 it/sec, obj=-0.195]
    INFO - 13:11:30:     64%|██████▍   | 64/100 [00:00<00:00, 1551.02 it/sec, obj=-0.578]
    INFO - 13:11:30:     65%|██████▌   | 65/100 [00:00<00:00, 1545.45 it/sec, obj=-0.977]
    INFO - 13:11:30:     66%|██████▌   | 66/100 [00:00<00:00, 1542.38 it/sec, obj=-0.114]
    INFO - 13:11:30:     67%|██████▋   | 67/100 [00:00<00:00, 1543.47 it/sec, obj=0.587]
    INFO - 13:11:30:     68%|██████▊   | 68/100 [00:00<00:00, 1544.84 it/sec, obj=-0.0679]
    INFO - 13:11:30:     69%|██████▉   | 69/100 [00:00<00:00, 1544.96 it/sec, obj=-0.0218]
    INFO - 13:11:30:     70%|███████   | 70/100 [00:00<00:00, 1546.03 it/sec, obj=-0.228]
    INFO - 13:11:30:     71%|███████   | 71/100 [00:00<00:00, 1546.79 it/sec, obj=1.21]
    INFO - 13:11:30:     72%|███████▏  | 72/100 [00:00<00:00, 1547.95 it/sec, obj=-0.34]
    INFO - 13:11:30:     73%|███████▎  | 73/100 [00:00<00:00, 1549.24 it/sec, obj=0.513]
    INFO - 13:11:30:     74%|███████▍  | 74/100 [00:00<00:00, 1550.47 it/sec, obj=1.67]
    INFO - 13:11:30:     75%|███████▌  | 75/100 [00:00<00:00, 1551.06 it/sec, obj=0.557]
    INFO - 13:11:30:     76%|███████▌  | 76/100 [00:00<00:00, 1552.14 it/sec, obj=0.431]
    INFO - 13:11:30:     77%|███████▋  | 77/100 [00:00<00:00, 1553.24 it/sec, obj=-1.31]
    INFO - 13:11:30:     78%|███████▊  | 78/100 [00:00<00:00, 1553.87 it/sec, obj=-0.678]
    INFO - 13:11:30:     79%|███████▉  | 79/100 [00:00<00:00, 1554.92 it/sec, obj=-1.01]
    INFO - 13:11:30:     80%|████████  | 80/100 [00:00<00:00, 1556.05 it/sec, obj=0.246]
    INFO - 13:11:30:     81%|████████  | 81/100 [00:00<00:00, 1557.13 it/sec, obj=1.29]
    INFO - 13:11:30:     82%|████████▏ | 82/100 [00:00<00:00, 1557.04 it/sec, obj=0.75]
    INFO - 13:11:30:     83%|████████▎ | 83/100 [00:00<00:00, 1557.93 it/sec, obj=-1.54]
    INFO - 13:11:30:     84%|████████▍ | 84/100 [00:00<00:00, 1554.71 it/sec, obj=-0.156]
    INFO - 13:11:30:     85%|████████▌ | 85/100 [00:00<00:00, 1555.45 it/sec, obj=1.87]
    INFO - 13:11:30:     86%|████████▌ | 86/100 [00:00<00:00, 1556.40 it/sec, obj=-1.08]
    INFO - 13:11:30:     87%|████████▋ | 87/100 [00:00<00:00, 1557.51 it/sec, obj=-0.647]
    INFO - 13:11:30:     88%|████████▊ | 88/100 [00:00<00:00, 1557.94 it/sec, obj=0.968]
    INFO - 13:11:30:     89%|████████▉ | 89/100 [00:00<00:00, 1558.76 it/sec, obj=-0.773]
    INFO - 13:11:30:     90%|█████████ | 90/100 [00:00<00:00, 1559.46 it/sec, obj=1.26]
    INFO - 13:11:30:     91%|█████████ | 91/100 [00:00<00:00, 1560.21 it/sec, obj=0.166]
    INFO - 13:11:30:     92%|█████████▏| 92/100 [00:00<00:00, 1561.11 it/sec, obj=0.29]
    INFO - 13:11:30:     93%|█████████▎| 93/100 [00:00<00:00, 1561.89 it/sec, obj=0.127]
    INFO - 13:11:30:     94%|█████████▍| 94/100 [00:00<00:00, 1562.77 it/sec, obj=-1.26]
    INFO - 13:11:30:     95%|█████████▌| 95/100 [00:00<00:00, 1562.79 it/sec, obj=1.01]
    INFO - 13:11:30:     96%|█████████▌| 96/100 [00:00<00:00, 1563.45 it/sec, obj=0.0819]
    INFO - 13:11:30:     97%|█████████▋| 97/100 [00:00<00:00, 1563.81 it/sec, obj=-1.09]
    INFO - 13:11:30:     98%|█████████▊| 98/100 [00:00<00:00, 1564.55 it/sec, obj=-0.762]
    INFO - 13:11:30:     99%|█████████▉| 99/100 [00:00<00:00, 1564.79 it/sec, obj=-0.0429]
    INFO - 13:11:30:    100%|██████████| 100/100 [00:00<00:00, 1565.45 it/sec, obj=-0.813]
    INFO - 13:11:30: Optimization result:
    INFO - 13:11:30:    Optimizer info:
    INFO - 13:11:30:       Status: None
    INFO - 13:11:30:       Message: None
    INFO - 13:11:30:       Number of calls to the objective function by the optimizer: 100
    INFO - 13:11:30:    Solution:
    INFO - 13:11:30:       Objective: -2.6379682068246657
    INFO - 13:11:30:       Design space:
    INFO - 13:11:30:          +------+-------------------------+
    INFO - 13:11:30:          | Name |       Distribution      |
    INFO - 13:11:30:          +------+-------------------------+
    INFO - 13:11:30:          |  y   | norm(mu=0.0, sigma=1.0) |
    INFO - 13:11:30:          +------+-------------------------+
    INFO - 13:11:30: *** End DOEScenario execution (time: 0:00:00.088729) ***

{'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.627 seconds)

Gallery generated by Sphinx-Gallery