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([-0.19983476])}, {'y': array([0.94788092])}]

or as a dictionary:

sample = parameter_space.compute_samples(n_samples=4)
sample
array([[-1.14291275],
       [-0.69953835],
       [ 0.7629004 ],
       [-0.3284798 ]])

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 - 01:05:03:
    INFO - 01:05:03: *** Start DOEScenario execution ***
    INFO - 01:05:03: DOEScenario
    INFO - 01:05:03:    Disciplines: AnalyticDiscipline
    INFO - 01:05:03:    MDO formulation: DisciplinaryOpt
    INFO - 01:05:03: Optimization problem:
    INFO - 01:05:03:    minimize z(x, y)
    INFO - 01:05:03:    with respect to x, y
    INFO - 01:05:03:    over the design space:
    INFO - 01:05:03:       +------+-------------+-------+-------------+-------+-------------------------+
    INFO - 01:05:03:       | Name | Lower bound | Value | Upper bound | Type  |       Distribution      |
    INFO - 01:05:03:       +------+-------------+-------+-------------+-------+-------------------------+
    INFO - 01:05:03:       | x    |      -2     |  None |      2      | float |                         |
    INFO - 01:05:03:       | y    |     -inf    |   0   |     inf     | float | norm(mu=0.0, sigma=1.0) |
    INFO - 01:05:03:       +------+-------------+-------+-------------+-------+-------------------------+
    INFO - 01:05:03: Solving optimization problem with algorithm lhs:
    INFO - 01:05:03:      1%|          | 1/100 [00:00<00:00, 477.98 it/sec, obj=3.12]
    INFO - 01:05:03:      2%|▏         | 2/100 [00:00<00:00, 753.22 it/sec, obj=1.72]
    INFO - 01:05:03:      3%|▎         | 3/100 [00:00<00:00, 940.64 it/sec, obj=0.181]
    INFO - 01:05:03:      4%|▍         | 4/100 [00:00<00:00, 1072.64 it/sec, obj=3.76]
    INFO - 01:05:03:      5%|▌         | 5/100 [00:00<00:00, 1180.43 it/sec, obj=2.15]
    INFO - 01:05:03:      6%|▌         | 6/100 [00:00<00:00, 1266.01 it/sec, obj=-0.666]
    INFO - 01:05:03:      7%|▋         | 7/100 [00:00<00:00, 1335.34 it/sec, obj=1.53]
    INFO - 01:05:03:      8%|▊         | 8/100 [00:00<00:00, 1392.18 it/sec, obj=1.7]
    INFO - 01:05:03:      9%|▉         | 9/100 [00:00<00:00, 1440.02 it/sec, obj=-2.27]
    INFO - 01:05:03:     10%|█         | 10/100 [00:00<00:00, 1479.99 it/sec, obj=-2.08]
    INFO - 01:05:03:     11%|█         | 11/100 [00:00<00:00, 1510.87 it/sec, obj=-2.8]
    INFO - 01:05:03:     12%|█▏        | 12/100 [00:00<00:00, 1534.69 it/sec, obj=-1.31]
    INFO - 01:05:03:     13%|█▎        | 13/100 [00:00<00:00, 1561.27 it/sec, obj=1.1]
    INFO - 01:05:03:     14%|█▍        | 14/100 [00:00<00:00, 1584.93 it/sec, obj=0.38]
    INFO - 01:05:03:     15%|█▌        | 15/100 [00:00<00:00, 1605.78 it/sec, obj=1.68]
    INFO - 01:05:03:     16%|█▌        | 16/100 [00:00<00:00, 1624.75 it/sec, obj=0.672]
    INFO - 01:05:03:     17%|█▋        | 17/100 [00:00<00:00, 1641.38 it/sec, obj=0.643]
    INFO - 01:05:03:     18%|█▊        | 18/100 [00:00<00:00, 1654.12 it/sec, obj=0.568]
    INFO - 01:05:03:     19%|█▉        | 19/100 [00:00<00:00, 1663.54 it/sec, obj=-0.277]
    INFO - 01:05:03:     20%|██        | 20/100 [00:00<00:00, 1668.68 it/sec, obj=1.51]
    INFO - 01:05:03:     21%|██        | 21/100 [00:00<00:00, 1679.29 it/sec, obj=1.83]
    INFO - 01:05:03:     22%|██▏       | 22/100 [00:00<00:00, 1689.67 it/sec, obj=2.12]
    INFO - 01:05:03:     23%|██▎       | 23/100 [00:00<00:00, 1696.90 it/sec, obj=0.526]
    INFO - 01:05:03:     24%|██▍       | 24/100 [00:00<00:00, 1704.37 it/sec, obj=1.47]
    INFO - 01:05:03:     25%|██▌       | 25/100 [00:00<00:00, 1706.08 it/sec, obj=-1.49]
    INFO - 01:05:03:     26%|██▌       | 26/100 [00:00<00:00, 1710.16 it/sec, obj=-1.58]
    INFO - 01:05:03:     27%|██▋       | 27/100 [00:00<00:00, 1713.57 it/sec, obj=1.59]
    INFO - 01:05:03:     28%|██▊       | 28/100 [00:00<00:00, 1720.06 it/sec, obj=0.329]
    INFO - 01:05:03:     29%|██▉       | 29/100 [00:00<00:00, 1726.05 it/sec, obj=-1.46]
    INFO - 01:05:03:     30%|███       | 30/100 [00:00<00:00, 1731.97 it/sec, obj=-0.045]
    INFO - 01:05:03:     31%|███       | 31/100 [00:00<00:00, 1737.61 it/sec, obj=-0.736]
    INFO - 01:05:03:     32%|███▏      | 32/100 [00:00<00:00, 1742.68 it/sec, obj=0.867]
    INFO - 01:05:03:     33%|███▎      | 33/100 [00:00<00:00, 1745.97 it/sec, obj=-3.12]
    INFO - 01:05:03:     34%|███▍      | 34/100 [00:00<00:00, 1747.93 it/sec, obj=-0.252]
    INFO - 01:05:03:     35%|███▌      | 35/100 [00:00<00:00, 1752.03 it/sec, obj=1.46]
    INFO - 01:05:03:     36%|███▌      | 36/100 [00:00<00:00, 1756.35 it/sec, obj=-2.02]
    INFO - 01:05:03:     37%|███▋      | 37/100 [00:00<00:00, 1760.29 it/sec, obj=-1.68]
    INFO - 01:05:03:     38%|███▊      | 38/100 [00:00<00:00, 1755.17 it/sec, obj=-0.913]
    INFO - 01:05:03:     39%|███▉      | 39/100 [00:00<00:00, 1757.62 it/sec, obj=-2.38]
    INFO - 01:05:03:     40%|████      | 40/100 [00:00<00:00, 1760.81 it/sec, obj=1.07]
    INFO - 01:05:03:     41%|████      | 41/100 [00:00<00:00, 1762.37 it/sec, obj=3.77]
    INFO - 01:05:03:     42%|████▏     | 42/100 [00:00<00:00, 1762.89 it/sec, obj=-1.88]
    INFO - 01:05:03:     43%|████▎     | 43/100 [00:00<00:00, 1763.81 it/sec, obj=0.116]
    INFO - 01:05:03:     44%|████▍     | 44/100 [00:00<00:00, 1765.89 it/sec, obj=-1.51]
    INFO - 01:05:03:     45%|████▌     | 45/100 [00:00<00:00, 1768.54 it/sec, obj=-0.0194]
    INFO - 01:05:03:     46%|████▌     | 46/100 [00:00<00:00, 1771.29 it/sec, obj=0.984]
    INFO - 01:05:03:     47%|████▋     | 47/100 [00:00<00:00, 1773.51 it/sec, obj=-0.34]
    INFO - 01:05:03:     48%|████▊     | 48/100 [00:00<00:00, 1774.60 it/sec, obj=-0.941]
    INFO - 01:05:03:     49%|████▉     | 49/100 [00:00<00:00, 1774.96 it/sec, obj=0.363]
    INFO - 01:05:03:     50%|█████     | 50/100 [00:00<00:00, 1776.99 it/sec, obj=-1.01]
    INFO - 01:05:03:     51%|█████     | 51/100 [00:00<00:00, 1779.18 it/sec, obj=-0.359]
    INFO - 01:05:03:     52%|█████▏    | 52/100 [00:00<00:00, 1780.96 it/sec, obj=-3.06]
    INFO - 01:05:03:     53%|█████▎    | 53/100 [00:00<00:00, 1782.73 it/sec, obj=2.34]
    INFO - 01:05:03:     54%|█████▍    | 54/100 [00:00<00:00, 1784.54 it/sec, obj=-0.262]
    INFO - 01:05:03:     55%|█████▌    | 55/100 [00:00<00:00, 1785.17 it/sec, obj=0.812]
    INFO - 01:05:03:     56%|█████▌    | 56/100 [00:00<00:00, 1785.19 it/sec, obj=-2.47]
    INFO - 01:05:03:     57%|█████▋    | 57/100 [00:00<00:00, 1786.17 it/sec, obj=1.49]
    INFO - 01:05:03:     58%|█████▊    | 58/100 [00:00<00:00, 1787.72 it/sec, obj=0.268]
    INFO - 01:05:03:     59%|█████▉    | 59/100 [00:00<00:00, 1788.68 it/sec, obj=0.559]
    INFO - 01:05:03:     60%|██████    | 60/100 [00:00<00:00, 1789.60 it/sec, obj=-2.01]
    INFO - 01:05:03:     61%|██████    | 61/100 [00:00<00:00, 1790.69 it/sec, obj=-0.854]
    INFO - 01:05:03:     62%|██████▏   | 62/100 [00:00<00:00, 1791.96 it/sec, obj=1.61]
    INFO - 01:05:03:     63%|██████▎   | 63/100 [00:00<00:00, 1791.78 it/sec, obj=-2.64]
    INFO - 01:05:03:     64%|██████▍   | 64/100 [00:00<00:00, 1790.98 it/sec, obj=0.818]
    INFO - 01:05:03:     65%|██████▌   | 65/100 [00:00<00:00, 1791.71 it/sec, obj=1.04]
    INFO - 01:05:03:     66%|██████▌   | 66/100 [00:00<00:00, 1792.73 it/sec, obj=-0.832]
    INFO - 01:05:03:     67%|██████▋   | 67/100 [00:00<00:00, 1793.62 it/sec, obj=0.692]
    INFO - 01:05:03:     68%|██████▊   | 68/100 [00:00<00:00, 1794.50 it/sec, obj=-3.33]
    INFO - 01:05:03:     69%|██████▉   | 69/100 [00:00<00:00, 1795.40 it/sec, obj=0.47]
    INFO - 01:05:03:     70%|███████   | 70/100 [00:00<00:00, 1795.44 it/sec, obj=0.445]
    INFO - 01:05:03:     71%|███████   | 71/100 [00:00<00:00, 1794.90 it/sec, obj=0.402]
    INFO - 01:05:03:     72%|███████▏  | 72/100 [00:00<00:00, 1795.44 it/sec, obj=2.77]
    INFO - 01:05:03:     73%|███████▎  | 73/100 [00:00<00:00, 1795.73 it/sec, obj=-0.256]
    INFO - 01:05:03:     74%|███████▍  | 74/100 [00:00<00:00, 1796.09 it/sec, obj=3.36]
    INFO - 01:05:03:     75%|███████▌  | 75/100 [00:00<00:00, 1796.72 it/sec, obj=-0.229]
    INFO - 01:05:03:     76%|███████▌  | 76/100 [00:00<00:00, 1797.26 it/sec, obj=-0.739]
    INFO - 01:05:03:     77%|███████▋  | 77/100 [00:00<00:00, 1796.82 it/sec, obj=0.808]
    INFO - 01:05:03:     78%|███████▊  | 78/100 [00:00<00:00, 1796.19 it/sec, obj=-0.377]
    INFO - 01:05:03:     79%|███████▉  | 79/100 [00:00<00:00, 1796.48 it/sec, obj=0.708]
    INFO - 01:05:03:     80%|████████  | 80/100 [00:00<00:00, 1796.80 it/sec, obj=-0.874]
    INFO - 01:05:03:     81%|████████  | 81/100 [00:00<00:00, 1797.28 it/sec, obj=-1.29]
    INFO - 01:05:03:     82%|████████▏ | 82/100 [00:00<00:00, 1797.50 it/sec, obj=0.505]
    INFO - 01:05:03:     83%|████████▎ | 83/100 [00:00<00:00, 1797.94 it/sec, obj=1.99]
    INFO - 01:05:03:     84%|████████▍ | 84/100 [00:00<00:00, 1798.36 it/sec, obj=0.574]
    INFO - 01:05:03:     85%|████████▌ | 85/100 [00:00<00:00, 1797.99 it/sec, obj=-2.06]
    INFO - 01:05:03:     86%|████████▌ | 86/100 [00:00<00:00, 1796.84 it/sec, obj=-1.49]
    INFO - 01:05:03:     87%|████████▋ | 87/100 [00:00<00:00, 1797.05 it/sec, obj=0.61]
    INFO - 01:05:03:     88%|████████▊ | 88/100 [00:00<00:00, 1797.09 it/sec, obj=0.542]
    INFO - 01:05:03:     89%|████████▉ | 89/100 [00:00<00:00, 1797.11 it/sec, obj=-1.5]
    INFO - 01:05:03:     90%|█████████ | 90/100 [00:00<00:00, 1796.97 it/sec, obj=0.201]
    INFO - 01:05:03:     91%|█████████ | 91/100 [00:00<00:00, 1796.70 it/sec, obj=0.949]
    INFO - 01:05:03:     92%|█████████▏| 92/100 [00:00<00:00, 1796.15 it/sec, obj=-1.86]
    INFO - 01:05:03:     93%|█████████▎| 93/100 [00:00<00:00, 1795.23 it/sec, obj=-0.0722]
    INFO - 01:05:03:     94%|█████████▍| 94/100 [00:00<00:00, 1795.00 it/sec, obj=-0.407]
    INFO - 01:05:03:     95%|█████████▌| 95/100 [00:00<00:00, 1795.07 it/sec, obj=0.194]
    INFO - 01:05:03:     96%|█████████▌| 96/100 [00:00<00:00, 1795.18 it/sec, obj=-0.207]
    INFO - 01:05:03:     97%|█████████▋| 97/100 [00:00<00:00, 1795.02 it/sec, obj=0.462]
    INFO - 01:05:03:     98%|█████████▊| 98/100 [00:00<00:00, 1794.64 it/sec, obj=-2.37]
    INFO - 01:05:03:     99%|█████████▉| 99/100 [00:00<00:00, 1794.13 it/sec, obj=1.32]
    INFO - 01:05:03:    100%|██████████| 100/100 [00:00<00:00, 1792.97 it/sec, obj=-2.21]
    INFO - 01:05:03: Optimization result:
    INFO - 01:05:03:    Optimizer info:
    INFO - 01:05:03:       Status: None
    INFO - 01:05:03:       Message: None
    INFO - 01:05:03:       Number of calls to the objective function by the optimizer: 100
    INFO - 01:05:03:    Solution:
    INFO - 01:05:03:       Objective: -3.3284373246961634
    INFO - 01:05:03:       Design space:
    INFO - 01:05:03:          +------+-------------+--------------------+-------------+-------+-------------------------+
    INFO - 01:05:03:          | Name | Lower bound |       Value        | Upper bound | Type  |       Distribution      |
    INFO - 01:05:03:          +------+-------------+--------------------+-------------+-------+-------------------------+
    INFO - 01:05:03:          | x    |      -2     | -1.959995425007306 |      2      | float |                         |
    INFO - 01:05:03:          | y    |     -inf    | -1.368441899688857 |     inf     | float | norm(mu=0.0, sigma=1.0) |
    INFO - 01:05:03:          +------+-------------+--------------------+-------------+-------+-------------------------+
    INFO - 01:05:03: *** End DOEScenario execution (time: 0:00:00.078099) ***

{'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 - 01:05:04:
    INFO - 01:05:04: *** Start DOEScenario execution ***
    INFO - 01:05:04: DOEScenario
    INFO - 01:05:04:    Disciplines: AnalyticDiscipline
    INFO - 01:05:04:    MDO formulation: DisciplinaryOpt
    INFO - 01:05:04: Optimization problem:
    INFO - 01:05:04:    minimize z(y)
    INFO - 01:05:04:    with respect to y
    INFO - 01:05:04:    over the design space:
    INFO - 01:05:04:       +------+-------------------------+
    INFO - 01:05:04:       | Name |       Distribution      |
    INFO - 01:05:04:       +------+-------------------------+
    INFO - 01:05:04:       |  y   | norm(mu=0.0, sigma=1.0) |
    INFO - 01:05:04:       +------+-------------------------+
    INFO - 01:05:04: Solving optimization problem with algorithm lhs:
    INFO - 01:05:04:      1%|          | 1/100 [00:00<00:00, 1899.59 it/sec, obj=-0.641]
    INFO - 01:05:04:      2%|▏         | 2/100 [00:00<00:00, 1891.03 it/sec, obj=-0.394]
    INFO - 01:05:04:      3%|▎         | 3/100 [00:00<00:00, 1906.79 it/sec, obj=0.551]
    INFO - 01:05:04:      4%|▍         | 4/100 [00:00<00:00, 1918.05 it/sec, obj=0.944]
    INFO - 01:05:04:      5%|▌         | 5/100 [00:00<00:00, 1929.13 it/sec, obj=-2.12]
    INFO - 01:05:04:      6%|▌         | 6/100 [00:00<00:00, 1934.34 it/sec, obj=-1.64]
    INFO - 01:05:04:      7%|▋         | 7/100 [00:00<00:00, 1931.71 it/sec, obj=0.656]
    INFO - 01:05:04:      8%|▊         | 8/100 [00:00<00:00, 1920.58 it/sec, obj=-0.612]
    INFO - 01:05:04:      9%|▉         | 9/100 [00:00<00:00, 1918.52 it/sec, obj=0.736]
    INFO - 01:05:04:     10%|█         | 10/100 [00:00<00:00, 1921.61 it/sec, obj=0.36]
    INFO - 01:05:04:     11%|█         | 11/100 [00:00<00:00, 1924.23 it/sec, obj=-0.31]
    INFO - 01:05:04:     12%|█▏        | 12/100 [00:00<00:00, 1927.46 it/sec, obj=0.324]
    INFO - 01:05:04:     13%|█▎        | 13/100 [00:00<00:00, 1930.33 it/sec, obj=-1.73]
    INFO - 01:05:04:     14%|█▍        | 14/100 [00:00<00:00, 1932.92 it/sec, obj=0.494]
    INFO - 01:05:04:     15%|█▌        | 15/100 [00:00<00:00, 1930.07 it/sec, obj=-0.148]
    INFO - 01:05:04:     16%|█▌        | 16/100 [00:00<00:00, 1924.16 it/sec, obj=1.1]
    INFO - 01:05:04:     17%|█▋        | 17/100 [00:00<00:00, 1923.89 it/sec, obj=-0.716]
    INFO - 01:05:04:     18%|█▊        | 18/100 [00:00<00:00, 1924.63 it/sec, obj=0.0421]
    INFO - 01:05:04:     19%|█▉        | 19/100 [00:00<00:00, 1924.88 it/sec, obj=0.256]
    INFO - 01:05:04:     20%|██        | 20/100 [00:00<00:00, 1925.18 it/sec, obj=-1.45]
    INFO - 01:05:04:     21%|██        | 21/100 [00:00<00:00, 1924.71 it/sec, obj=0.637]
    INFO - 01:05:04:     22%|██▏       | 22/100 [00:00<00:00, 1924.47 it/sec, obj=1.97]
    INFO - 01:05:04:     23%|██▎       | 23/100 [00:00<00:00, 1921.46 it/sec, obj=-0.208]
    INFO - 01:05:04:     24%|██▍       | 24/100 [00:00<00:00, 1915.68 it/sec, obj=0.18]
    INFO - 01:05:04:     25%|██▌       | 25/100 [00:00<00:00, 1914.51 it/sec, obj=0.000485]
    INFO - 01:05:04:     26%|██▌       | 26/100 [00:00<00:00, 1914.03 it/sec, obj=1.17]
    INFO - 01:05:04:     27%|██▋       | 27/100 [00:00<00:00, 1913.49 it/sec, obj=-0.305]
    INFO - 01:05:04:     28%|██▊       | 28/100 [00:00<00:00, 1912.65 it/sec, obj=0.68]
    INFO - 01:05:04:     29%|██▉       | 29/100 [00:00<00:00, 1912.41 it/sec, obj=-0.932]
    INFO - 01:05:04:     30%|███       | 30/100 [00:00<00:00, 1910.44 it/sec, obj=0.901]
    INFO - 01:05:04:     31%|███       | 31/100 [00:00<00:00, 1906.47 it/sec, obj=0.454]
    INFO - 01:05:04:     32%|███▏      | 32/100 [00:00<00:00, 1905.47 it/sec, obj=-1.16]
    INFO - 01:05:04:     33%|███▎      | 33/100 [00:00<00:00, 1905.06 it/sec, obj=1.44]
    INFO - 01:05:04:     34%|███▍      | 34/100 [00:00<00:00, 1904.82 it/sec, obj=0.798]
    INFO - 01:05:04:     35%|███▌      | 35/100 [00:00<00:00, 1904.28 it/sec, obj=1.59]
    INFO - 01:05:04:     36%|███▌      | 36/100 [00:00<00:00, 1903.50 it/sec, obj=2.05]
    INFO - 01:05:04:     37%|███▋      | 37/100 [00:00<00:00, 1903.21 it/sec, obj=-0.26]
    INFO - 01:05:04:     38%|███▊      | 38/100 [00:00<00:00, 1900.86 it/sec, obj=0.874]
    INFO - 01:05:04:     39%|███▉      | 39/100 [00:00<00:00, 1893.94 it/sec, obj=0.832]
    INFO - 01:05:04:     40%|████      | 40/100 [00:00<00:00, 1893.27 it/sec, obj=-1.38]
    INFO - 01:05:04:     41%|████      | 41/100 [00:00<00:00, 1892.63 it/sec, obj=1.52]
    INFO - 01:05:04:     42%|████▏     | 42/100 [00:00<00:00, 1891.94 it/sec, obj=-0.522]
    INFO - 01:05:04:     43%|████▎     | 43/100 [00:00<00:00, 1891.13 it/sec, obj=1.4]
    INFO - 01:05:04:     44%|████▍     | 44/100 [00:00<00:00, 1890.66 it/sec, obj=-0.484]
    INFO - 01:05:04:     45%|████▌     | 45/100 [00:00<00:00, 1888.65 it/sec, obj=-0.91]
    INFO - 01:05:04:     46%|████▌     | 46/100 [00:00<00:00, 1885.98 it/sec, obj=0.343]
    INFO - 01:05:04:     47%|████▋     | 47/100 [00:00<00:00, 1885.42 it/sec, obj=-0.441]
    INFO - 01:05:04:     48%|████▊     | 48/100 [00:00<00:00, 1885.22 it/sec, obj=-0.871]
    INFO - 01:05:04:     49%|████▉     | 49/100 [00:00<00:00, 1884.98 it/sec, obj=2.67]
    INFO - 01:05:04:     50%|█████     | 50/100 [00:00<00:00, 1884.91 it/sec, obj=0.217]
    INFO - 01:05:04:     51%|█████     | 51/100 [00:00<00:00, 1884.58 it/sec, obj=-0.425]
    INFO - 01:05:04:     52%|█████▏    | 52/100 [00:00<00:00, 1884.40 it/sec, obj=0.113]
    INFO - 01:05:04:     53%|█████▎    | 53/100 [00:00<00:00, 1880.74 it/sec, obj=-0.377]
    INFO - 01:05:04:     54%|█████▍    | 54/100 [00:00<00:00, 1879.76 it/sec, obj=-1.19]
    INFO - 01:05:04:     55%|█████▌    | 55/100 [00:00<00:00, 1879.47 it/sec, obj=-0.528]
    INFO - 01:05:04:     56%|█████▌    | 56/100 [00:00<00:00, 1879.29 it/sec, obj=-2.64]
    INFO - 01:05:04:     57%|█████▋    | 57/100 [00:00<00:00, 1879.11 it/sec, obj=-0.0776]
    INFO - 01:05:04:     58%|█████▊    | 58/100 [00:00<00:00, 1878.86 it/sec, obj=1.08]
    INFO - 01:05:04:     59%|█████▉    | 59/100 [00:00<00:00, 1878.27 it/sec, obj=-2.05]
    INFO - 01:05:04:     60%|██████    | 60/100 [00:00<00:00, 1877.01 it/sec, obj=0.0555]
    INFO - 01:05:04:     61%|██████    | 61/100 [00:00<00:00, 1875.12 it/sec, obj=-1.84]
    INFO - 01:05:04:     62%|██████▏   | 62/100 [00:00<00:00, 1874.68 it/sec, obj=0.4]
    INFO - 01:05:04:     63%|██████▎   | 63/100 [00:00<00:00, 1874.24 it/sec, obj=-0.195]
    INFO - 01:05:04:     64%|██████▍   | 64/100 [00:00<00:00, 1873.53 it/sec, obj=-0.578]
    INFO - 01:05:04:     65%|██████▌   | 65/100 [00:00<00:00, 1872.74 it/sec, obj=-0.977]
    INFO - 01:05:04:     66%|██████▌   | 66/100 [00:00<00:00, 1871.86 it/sec, obj=-0.114]
    INFO - 01:05:04:     67%|██████▋   | 67/100 [00:00<00:00, 1870.62 it/sec, obj=0.587]
    INFO - 01:05:04:     68%|██████▊   | 68/100 [00:00<00:00, 1868.32 it/sec, obj=-0.0679]
    INFO - 01:05:04:     69%|██████▉   | 69/100 [00:00<00:00, 1867.44 it/sec, obj=-0.0218]
    INFO - 01:05:04:     70%|███████   | 70/100 [00:00<00:00, 1866.54 it/sec, obj=-0.228]
    INFO - 01:05:04:     71%|███████   | 71/100 [00:00<00:00, 1865.58 it/sec, obj=1.21]
    INFO - 01:05:04:     72%|███████▏  | 72/100 [00:00<00:00, 1864.80 it/sec, obj=-0.34]
    INFO - 01:05:04:     73%|███████▎  | 73/100 [00:00<00:00, 1864.09 it/sec, obj=0.513]
    INFO - 01:05:04:     74%|███████▍  | 74/100 [00:00<00:00, 1862.67 it/sec, obj=1.67]
    INFO - 01:05:04:     75%|███████▌  | 75/100 [00:00<00:00, 1860.95 it/sec, obj=0.557]
    INFO - 01:05:04:     76%|███████▌  | 76/100 [00:00<00:00, 1860.27 it/sec, obj=0.431]
    INFO - 01:05:04:     77%|███████▋  | 77/100 [00:00<00:00, 1859.68 it/sec, obj=-1.31]
    INFO - 01:05:04:     78%|███████▊  | 78/100 [00:00<00:00, 1859.28 it/sec, obj=-0.678]
    INFO - 01:05:04:     79%|███████▉  | 79/100 [00:00<00:00, 1857.58 it/sec, obj=-1.01]
    INFO - 01:05:04:     80%|████████  | 80/100 [00:00<00:00, 1855.70 it/sec, obj=0.246]
    INFO - 01:05:04:     81%|████████  | 81/100 [00:00<00:00, 1852.82 it/sec, obj=1.29]
    INFO - 01:05:04:     82%|████████▏ | 82/100 [00:00<00:00, 1850.59 it/sec, obj=0.75]
    INFO - 01:05:04:     83%|████████▎ | 83/100 [00:00<00:00, 1849.58 it/sec, obj=-1.54]
    INFO - 01:05:04:     84%|████████▍ | 84/100 [00:00<00:00, 1849.21 it/sec, obj=-0.156]
    INFO - 01:05:04:     85%|████████▌ | 85/100 [00:00<00:00, 1848.48 it/sec, obj=1.87]
    INFO - 01:05:04:     86%|████████▌ | 86/100 [00:00<00:00, 1844.54 it/sec, obj=-1.08]
    INFO - 01:05:04:     87%|████████▋ | 87/100 [00:00<00:00, 1843.84 it/sec, obj=-0.647]
    INFO - 01:05:04:     88%|████████▊ | 88/100 [00:00<00:00, 1842.91 it/sec, obj=0.968]
    INFO - 01:05:04:     89%|████████▉ | 89/100 [00:00<00:00, 1841.30 it/sec, obj=-0.773]
    INFO - 01:05:04:     90%|█████████ | 90/100 [00:00<00:00, 1840.33 it/sec, obj=1.26]
    INFO - 01:05:04:     91%|█████████ | 91/100 [00:00<00:00, 1839.86 it/sec, obj=0.166]
    INFO - 01:05:04:     92%|█████████▏| 92/100 [00:00<00:00, 1839.31 it/sec, obj=0.29]
    INFO - 01:05:04:     93%|█████████▎| 93/100 [00:00<00:00, 1838.52 it/sec, obj=0.127]
    INFO - 01:05:04:     94%|█████████▍| 94/100 [00:00<00:00, 1837.89 it/sec, obj=-1.26]
    INFO - 01:05:04:     95%|█████████▌| 95/100 [00:00<00:00, 1836.85 it/sec, obj=1.01]
    INFO - 01:05:04:     96%|█████████▌| 96/100 [00:00<00:00, 1834.80 it/sec, obj=0.0819]
    INFO - 01:05:04:     97%|█████████▋| 97/100 [00:00<00:00, 1834.00 it/sec, obj=-1.09]
    INFO - 01:05:04:     98%|█████████▊| 98/100 [00:00<00:00, 1832.27 it/sec, obj=-0.762]
    INFO - 01:05:04:     99%|█████████▉| 99/100 [00:00<00:00, 1831.31 it/sec, obj=-0.0429]
    INFO - 01:05:04:    100%|██████████| 100/100 [00:00<00:00, 1830.44 it/sec, obj=-0.813]
    INFO - 01:05:04: Optimization result:
    INFO - 01:05:04:    Optimizer info:
    INFO - 01:05:04:       Status: None
    INFO - 01:05:04:       Message: None
    INFO - 01:05:04:       Number of calls to the objective function by the optimizer: 100
    INFO - 01:05:04:    Solution:
    INFO - 01:05:04:       Objective: -2.6379682068246657
    INFO - 01:05:04:       Design space:
    INFO - 01:05:04:          +------+-------------------------+
    INFO - 01:05:04:          | Name |       Distribution      |
    INFO - 01:05:04:          +------+-------------------------+
    INFO - 01:05:04:          |  y   | norm(mu=0.0, sigma=1.0) |
    INFO - 01:05:04:          +------+-------------------------+
    INFO - 01:05:04: *** End DOEScenario execution (time: 0:00:00.076020) ***

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

Gallery generated by Sphinx-Gallery