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)>

Create a parameter space

Firstly, the creation of a ParameterSpace does not require any mandatory argument:

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 a NumPy array (by default)

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

or as a dictionary of NumPy arrays indexed by the names of the variables:

sample = parameter_space.compute_samples(n_samples=4)
sample
array([[ 0.02671372],
       [-0.33799507],
       [-0.51901322],
       [ 0.1303934 ]])

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 DOEScenario considers all the variables available in its DesignSpace. By inheritance, in the special case of a ParameterSpace, a DOEScenario considers all the variables available in this ParameterSpace. Thus, if we do not filter the uncertain variables, the DOEScenario will consider both the deterministic variables as uniformly distributed variables and the uncertain variables with their specified probability distributions.

scenario = create_scenario(
    [discipline], "DisciplinaryOpt", "z", parameter_space, scenario_type="DOE"
)
scenario.execute({"algo": "lhs", "n_samples": 100})
    INFO - 00:09:53:
    INFO - 00:09:53: *** Start DOEScenario execution ***
    INFO - 00:09:53: DOEScenario
    INFO - 00:09:53:    Disciplines: AnalyticDiscipline
    INFO - 00:09:53:    MDO formulation: DisciplinaryOpt
    INFO - 00:09:53: Optimization problem:
    INFO - 00:09:53:    minimize z(x, y)
    INFO - 00:09:53:    with respect to x, y
    INFO - 00:09:53:    over the design space:
    INFO - 00:09:53:       +------+-------------+-------+-------------+-------+-------------------------+
    INFO - 00:09:53:       | Name | Lower bound | Value | Upper bound | Type  |       Distribution      |
    INFO - 00:09:53:       +------+-------------+-------+-------------+-------+-------------------------+
    INFO - 00:09:53:       | x    |      -2     |  None |      2      | float |                         |
    INFO - 00:09:53:       | y    |     -inf    |   0   |     inf     | float | norm(mu=0.0, sigma=1.0) |
    INFO - 00:09:53:       +------+-------------+-------+-------------+-------+-------------------------+
    INFO - 00:09:53: Solving optimization problem with algorithm lhs:
    INFO - 00:09:53:      1%|          | 1/100 [00:00<00:00, 369.51 it/sec, obj=3.12]
    INFO - 00:09:53:      2%|▏         | 2/100 [00:00<00:00, 571.28 it/sec, obj=1.72]
    INFO - 00:09:53:      3%|▎         | 3/100 [00:00<00:00, 721.99 it/sec, obj=0.181]
    INFO - 00:09:53:      4%|▍         | 4/100 [00:00<00:00, 834.94 it/sec, obj=3.76]
    INFO - 00:09:53:      5%|▌         | 5/100 [00:00<00:00, 925.04 it/sec, obj=2.15]
    INFO - 00:09:53:      6%|▌         | 6/100 [00:00<00:00, 997.18 it/sec, obj=-0.666]
    INFO - 00:09:53:      7%|▋         | 7/100 [00:00<00:00, 1057.03 it/sec, obj=1.53]
    INFO - 00:09:53:      8%|▊         | 8/100 [00:00<00:00, 1106.86 it/sec, obj=1.7]
    INFO - 00:09:53:      9%|▉         | 9/100 [00:00<00:00, 1144.66 it/sec, obj=-2.27]
    INFO - 00:09:53:     10%|█         | 10/100 [00:00<00:00, 1179.60 it/sec, obj=-2.08]
    INFO - 00:09:53:     11%|█         | 11/100 [00:00<00:00, 1208.32 it/sec, obj=-2.8]
    INFO - 00:09:53:     12%|█▏        | 12/100 [00:00<00:00, 1235.44 it/sec, obj=-1.31]
    INFO - 00:09:53:     13%|█▎        | 13/100 [00:00<00:00, 1259.90 it/sec, obj=1.1]
    INFO - 00:09:53:     14%|█▍        | 14/100 [00:00<00:00, 1281.43 it/sec, obj=0.38]
    INFO - 00:09:53:     15%|█▌        | 15/100 [00:00<00:00, 1297.53 it/sec, obj=1.68]
    INFO - 00:09:53:     16%|█▌        | 16/100 [00:00<00:00, 1314.39 it/sec, obj=0.672]
    INFO - 00:09:53:     17%|█▋        | 17/100 [00:00<00:00, 1328.45 it/sec, obj=0.643]
    INFO - 00:09:53:     18%|█▊        | 18/100 [00:00<00:00, 1342.63 it/sec, obj=0.568]
    INFO - 00:09:53:     19%|█▉        | 19/100 [00:00<00:00, 1355.88 it/sec, obj=-0.277]
    INFO - 00:09:53:     20%|██        | 20/100 [00:00<00:00, 1367.89 it/sec, obj=1.51]
    INFO - 00:09:53:     21%|██        | 21/100 [00:00<00:00, 1379.36 it/sec, obj=1.83]
    INFO - 00:09:53:     22%|██▏       | 22/100 [00:00<00:00, 1387.01 it/sec, obj=2.12]
    INFO - 00:09:53:     23%|██▎       | 23/100 [00:00<00:00, 1396.26 it/sec, obj=0.526]
    INFO - 00:09:53:     24%|██▍       | 24/100 [00:00<00:00, 1403.81 it/sec, obj=1.47]
    INFO - 00:09:53:     25%|██▌       | 25/100 [00:00<00:00, 1411.86 it/sec, obj=-1.49]
    INFO - 00:09:53:     26%|██▌       | 26/100 [00:00<00:00, 1419.61 it/sec, obj=-1.58]
    INFO - 00:09:53:     27%|██▋       | 27/100 [00:00<00:00, 1427.05 it/sec, obj=1.59]
    INFO - 00:09:53:     28%|██▊       | 28/100 [00:00<00:00, 1431.31 it/sec, obj=0.329]
    INFO - 00:09:53:     29%|██▉       | 29/100 [00:00<00:00, 1437.20 it/sec, obj=-1.46]
    INFO - 00:09:53:     30%|███       | 30/100 [00:00<00:00, 1442.15 it/sec, obj=-0.045]
    INFO - 00:09:53:     31%|███       | 31/100 [00:00<00:00, 1447.87 it/sec, obj=-0.736]
    INFO - 00:09:53:     32%|███▏      | 32/100 [00:00<00:00, 1453.38 it/sec, obj=0.867]
    INFO - 00:09:53:     33%|███▎      | 33/100 [00:00<00:00, 1458.89 it/sec, obj=-3.12]
    INFO - 00:09:53:     34%|███▍      | 34/100 [00:00<00:00, 1463.85 it/sec, obj=-0.252]
    INFO - 00:09:53:     35%|███▌      | 35/100 [00:00<00:00, 1466.09 it/sec, obj=1.46]
    INFO - 00:09:53:     36%|███▌      | 36/100 [00:00<00:00, 1470.44 it/sec, obj=-2.02]
    INFO - 00:09:53:     37%|███▋      | 37/100 [00:00<00:00, 1473.57 it/sec, obj=-1.68]
    INFO - 00:09:53:     38%|███▊      | 38/100 [00:00<00:00, 1477.72 it/sec, obj=-0.913]
    INFO - 00:09:53:     39%|███▉      | 39/100 [00:00<00:00, 1481.48 it/sec, obj=-2.38]
    INFO - 00:09:53:     40%|████      | 40/100 [00:00<00:00, 1485.20 it/sec, obj=1.07]
    INFO - 00:09:53:     41%|████      | 41/100 [00:00<00:00, 1480.90 it/sec, obj=3.77]
    INFO - 00:09:53:     42%|████▏     | 42/100 [00:00<00:00, 1483.46 it/sec, obj=-1.88]
    INFO - 00:09:53:     43%|████▎     | 43/100 [00:00<00:00, 1485.10 it/sec, obj=0.116]
    INFO - 00:09:53:     44%|████▍     | 44/100 [00:00<00:00, 1488.19 it/sec, obj=-1.51]
    INFO - 00:09:53:     45%|████▌     | 45/100 [00:00<00:00, 1491.54 it/sec, obj=-0.0194]
    INFO - 00:09:53:     46%|████▌     | 46/100 [00:00<00:00, 1494.61 it/sec, obj=0.984]
    INFO - 00:09:53:     47%|████▋     | 47/100 [00:00<00:00, 1497.68 it/sec, obj=-0.34]
    INFO - 00:09:53:     48%|████▊     | 48/100 [00:00<00:00, 1491.46 it/sec, obj=-0.941]
    INFO - 00:09:53:     49%|████▉     | 49/100 [00:00<00:00, 1492.55 it/sec, obj=0.363]
    INFO - 00:09:53:     50%|█████     | 50/100 [00:00<00:00, 1495.10 it/sec, obj=-1.01]
    INFO - 00:09:53:     51%|█████     | 51/100 [00:00<00:00, 1497.69 it/sec, obj=-0.359]
    INFO - 00:09:53:     52%|█████▏    | 52/100 [00:00<00:00, 1500.24 it/sec, obj=-3.06]
    INFO - 00:09:53:     53%|█████▎    | 53/100 [00:00<00:00, 1502.64 it/sec, obj=2.34]
    INFO - 00:09:53:     54%|█████▍    | 54/100 [00:00<00:00, 1503.78 it/sec, obj=-0.262]
    INFO - 00:09:53:     55%|█████▌    | 55/100 [00:00<00:00, 1506.13 it/sec, obj=0.812]
    INFO - 00:09:53:     56%|█████▌    | 56/100 [00:00<00:00, 1507.77 it/sec, obj=-2.47]
    INFO - 00:09:53:     57%|█████▋    | 57/100 [00:00<00:00, 1510.04 it/sec, obj=1.49]
    INFO - 00:09:53:     58%|█████▊    | 58/100 [00:00<00:00, 1512.39 it/sec, obj=0.268]
    INFO - 00:09:53:     59%|█████▉    | 59/100 [00:00<00:00, 1514.47 it/sec, obj=0.559]
    INFO - 00:09:53:     60%|██████    | 60/100 [00:00<00:00, 1515.43 it/sec, obj=-2.01]
    INFO - 00:09:53:     61%|██████    | 61/100 [00:00<00:00, 1517.15 it/sec, obj=-0.854]
    INFO - 00:09:53:     62%|██████▏   | 62/100 [00:00<00:00, 1518.29 it/sec, obj=1.61]
    INFO - 00:09:53:     63%|██████▎   | 63/100 [00:00<00:00, 1519.97 it/sec, obj=-2.64]
    INFO - 00:09:53:     64%|██████▍   | 64/100 [00:00<00:00, 1521.72 it/sec, obj=0.818]
    INFO - 00:09:53:     65%|██████▌   | 65/100 [00:00<00:00, 1523.59 it/sec, obj=1.04]
    INFO - 00:09:53:     66%|██████▌   | 66/100 [00:00<00:00, 1525.45 it/sec, obj=-0.832]
    INFO - 00:09:53:     67%|██████▋   | 67/100 [00:00<00:00, 1526.05 it/sec, obj=0.692]
    INFO - 00:09:53:     68%|██████▊   | 68/100 [00:00<00:00, 1527.64 it/sec, obj=-3.33]
    INFO - 00:09:53:     69%|██████▉   | 69/100 [00:00<00:00, 1528.43 it/sec, obj=0.47]
    INFO - 00:09:53:     70%|███████   | 70/100 [00:00<00:00, 1529.87 it/sec, obj=0.445]
    INFO - 00:09:53:     71%|███████   | 71/100 [00:00<00:00, 1531.42 it/sec, obj=0.402]
    INFO - 00:09:53:     72%|███████▏  | 72/100 [00:00<00:00, 1533.01 it/sec, obj=2.77]
    INFO - 00:09:53:     73%|███████▎  | 73/100 [00:00<00:00, 1533.48 it/sec, obj=-0.256]
    INFO - 00:09:53:     74%|███████▍  | 74/100 [00:00<00:00, 1534.71 it/sec, obj=3.36]
    INFO - 00:09:53:     75%|███████▌  | 75/100 [00:00<00:00, 1535.52 it/sec, obj=-0.229]
    INFO - 00:09:53:     76%|███████▌  | 76/100 [00:00<00:00, 1536.61 it/sec, obj=-0.739]
    INFO - 00:09:53:     77%|███████▋  | 77/100 [00:00<00:00, 1528.47 it/sec, obj=0.808]
    INFO - 00:09:53:     78%|███████▊  | 78/100 [00:00<00:00, 1528.94 it/sec, obj=-0.377]
    INFO - 00:09:53:     79%|███████▉  | 79/100 [00:00<00:00, 1529.12 it/sec, obj=0.708]
    INFO - 00:09:53:     80%|████████  | 80/100 [00:00<00:00, 1530.28 it/sec, obj=-0.874]
    INFO - 00:09:53:     81%|████████  | 81/100 [00:00<00:00, 1531.11 it/sec, obj=-1.29]
    INFO - 00:09:53:     82%|████████▏ | 82/100 [00:00<00:00, 1532.28 it/sec, obj=0.505]
    INFO - 00:09:53:     83%|████████▎ | 83/100 [00:00<00:00, 1533.66 it/sec, obj=1.99]
    INFO - 00:09:53:     84%|████████▍ | 84/100 [00:00<00:00, 1534.11 it/sec, obj=0.574]
    INFO - 00:09:53:     85%|████████▌ | 85/100 [00:00<00:00, 1535.27 it/sec, obj=-2.06]
    INFO - 00:09:53:     86%|████████▌ | 86/100 [00:00<00:00, 1535.10 it/sec, obj=-1.49]
    INFO - 00:09:53:     87%|████████▋ | 87/100 [00:00<00:00, 1534.62 it/sec, obj=0.61]
    INFO - 00:09:53:     88%|████████▊ | 88/100 [00:00<00:00, 1535.51 it/sec, obj=0.542]
    INFO - 00:09:53:     89%|████████▉ | 89/100 [00:00<00:00, 1529.24 it/sec, obj=-1.5]
    INFO - 00:09:53:     90%|█████████ | 90/100 [00:00<00:00, 1529.65 it/sec, obj=0.201]
    INFO - 00:09:53:     91%|█████████ | 91/100 [00:00<00:00, 1529.73 it/sec, obj=0.949]
    INFO - 00:09:53:     92%|█████████▏| 92/100 [00:00<00:00, 1530.53 it/sec, obj=-1.86]
    INFO - 00:09:53:     93%|█████████▎| 93/100 [00:00<00:00, 1531.21 it/sec, obj=-0.0722]
    INFO - 00:09:53:     94%|█████████▍| 94/100 [00:00<00:00, 1532.21 it/sec, obj=-0.407]
    INFO - 00:09:53:     95%|█████████▌| 95/100 [00:00<00:00, 1533.41 it/sec, obj=0.194]
    INFO - 00:09:53:     96%|█████████▌| 96/100 [00:00<00:00, 1534.61 it/sec, obj=-0.207]
    INFO - 00:09:53:     97%|█████████▋| 97/100 [00:00<00:00, 1535.79 it/sec, obj=0.462]
    INFO - 00:09:53:     98%|█████████▊| 98/100 [00:00<00:00, 1536.24 it/sec, obj=-2.37]
    INFO - 00:09:53:     99%|█████████▉| 99/100 [00:00<00:00, 1537.29 it/sec, obj=1.32]
    INFO - 00:09:53:    100%|██████████| 100/100 [00:00<00:00, 1537.88 it/sec, obj=-2.21]
    INFO - 00:09:53: Optimization result:
    INFO - 00:09:53:    Optimizer info:
    INFO - 00:09:53:       Status: None
    INFO - 00:09:53:       Message: None
    INFO - 00:09:53:       Number of calls to the objective function by the optimizer: 100
    INFO - 00:09:53:    Solution:
    INFO - 00:09:53:       Objective: -3.3284373246961634
    INFO - 00:09:53:       Design space:
    INFO - 00:09:53:          +------+-------------+--------------------+-------------+-------+-------------------------+
    INFO - 00:09:53:          | Name | Lower bound |       Value        | Upper bound | Type  |       Distribution      |
    INFO - 00:09:53:          +------+-------------+--------------------+-------------+-------+-------------------------+
    INFO - 00:09:53:          | x    |      -2     | -1.959995425007306 |      2      | float |                         |
    INFO - 00:09:53:          | y    |     -inf    | -1.368441899688857 |     inf     | float | norm(mu=0.0, sigma=1.0) |
    INFO - 00:09:53:          +------+-------------+--------------------+-------------+-------+-------------------------+
    INFO - 00:09:53: *** End DOEScenario execution (time: 0:00:00.091167) ***

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

We can export the optimization problem to a Dataset:

dataset = scenario.to_dataset(name="samples")

and visualize it in a tabular way:

dataset
GROUP designs functions
VARIABLE x y z
COMPONENT 0 0 0
1 1.869403 1.246453 3.115855
2 -1.567970 3.285041 1.717071
3 0.282640 -0.101706 0.180934
4 1.916313 1.848317 3.764630
5 1.562653 0.586038 2.148691
... ... ... ...
6 0.120633 -0.327477 -0.206844
7 -0.999225 1.461403 0.462178
8 -1.396066 -0.972779 -2.368845
9 1.090093 0.225565 1.315658
10 -1.433207 -0.779330 -2.212536

100 rows × 3 columns



or with a graphical post-processing, e.g. a scatter plot matrix:

ScatterMatrix(dataset).execute(save=False, show=True)
plot u 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 extract it:

uncertain_space = parameter_space.extract_uncertain_space()

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

scenario = create_scenario(
    [discipline], "DisciplinaryOpt", "z", uncertain_space, scenario_type="DOE"
)
scenario.execute({"algo": "lhs", "n_samples": 100})
    INFO - 00:09:53:
    INFO - 00:09:53: *** Start DOEScenario execution ***
    INFO - 00:09:53: DOEScenario
    INFO - 00:09:53:    Disciplines: AnalyticDiscipline
    INFO - 00:09:53:    MDO formulation: DisciplinaryOpt
    INFO - 00:09:53: Optimization problem:
    INFO - 00:09:53:    minimize z(y)
    INFO - 00:09:53:    with respect to y
    INFO - 00:09:53:    over the design space:
    INFO - 00:09:53:       +------+-------------------------+
    INFO - 00:09:53:       | Name |       Distribution      |
    INFO - 00:09:53:       +------+-------------------------+
    INFO - 00:09:53:       |  y   | norm(mu=0.0, sigma=1.0) |
    INFO - 00:09:53:       +------+-------------------------+
    INFO - 00:09:53: Solving optimization problem with algorithm lhs:
    INFO - 00:09:53:      1%|          | 1/100 [00:00<00:00, 1470.65 it/sec, obj=-0.641]
    INFO - 00:09:53:      2%|▏         | 2/100 [00:00<00:00, 1451.57 it/sec, obj=-0.394]
    INFO - 00:09:53:      3%|▎         | 3/100 [00:00<00:00, 1491.75 it/sec, obj=0.551]
    INFO - 00:09:53:      4%|▍         | 4/100 [00:00<00:00, 1499.04 it/sec, obj=0.944]
    INFO - 00:09:53:      5%|▌         | 5/100 [00:00<00:00, 1533.12 it/sec, obj=-2.12]
    INFO - 00:09:53:      6%|▌         | 6/100 [00:00<00:00, 1544.01 it/sec, obj=-1.64]
    INFO - 00:09:53:      7%|▋         | 7/100 [00:00<00:00, 1553.61 it/sec, obj=0.656]
    INFO - 00:09:53:      8%|▊         | 8/100 [00:00<00:00, 1561.83 it/sec, obj=-0.612]
    INFO - 00:09:53:      9%|▉         | 9/100 [00:00<00:00, 1568.88 it/sec, obj=0.736]
    INFO - 00:09:53:     10%|█         | 10/100 [00:00<00:00, 1560.79 it/sec, obj=0.36]
    INFO - 00:09:53:     11%|█         | 11/100 [00:00<00:00, 1554.39 it/sec, obj=-0.31]
    INFO - 00:09:53:     12%|█▏        | 12/100 [00:00<00:00, 1553.35 it/sec, obj=0.324]
    INFO - 00:09:53:     13%|█▎        | 13/100 [00:00<00:00, 1554.77 it/sec, obj=-1.73]
    INFO - 00:09:53:     14%|█▍        | 14/100 [00:00<00:00, 1558.56 it/sec, obj=0.494]
    INFO - 00:09:53:     15%|█▌        | 15/100 [00:00<00:00, 1561.85 it/sec, obj=-0.148]
    INFO - 00:09:53:     16%|█▌        | 16/100 [00:00<00:00, 1565.15 it/sec, obj=1.1]
    INFO - 00:09:53:     17%|█▋        | 17/100 [00:00<00:00, 1563.08 it/sec, obj=-0.716]
    INFO - 00:09:53:     18%|█▊        | 18/100 [00:00<00:00, 1565.30 it/sec, obj=0.0421]
    INFO - 00:09:53:     19%|█▉        | 19/100 [00:00<00:00, 1564.52 it/sec, obj=0.256]
    INFO - 00:09:53:     20%|██        | 20/100 [00:00<00:00, 1566.97 it/sec, obj=-1.45]
    INFO - 00:09:53:     21%|██        | 21/100 [00:00<00:00, 1568.49 it/sec, obj=0.637]
    INFO - 00:09:53:     22%|██▏       | 22/100 [00:00<00:00, 1570.26 it/sec, obj=1.97]
    INFO - 00:09:53:     23%|██▎       | 23/100 [00:00<00:00, 1569.04 it/sec, obj=-0.208]
    INFO - 00:09:53:     24%|██▍       | 24/100 [00:00<00:00, 1570.46 it/sec, obj=0.18]
    INFO - 00:09:53:     25%|██▌       | 25/100 [00:00<00:00, 1569.68 it/sec, obj=0.000485]
    INFO - 00:09:53:     26%|██▌       | 26/100 [00:00<00:00, 1569.70 it/sec, obj=1.17]
    INFO - 00:09:53:     27%|██▋       | 27/100 [00:00<00:00, 1570.25 it/sec, obj=-0.305]
    INFO - 00:09:53:     28%|██▊       | 28/100 [00:00<00:00, 1571.59 it/sec, obj=0.68]
    INFO - 00:09:53:     29%|██▉       | 29/100 [00:00<00:00, 1570.86 it/sec, obj=-0.932]
    INFO - 00:09:53:     30%|███       | 30/100 [00:00<00:00, 1572.25 it/sec, obj=0.901]
    INFO - 00:09:53:     31%|███       | 31/100 [00:00<00:00, 1572.23 it/sec, obj=0.454]
    INFO - 00:09:53:     32%|███▏      | 32/100 [00:00<00:00, 1573.52 it/sec, obj=-1.16]
    INFO - 00:09:53:     33%|███▎      | 33/100 [00:00<00:00, 1574.89 it/sec, obj=1.44]
    INFO - 00:09:53:     34%|███▍      | 34/100 [00:00<00:00, 1576.27 it/sec, obj=0.798]
    INFO - 00:09:53:     35%|███▌      | 35/100 [00:00<00:00, 1577.48 it/sec, obj=1.59]
    INFO - 00:09:53:     36%|███▌      | 36/100 [00:00<00:00, 1576.10 it/sec, obj=2.05]
    INFO - 00:09:53:     37%|███▋      | 37/100 [00:00<00:00, 1576.93 it/sec, obj=-0.26]
    INFO - 00:09:53:     38%|███▊      | 38/100 [00:00<00:00, 1576.77 it/sec, obj=0.874]
    INFO - 00:09:53:     39%|███▉      | 39/100 [00:00<00:00, 1577.87 it/sec, obj=0.832]
    INFO - 00:09:53:     40%|████      | 40/100 [00:00<00:00, 1579.02 it/sec, obj=-1.38]
    INFO - 00:09:53:     41%|████      | 41/100 [00:00<00:00, 1580.05 it/sec, obj=1.52]
    INFO - 00:09:53:     42%|████▏     | 42/100 [00:00<00:00, 1578.57 it/sec, obj=-0.522]
    INFO - 00:09:53:     43%|████▎     | 43/100 [00:00<00:00, 1581.22 it/sec, obj=1.4]
    INFO - 00:09:53:     44%|████▍     | 44/100 [00:00<00:00, 1581.73 it/sec, obj=-0.484]
    INFO - 00:09:53:     45%|████▌     | 45/100 [00:00<00:00, 1582.23 it/sec, obj=-0.91]
    INFO - 00:09:53:     46%|████▌     | 46/100 [00:00<00:00, 1583.00 it/sec, obj=0.343]
    INFO - 00:09:53:     47%|████▋     | 47/100 [00:00<00:00, 1583.93 it/sec, obj=-0.441]
    INFO - 00:09:53:     48%|████▊     | 48/100 [00:00<00:00, 1584.82 it/sec, obj=-0.871]
    INFO - 00:09:53:     49%|████▉     | 49/100 [00:00<00:00, 1583.74 it/sec, obj=2.67]
    INFO - 00:09:53:     50%|█████     | 50/100 [00:00<00:00, 1584.61 it/sec, obj=0.217]
    INFO - 00:09:53:     51%|█████     | 51/100 [00:00<00:00, 1583.27 it/sec, obj=-0.425]
    INFO - 00:09:53:     52%|█████▏    | 52/100 [00:00<00:00, 1584.04 it/sec, obj=0.113]
    INFO - 00:09:53:     53%|█████▎    | 53/100 [00:00<00:00, 1584.64 it/sec, obj=-0.377]
    INFO - 00:09:53:     54%|█████▍    | 54/100 [00:00<00:00, 1585.22 it/sec, obj=-1.19]
    INFO - 00:09:53:     55%|█████▌    | 55/100 [00:00<00:00, 1584.59 it/sec, obj=-0.528]
    INFO - 00:09:53:     56%|█████▌    | 56/100 [00:00<00:00, 1585.14 it/sec, obj=-2.64]
    INFO - 00:09:53:     57%|█████▋    | 57/100 [00:00<00:00, 1585.05 it/sec, obj=-0.0776]
    INFO - 00:09:53:     58%|█████▊    | 58/100 [00:00<00:00, 1585.61 it/sec, obj=1.08]
    INFO - 00:09:53:     59%|█████▉    | 59/100 [00:00<00:00, 1586.27 it/sec, obj=-2.05]
    INFO - 00:09:53:     60%|██████    | 60/100 [00:00<00:00, 1586.99 it/sec, obj=0.0555]
    INFO - 00:09:53:     61%|██████    | 61/100 [00:00<00:00, 1586.51 it/sec, obj=-1.84]
    INFO - 00:09:53:     62%|██████▏   | 62/100 [00:00<00:00, 1586.98 it/sec, obj=0.4]
    INFO - 00:09:53:     63%|██████▎   | 63/100 [00:00<00:00, 1586.92 it/sec, obj=-0.195]
    INFO - 00:09:53:     64%|██████▍   | 64/100 [00:00<00:00, 1587.38 it/sec, obj=-0.578]
    INFO - 00:09:53:     65%|██████▌   | 65/100 [00:00<00:00, 1583.89 it/sec, obj=-0.977]
    INFO - 00:09:53:     66%|██████▌   | 66/100 [00:00<00:00, 1576.55 it/sec, obj=-0.114]
    INFO - 00:09:53:     67%|██████▋   | 67/100 [00:00<00:00, 1575.02 it/sec, obj=0.587]
    INFO - 00:09:53:     68%|██████▊   | 68/100 [00:00<00:00, 1576.61 it/sec, obj=-0.0679]
    INFO - 00:09:53:     69%|██████▉   | 69/100 [00:00<00:00, 1577.20 it/sec, obj=-0.0218]
    INFO - 00:09:53:     70%|███████   | 70/100 [00:00<00:00, 1577.42 it/sec, obj=-0.228]
    INFO - 00:09:53:     71%|███████   | 71/100 [00:00<00:00, 1577.89 it/sec, obj=1.21]
    INFO - 00:09:53:     72%|███████▏  | 72/100 [00:00<00:00, 1578.40 it/sec, obj=-0.34]
    INFO - 00:09:53:     73%|███████▎  | 73/100 [00:00<00:00, 1578.80 it/sec, obj=0.513]
    INFO - 00:09:53:     74%|███████▍  | 74/100 [00:00<00:00, 1577.86 it/sec, obj=1.67]
    INFO - 00:09:53:     75%|███████▌  | 75/100 [00:00<00:00, 1578.39 it/sec, obj=0.557]
    INFO - 00:09:53:     76%|███████▌  | 76/100 [00:00<00:00, 1578.15 it/sec, obj=0.431]
    INFO - 00:09:53:     77%|███████▋  | 77/100 [00:00<00:00, 1569.84 it/sec, obj=-1.31]
    INFO - 00:09:53:     78%|███████▊  | 78/100 [00:00<00:00, 1569.70 it/sec, obj=-0.678]
    INFO - 00:09:53:     79%|███████▉  | 79/100 [00:00<00:00, 1569.90 it/sec, obj=-1.01]
    INFO - 00:09:53:     80%|████████  | 80/100 [00:00<00:00, 1569.31 it/sec, obj=0.246]
    INFO - 00:09:53:     81%|████████  | 81/100 [00:00<00:00, 1569.43 it/sec, obj=1.29]
    INFO - 00:09:53:     82%|████████▏ | 82/100 [00:00<00:00, 1569.81 it/sec, obj=0.75]
    INFO - 00:09:53:     83%|████████▎ | 83/100 [00:00<00:00, 1570.32 it/sec, obj=-1.54]
    INFO - 00:09:53:     84%|████████▍ | 84/100 [00:00<00:00, 1566.83 it/sec, obj=-0.156]
    INFO - 00:09:53:     85%|████████▌ | 85/100 [00:00<00:00, 1567.27 it/sec, obj=1.87]
    INFO - 00:09:53:     86%|████████▌ | 86/100 [00:00<00:00, 1566.83 it/sec, obj=-1.08]
    INFO - 00:09:53:     87%|████████▋ | 87/100 [00:00<00:00, 1567.48 it/sec, obj=-0.647]
    INFO - 00:09:53:     88%|████████▊ | 88/100 [00:00<00:00, 1567.52 it/sec, obj=0.968]
    INFO - 00:09:53:     89%|████████▉ | 89/100 [00:00<00:00, 1568.08 it/sec, obj=-0.773]
    INFO - 00:09:53:     90%|█████████ | 90/100 [00:00<00:00, 1568.64 it/sec, obj=1.26]
    INFO - 00:09:53:     91%|█████████ | 91/100 [00:00<00:00, 1569.23 it/sec, obj=0.166]
    INFO - 00:09:53:     92%|█████████▏| 92/100 [00:00<00:00, 1568.87 it/sec, obj=0.29]
    INFO - 00:09:53:     93%|█████████▎| 93/100 [00:00<00:00, 1569.22 it/sec, obj=0.127]
    INFO - 00:09:53:     94%|█████████▍| 94/100 [00:00<00:00, 1569.11 it/sec, obj=-1.26]
    INFO - 00:09:53:     95%|█████████▌| 95/100 [00:00<00:00, 1569.50 it/sec, obj=1.01]
    INFO - 00:09:53:     96%|█████████▌| 96/100 [00:00<00:00, 1569.99 it/sec, obj=0.0819]
    INFO - 00:09:53:     97%|█████████▋| 97/100 [00:00<00:00, 1570.46 it/sec, obj=-1.09]
    INFO - 00:09:53:     98%|█████████▊| 98/100 [00:00<00:00, 1570.27 it/sec, obj=-0.762]
    INFO - 00:09:53:     99%|█████████▉| 99/100 [00:00<00:00, 1570.41 it/sec, obj=-0.0429]
    INFO - 00:09:53:    100%|██████████| 100/100 [00:00<00:00, 1570.50 it/sec, obj=-0.813]
    INFO - 00:09:53: Optimization result:
    INFO - 00:09:53:    Optimizer info:
    INFO - 00:09:53:       Status: None
    INFO - 00:09:53:       Message: None
    INFO - 00:09:53:       Number of calls to the objective function by the optimizer: 100
    INFO - 00:09:53:    Solution:
    INFO - 00:09:53:       Objective: -2.6379682068246657
    INFO - 00:09:53:       Design space:
    INFO - 00:09:53:          +------+-------------------------+
    INFO - 00:09:53:          | Name |       Distribution      |
    INFO - 00:09:53:          +------+-------------------------+
    INFO - 00:09:53:          |  y   | norm(mu=0.0, sigma=1.0) |
    INFO - 00:09:53:          +------+-------------------------+
    INFO - 00:09:53: *** End DOEScenario execution (time: 0:00:00.087823) ***

{'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(name="samples")
dataset
GROUP designs functions
VARIABLE y z
COMPONENT 0 0
1 -0.640726 -0.640726
2 -0.393653 -0.393653
3 0.550565 0.550565
4 0.944369 0.944369
5 -2.115275 -2.115275
... ... ...
6 0.081947 0.081947
7 -1.085812 -1.085812
8 -0.761651 -0.761651
9 -0.042932 -0.042932
10 -0.813354 -0.813354

100 rows × 2 columns



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

Gallery generated by Sphinx-Gallery