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

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

sample = parameter_space.compute_samples(n_samples=4)
sample
array([[ 1.24434242],
       [-0.1876291 ],
       [ 0.1906739 ],
       [ 0.04439806]])

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 - 01:00:36:
    INFO - 01:00:36: *** Start DOEScenario execution ***
    INFO - 01:00:36: DOEScenario
    INFO - 01:00:36:    Disciplines: AnalyticDiscipline
    INFO - 01:00:36:    MDO formulation: DisciplinaryOpt
    INFO - 01:00:36: Optimization problem:
    INFO - 01:00:36:    minimize z(x, y)
    INFO - 01:00:36:    with respect to x, y
    INFO - 01:00:36:    over the design space:
    INFO - 01:00:36:       +------+-------------+-------+-------------+-------+-------------------------+
    INFO - 01:00:36:       | Name | Lower bound | Value | Upper bound | Type  |       Distribution      |
    INFO - 01:00:36:       +------+-------------+-------+-------------+-------+-------------------------+
    INFO - 01:00:36:       | x    |      -2     |  None |      2      | float |                         |
    INFO - 01:00:36:       | y    |     -inf    |   0   |     inf     | float | norm(mu=0.0, sigma=1.0) |
    INFO - 01:00:36:       +------+-------------+-------+-------------+-------+-------------------------+
    INFO - 01:00:36: Solving optimization problem with algorithm lhs:
    INFO - 01:00:36:      1%|          | 1/100 [00:00<00:00, 407.69 it/sec, obj=3.12]
    INFO - 01:00:36:      2%|▏         | 2/100 [00:00<00:00, 660.83 it/sec, obj=1.72]
    INFO - 01:00:36:      3%|▎         | 3/100 [00:00<00:00, 846.59 it/sec, obj=0.181]
    INFO - 01:00:36:      4%|▍         | 4/100 [00:00<00:00, 988.76 it/sec, obj=3.76]
    INFO - 01:00:36:      5%|▌         | 5/100 [00:00<00:00, 1095.18 it/sec, obj=2.15]
    INFO - 01:00:36:      6%|▌         | 6/100 [00:00<00:00, 1175.37 it/sec, obj=-0.666]
    INFO - 01:00:36:      7%|▋         | 7/100 [00:00<00:00, 1247.09 it/sec, obj=1.53]
    INFO - 01:00:36:      8%|▊         | 8/100 [00:00<00:00, 1308.22 it/sec, obj=1.7]
    INFO - 01:00:36:      9%|▉         | 9/100 [00:00<00:00, 1359.68 it/sec, obj=-2.27]
    INFO - 01:00:36:     10%|█         | 10/100 [00:00<00:00, 1404.14 it/sec, obj=-2.08]
    INFO - 01:00:36:     11%|█         | 11/100 [00:00<00:00, 1442.60 it/sec, obj=-2.8]
    INFO - 01:00:36:     12%|█▏        | 12/100 [00:00<00:00, 1475.66 it/sec, obj=-1.31]
    INFO - 01:00:36:     13%|█▎        | 13/100 [00:00<00:00, 1501.80 it/sec, obj=1.1]
    INFO - 01:00:36:     14%|█▍        | 14/100 [00:00<00:00, 1522.51 it/sec, obj=0.38]
    INFO - 01:00:36:     15%|█▌        | 15/100 [00:00<00:00, 1545.85 it/sec, obj=1.68]
    INFO - 01:00:36:     16%|█▌        | 16/100 [00:00<00:00, 1530.21 it/sec, obj=0.672]
    INFO - 01:00:36:     17%|█▋        | 17/100 [00:00<00:00, 1547.55 it/sec, obj=0.643]
    INFO - 01:00:36:     18%|█▊        | 18/100 [00:00<00:00, 1553.89 it/sec, obj=0.568]
    INFO - 01:00:36:     19%|█▉        | 19/100 [00:00<00:00, 1549.25 it/sec, obj=-0.277]
    INFO - 01:00:36:     20%|██        | 20/100 [00:00<00:00, 1557.45 it/sec, obj=1.51]
    INFO - 01:00:36:     21%|██        | 21/100 [00:00<00:00, 1569.03 it/sec, obj=1.83]
    INFO - 01:00:36:     22%|██▏       | 22/100 [00:00<00:00, 1582.59 it/sec, obj=2.12]
    INFO - 01:00:36:     23%|██▎       | 23/100 [00:00<00:00, 1595.14 it/sec, obj=0.526]
    INFO - 01:00:36:     24%|██▍       | 24/100 [00:00<00:00, 1607.17 it/sec, obj=1.47]
    INFO - 01:00:36:     25%|██▌       | 25/100 [00:00<00:00, 1618.12 it/sec, obj=-1.49]
    INFO - 01:00:36:     26%|██▌       | 26/100 [00:00<00:00, 1628.93 it/sec, obj=-1.58]
    INFO - 01:00:36:     27%|██▋       | 27/100 [00:00<00:00, 1637.05 it/sec, obj=1.59]
    INFO - 01:00:36:     28%|██▊       | 28/100 [00:00<00:00, 1641.70 it/sec, obj=0.329]
    INFO - 01:00:36:     29%|██▉       | 29/100 [00:00<00:00, 1649.35 it/sec, obj=-1.46]
    INFO - 01:00:36:     30%|███       | 30/100 [00:00<00:00, 1657.39 it/sec, obj=-0.045]
    INFO - 01:00:36:     31%|███       | 31/100 [00:00<00:00, 1665.17 it/sec, obj=-0.736]
    INFO - 01:00:36:     32%|███▏      | 32/100 [00:00<00:00, 1672.00 it/sec, obj=0.867]
    INFO - 01:00:36:     33%|███▎      | 33/100 [00:00<00:00, 1678.54 it/sec, obj=-3.12]
    INFO - 01:00:36:     34%|███▍      | 34/100 [00:00<00:00, 1684.88 it/sec, obj=-0.252]
    INFO - 01:00:36:     35%|███▌      | 35/100 [00:00<00:00, 1670.37 it/sec, obj=1.46]
    INFO - 01:00:36:     36%|███▌      | 36/100 [00:00<00:00, 1675.23 it/sec, obj=-2.02]
    INFO - 01:00:36:     37%|███▋      | 37/100 [00:00<00:00, 1680.48 it/sec, obj=-1.68]
    INFO - 01:00:36:     38%|███▊      | 38/100 [00:00<00:00, 1685.78 it/sec, obj=-0.913]
    INFO - 01:00:36:     39%|███▉      | 39/100 [00:00<00:00, 1690.66 it/sec, obj=-2.38]
    INFO - 01:00:36:     40%|████      | 40/100 [00:00<00:00, 1695.15 it/sec, obj=1.07]
    INFO - 01:00:36:     41%|████      | 41/100 [00:00<00:00, 1699.49 it/sec, obj=3.77]
    INFO - 01:00:36:     42%|████▏     | 42/100 [00:00<00:00, 1702.69 it/sec, obj=-1.88]
    INFO - 01:00:36:     43%|████▎     | 43/100 [00:00<00:00, 1701.14 it/sec, obj=0.116]
    INFO - 01:00:36:     44%|████▍     | 44/100 [00:00<00:00, 1704.56 it/sec, obj=-1.51]
    INFO - 01:00:36:     45%|████▌     | 45/100 [00:00<00:00, 1708.43 it/sec, obj=-0.0194]
    INFO - 01:00:36:     46%|████▌     | 46/100 [00:00<00:00, 1712.30 it/sec, obj=0.984]
    INFO - 01:00:36:     47%|████▋     | 47/100 [00:00<00:00, 1715.54 it/sec, obj=-0.34]
    INFO - 01:00:36:     48%|████▊     | 48/100 [00:00<00:00, 1718.92 it/sec, obj=-0.941]
    INFO - 01:00:36:     49%|████▉     | 49/100 [00:00<00:00, 1715.26 it/sec, obj=0.363]
    INFO - 01:00:36:     50%|█████     | 50/100 [00:00<00:00, 1709.13 it/sec, obj=-1.01]
    INFO - 01:00:36:     51%|█████     | 51/100 [00:00<00:00, 1707.26 it/sec, obj=-0.359]
    INFO - 01:00:36:     52%|█████▏    | 52/100 [00:00<00:00, 1709.85 it/sec, obj=-3.06]
    INFO - 01:00:36:     53%|█████▎    | 53/100 [00:00<00:00, 1712.48 it/sec, obj=2.34]
    INFO - 01:00:36:     54%|█████▍    | 54/100 [00:00<00:00, 1715.23 it/sec, obj=-0.262]
    INFO - 01:00:36:     55%|█████▌    | 55/100 [00:00<00:00, 1717.74 it/sec, obj=0.812]
    INFO - 01:00:36:     56%|█████▌    | 56/100 [00:00<00:00, 1719.22 it/sec, obj=-2.47]
    INFO - 01:00:36:     57%|█████▋    | 57/100 [00:00<00:00, 1720.20 it/sec, obj=1.49]
    INFO - 01:00:36:     58%|█████▊    | 58/100 [00:00<00:00, 1721.32 it/sec, obj=0.268]
    INFO - 01:00:36:     59%|█████▉    | 59/100 [00:00<00:00, 1723.18 it/sec, obj=0.559]
    INFO - 01:00:36:     60%|██████    | 60/100 [00:00<00:00, 1725.27 it/sec, obj=-2.01]
    INFO - 01:00:36:     61%|██████    | 61/100 [00:00<00:00, 1727.24 it/sec, obj=-0.854]
    INFO - 01:00:36:     62%|██████▏   | 62/100 [00:00<00:00, 1729.46 it/sec, obj=1.61]
    INFO - 01:00:36:     63%|██████▎   | 63/100 [00:00<00:00, 1730.41 it/sec, obj=-2.64]
    INFO - 01:00:36:     64%|██████▍   | 64/100 [00:00<00:00, 1730.78 it/sec, obj=0.818]
    INFO - 01:00:36:     65%|██████▌   | 65/100 [00:00<00:00, 1732.31 it/sec, obj=1.04]
    INFO - 01:00:36:     66%|██████▌   | 66/100 [00:00<00:00, 1734.10 it/sec, obj=-0.832]
    INFO - 01:00:36:     67%|██████▋   | 67/100 [00:00<00:00, 1735.97 it/sec, obj=0.692]
    INFO - 01:00:36:     68%|██████▊   | 68/100 [00:00<00:00, 1737.66 it/sec, obj=-3.33]
    INFO - 01:00:36:     69%|██████▉   | 69/100 [00:00<00:00, 1739.25 it/sec, obj=0.47]
    INFO - 01:00:36:     70%|███████   | 70/100 [00:00<00:00, 1740.48 it/sec, obj=0.445]
    INFO - 01:00:36:     71%|███████   | 71/100 [00:00<00:00, 1732.39 it/sec, obj=0.402]
    INFO - 01:00:36:     72%|███████▏  | 72/100 [00:00<00:00, 1732.73 it/sec, obj=2.77]
    INFO - 01:00:36:     73%|███████▎  | 73/100 [00:00<00:00, 1733.67 it/sec, obj=-0.256]
    INFO - 01:00:36:     74%|███████▍  | 74/100 [00:00<00:00, 1734.60 it/sec, obj=3.36]
    INFO - 01:00:36:     75%|███████▌  | 75/100 [00:00<00:00, 1735.80 it/sec, obj=-0.229]
    INFO - 01:00:36:     76%|███████▌  | 76/100 [00:00<00:00, 1737.16 it/sec, obj=-0.739]
    INFO - 01:00:36:     77%|███████▋  | 77/100 [00:00<00:00, 1737.54 it/sec, obj=0.808]
    INFO - 01:00:36:     78%|███████▊  | 78/100 [00:00<00:00, 1736.20 it/sec, obj=-0.377]
    INFO - 01:00:36:     79%|███████▉  | 79/100 [00:00<00:00, 1736.56 it/sec, obj=0.708]
    INFO - 01:00:36:     80%|████████  | 80/100 [00:00<00:00, 1732.37 it/sec, obj=-0.874]
    INFO - 01:00:36:     81%|████████  | 81/100 [00:00<00:00, 1730.39 it/sec, obj=-1.29]
    INFO - 01:00:36:     82%|████████▏ | 82/100 [00:00<00:00, 1731.01 it/sec, obj=0.505]
    INFO - 01:00:36:     83%|████████▎ | 83/100 [00:00<00:00, 1731.95 it/sec, obj=1.99]
    INFO - 01:00:36:     84%|████████▍ | 84/100 [00:00<00:00, 1732.44 it/sec, obj=0.574]
    INFO - 01:00:36:     85%|████████▌ | 85/100 [00:00<00:00, 1731.99 it/sec, obj=-2.06]
    INFO - 01:00:36:     86%|████████▌ | 86/100 [00:00<00:00, 1732.58 it/sec, obj=-1.49]
    INFO - 01:00:36:     87%|████████▋ | 87/100 [00:00<00:00, 1733.50 it/sec, obj=0.61]
    INFO - 01:00:36:     88%|████████▊ | 88/100 [00:00<00:00, 1734.26 it/sec, obj=0.542]
    INFO - 01:00:36:     89%|████████▉ | 89/100 [00:00<00:00, 1734.91 it/sec, obj=-1.5]
    INFO - 01:00:36:     90%|█████████ | 90/100 [00:00<00:00, 1735.53 it/sec, obj=0.201]
    INFO - 01:00:36:     91%|█████████ | 91/100 [00:00<00:00, 1729.73 it/sec, obj=0.949]
    INFO - 01:00:36:     92%|█████████▏| 92/100 [00:00<00:00, 1728.71 it/sec, obj=-1.86]
    INFO - 01:00:36:     93%|█████████▎| 93/100 [00:00<00:00, 1729.27 it/sec, obj=-0.0722]
    INFO - 01:00:36:     94%|█████████▍| 94/100 [00:00<00:00, 1729.72 it/sec, obj=-0.407]
    INFO - 01:00:36:     95%|█████████▌| 95/100 [00:00<00:00, 1730.41 it/sec, obj=0.194]
    INFO - 01:00:36:     96%|█████████▌| 96/100 [00:00<00:00, 1731.20 it/sec, obj=-0.207]
    INFO - 01:00:36:     97%|█████████▋| 97/100 [00:00<00:00, 1731.62 it/sec, obj=0.462]
    INFO - 01:00:36:     98%|█████████▊| 98/100 [00:00<00:00, 1731.45 it/sec, obj=-2.37]
    INFO - 01:00:36:     99%|█████████▉| 99/100 [00:00<00:00, 1731.19 it/sec, obj=1.32]
    INFO - 01:00:36:    100%|██████████| 100/100 [00:00<00:00, 1731.44 it/sec, obj=-2.21]
    INFO - 01:00:36: Optimization result:
    INFO - 01:00:36:    Optimizer info:
    INFO - 01:00:36:       Status: None
    INFO - 01:00:36:       Message: None
    INFO - 01:00:36:       Number of calls to the objective function by the optimizer: 100
    INFO - 01:00:36:    Solution:
    INFO - 01:00:36:       Objective: -3.3284373246961634
    INFO - 01:00:36:       Design space:
    INFO - 01:00:36:          +------+-------------+--------------------+-------------+-------+-------------------------+
    INFO - 01:00:36:          | Name | Lower bound |       Value        | Upper bound | Type  |       Distribution      |
    INFO - 01:00:36:          +------+-------------+--------------------+-------------+-------+-------------------------+
    INFO - 01:00:36:          | x    |      -2     | -1.959995425007306 |      2      | float |                         |
    INFO - 01:00:36:          | y    |     -inf    | -1.368441899688857 |     inf     | float | norm(mu=0.0, sigma=1.0) |
    INFO - 01:00:36:          +------+-------------+--------------------+-------------+-------+-------------------------+
    INFO - 01:00:36: *** End DOEScenario execution (time: 0:00:00.080260) ***

{'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 - 01:00:36:
    INFO - 01:00:36: *** Start DOEScenario execution ***
    INFO - 01:00:36: DOEScenario
    INFO - 01:00:36:    Disciplines: AnalyticDiscipline
    INFO - 01:00:36:    MDO formulation: DisciplinaryOpt
    INFO - 01:00:36: Optimization problem:
    INFO - 01:00:36:    minimize z(y)
    INFO - 01:00:36:    with respect to y
    INFO - 01:00:36:    over the design space:
    INFO - 01:00:36:       +------+-------------------------+
    INFO - 01:00:36:       | Name |       Distribution      |
    INFO - 01:00:36:       +------+-------------------------+
    INFO - 01:00:36:       |  y   | norm(mu=0.0, sigma=1.0) |
    INFO - 01:00:36:       +------+-------------------------+
    INFO - 01:00:36: Solving optimization problem with algorithm lhs:
    INFO - 01:00:36:      1%|          | 1/100 [00:00<00:00, 1971.93 it/sec, obj=-0.641]
    INFO - 01:00:36:      2%|▏         | 2/100 [00:00<00:00, 1833.98 it/sec, obj=-0.394]
    INFO - 01:00:36:      3%|▎         | 3/100 [00:00<00:00, 1859.73 it/sec, obj=0.551]
    INFO - 01:00:36:      4%|▍         | 4/100 [00:00<00:00, 1882.12 it/sec, obj=0.944]
    INFO - 01:00:36:      5%|▌         | 5/100 [00:00<00:00, 1896.50 it/sec, obj=-2.12]
    INFO - 01:00:36:      6%|▌         | 6/100 [00:00<00:00, 1906.65 it/sec, obj=-1.64]
    INFO - 01:00:36:      7%|▋         | 7/100 [00:00<00:00, 1914.58 it/sec, obj=0.656]
    INFO - 01:00:36:      8%|▊         | 8/100 [00:00<00:00, 1904.77 it/sec, obj=-0.612]
    INFO - 01:00:36:      9%|▉         | 9/100 [00:00<00:00, 1892.83 it/sec, obj=0.736]
    INFO - 01:00:36:     10%|█         | 10/100 [00:00<00:00, 1881.44 it/sec, obj=0.36]
    INFO - 01:00:36:     11%|█         | 11/100 [00:00<00:00, 1882.47 it/sec, obj=-0.31]
    INFO - 01:00:36:     12%|█▏        | 12/100 [00:00<00:00, 1886.63 it/sec, obj=0.324]
    INFO - 01:00:36:     13%|█▎        | 13/100 [00:00<00:00, 1890.44 it/sec, obj=-1.73]
    INFO - 01:00:36:     14%|█▍        | 14/100 [00:00<00:00, 1893.47 it/sec, obj=0.494]
    INFO - 01:00:36:     15%|█▌        | 15/100 [00:00<00:00, 1895.76 it/sec, obj=-0.148]
    INFO - 01:00:36:     16%|█▌        | 16/100 [00:00<00:00, 1894.18 it/sec, obj=1.1]
    INFO - 01:00:36:     17%|█▋        | 17/100 [00:00<00:00, 1889.13 it/sec, obj=-0.716]
    INFO - 01:00:36:     18%|█▊        | 18/100 [00:00<00:00, 1890.65 it/sec, obj=0.0421]
    INFO - 01:00:36:     19%|█▉        | 19/100 [00:00<00:00, 1892.56 it/sec, obj=0.256]
    INFO - 01:00:36:     20%|██        | 20/100 [00:00<00:00, 1894.75 it/sec, obj=-1.45]
    INFO - 01:00:36:     21%|██        | 21/100 [00:00<00:00, 1896.08 it/sec, obj=0.637]
    INFO - 01:00:36:     22%|██▏       | 22/100 [00:00<00:00, 1897.56 it/sec, obj=1.97]
    INFO - 01:00:36:     23%|██▎       | 23/100 [00:00<00:00, 1897.24 it/sec, obj=-0.208]
    INFO - 01:00:36:     24%|██▍       | 24/100 [00:00<00:00, 1897.02 it/sec, obj=0.18]
    INFO - 01:00:36:     25%|██▌       | 25/100 [00:00<00:00, 1893.59 it/sec, obj=0.000485]
    INFO - 01:00:36:     26%|██▌       | 26/100 [00:00<00:00, 1894.84 it/sec, obj=1.17]
    INFO - 01:00:36:     27%|██▋       | 27/100 [00:00<00:00, 1896.16 it/sec, obj=-0.305]
    INFO - 01:00:36:     28%|██▊       | 28/100 [00:00<00:00, 1895.64 it/sec, obj=0.68]
    INFO - 01:00:36:     29%|██▉       | 29/100 [00:00<00:00, 1893.47 it/sec, obj=-0.932]
    INFO - 01:00:36:     30%|███       | 30/100 [00:00<00:00, 1893.96 it/sec, obj=0.901]
    INFO - 01:00:36:     31%|███       | 31/100 [00:00<00:00, 1892.27 it/sec, obj=0.454]
    INFO - 01:00:36:     32%|███▏      | 32/100 [00:00<00:00, 1886.14 it/sec, obj=-1.16]
    INFO - 01:00:36:     33%|███▎      | 33/100 [00:00<00:00, 1885.47 it/sec, obj=1.44]
    INFO - 01:00:36:     34%|███▍      | 34/100 [00:00<00:00, 1885.55 it/sec, obj=0.798]
    INFO - 01:00:36:     35%|███▌      | 35/100 [00:00<00:00, 1885.66 it/sec, obj=1.59]
    INFO - 01:00:36:     36%|███▌      | 36/100 [00:00<00:00, 1885.86 it/sec, obj=2.05]
    INFO - 01:00:36:     37%|███▋      | 37/100 [00:00<00:00, 1886.36 it/sec, obj=-0.26]
    INFO - 01:00:36:     38%|███▊      | 38/100 [00:00<00:00, 1885.33 it/sec, obj=0.874]
    INFO - 01:00:36:     39%|███▉      | 39/100 [00:00<00:00, 1882.85 it/sec, obj=0.832]
    INFO - 01:00:36:     40%|████      | 40/100 [00:00<00:00, 1881.97 it/sec, obj=-1.38]
    INFO - 01:00:36:     41%|████      | 41/100 [00:00<00:00, 1881.70 it/sec, obj=1.52]
    INFO - 01:00:36:     42%|████▏     | 42/100 [00:00<00:00, 1881.62 it/sec, obj=-0.522]
    INFO - 01:00:36:     43%|████▎     | 43/100 [00:00<00:00, 1881.54 it/sec, obj=1.4]
    INFO - 01:00:36:     44%|████▍     | 44/100 [00:00<00:00, 1881.26 it/sec, obj=-0.484]
    INFO - 01:00:36:     45%|████▌     | 45/100 [00:00<00:00, 1880.91 it/sec, obj=-0.91]
    INFO - 01:00:36:     46%|████▌     | 46/100 [00:00<00:00, 1879.37 it/sec, obj=0.343]
    INFO - 01:00:36:     47%|████▋     | 47/100 [00:00<00:00, 1877.18 it/sec, obj=-0.441]
    INFO - 01:00:36:     48%|████▊     | 48/100 [00:00<00:00, 1876.80 it/sec, obj=-0.871]
    INFO - 01:00:36:     49%|████▉     | 49/100 [00:00<00:00, 1876.58 it/sec, obj=2.67]
    INFO - 01:00:36:     50%|█████     | 50/100 [00:00<00:00, 1876.23 it/sec, obj=0.217]
    INFO - 01:00:36:     51%|█████     | 51/100 [00:00<00:00, 1875.87 it/sec, obj=-0.425]
    INFO - 01:00:36:     52%|█████▏    | 52/100 [00:00<00:00, 1875.61 it/sec, obj=0.113]
    INFO - 01:00:36:     53%|█████▎    | 53/100 [00:00<00:00, 1874.05 it/sec, obj=-0.377]
    INFO - 01:00:36:     54%|█████▍    | 54/100 [00:00<00:00, 1871.93 it/sec, obj=-1.19]
    INFO - 01:00:36:     55%|█████▌    | 55/100 [00:00<00:00, 1871.52 it/sec, obj=-0.528]
    INFO - 01:00:36:     56%|█████▌    | 56/100 [00:00<00:00, 1871.22 it/sec, obj=-2.64]
    INFO - 01:00:36:     57%|█████▋    | 57/100 [00:00<00:00, 1871.04 it/sec, obj=-0.0776]
    INFO - 01:00:36:     58%|█████▊    | 58/100 [00:00<00:00, 1870.92 it/sec, obj=1.08]
    INFO - 01:00:36:     59%|█████▉    | 59/100 [00:00<00:00, 1870.38 it/sec, obj=-2.05]
    INFO - 01:00:36:     60%|██████    | 60/100 [00:00<00:00, 1870.08 it/sec, obj=0.0555]
    INFO - 01:00:36:     61%|██████    | 61/100 [00:00<00:00, 1868.76 it/sec, obj=-1.84]
    INFO - 01:00:36:     62%|██████▏   | 62/100 [00:00<00:00, 1861.01 it/sec, obj=0.4]
    INFO - 01:00:36:     63%|██████▎   | 63/100 [00:00<00:00, 1860.34 it/sec, obj=-0.195]
    INFO - 01:00:36:     64%|██████▍   | 64/100 [00:00<00:00, 1859.82 it/sec, obj=-0.578]
    INFO - 01:00:36:     65%|██████▌   | 65/100 [00:00<00:00, 1859.37 it/sec, obj=-0.977]
    INFO - 01:00:36:     66%|██████▌   | 66/100 [00:00<00:00, 1858.78 it/sec, obj=-0.114]
    INFO - 01:00:36:     67%|██████▋   | 67/100 [00:00<00:00, 1858.50 it/sec, obj=0.587]
    INFO - 01:00:36:     68%|██████▊   | 68/100 [00:00<00:00, 1857.14 it/sec, obj=-0.0679]
    INFO - 01:00:36:     69%|██████▉   | 69/100 [00:00<00:00, 1855.22 it/sec, obj=-0.0218]
    INFO - 01:00:36:     70%|███████   | 70/100 [00:00<00:00, 1854.41 it/sec, obj=-0.228]
    INFO - 01:00:36:     71%|███████   | 71/100 [00:00<00:00, 1853.73 it/sec, obj=1.21]
    INFO - 01:00:36:     72%|███████▏  | 72/100 [00:00<00:00, 1852.96 it/sec, obj=-0.34]
    INFO - 01:00:36:     73%|███████▎  | 73/100 [00:00<00:00, 1852.41 it/sec, obj=0.513]
    INFO - 01:00:36:     74%|███████▍  | 74/100 [00:00<00:00, 1851.86 it/sec, obj=1.67]
    INFO - 01:00:36:     75%|███████▌  | 75/100 [00:00<00:00, 1850.84 it/sec, obj=0.557]
    INFO - 01:00:36:     76%|███████▌  | 76/100 [00:00<00:00, 1849.29 it/sec, obj=0.431]
    INFO - 01:00:36:     77%|███████▋  | 77/100 [00:00<00:00, 1848.92 it/sec, obj=-1.31]
    INFO - 01:00:36:     78%|███████▊  | 78/100 [00:00<00:00, 1848.64 it/sec, obj=-0.678]
    INFO - 01:00:36:     79%|███████▉  | 79/100 [00:00<00:00, 1847.98 it/sec, obj=-1.01]
    INFO - 01:00:36:     80%|████████  | 80/100 [00:00<00:00, 1847.41 it/sec, obj=0.246]
    INFO - 01:00:36:     81%|████████  | 81/100 [00:00<00:00, 1846.92 it/sec, obj=1.29]
    INFO - 01:00:36:     82%|████████▏ | 82/100 [00:00<00:00, 1845.48 it/sec, obj=0.75]
    INFO - 01:00:36:     83%|████████▎ | 83/100 [00:00<00:00, 1843.59 it/sec, obj=-1.54]
    INFO - 01:00:36:     84%|████████▍ | 84/100 [00:00<00:00, 1842.96 it/sec, obj=-0.156]
    INFO - 01:00:36:     85%|████████▌ | 85/100 [00:00<00:00, 1842.24 it/sec, obj=1.87]
    INFO - 01:00:36:     86%|████████▌ | 86/100 [00:00<00:00, 1841.54 it/sec, obj=-1.08]
    INFO - 01:00:36:     87%|████████▋ | 87/100 [00:00<00:00, 1841.16 it/sec, obj=-0.647]
    INFO - 01:00:36:     88%|████████▊ | 88/100 [00:00<00:00, 1840.67 it/sec, obj=0.968]
    INFO - 01:00:36:     89%|████████▉ | 89/100 [00:00<00:00, 1839.70 it/sec, obj=-0.773]
    INFO - 01:00:36:     90%|█████████ | 90/100 [00:00<00:00, 1837.89 it/sec, obj=1.26]
    INFO - 01:00:36:     91%|█████████ | 91/100 [00:00<00:00, 1837.33 it/sec, obj=0.166]
    INFO - 01:00:36:     92%|█████████▏| 92/100 [00:00<00:00, 1836.81 it/sec, obj=0.29]
    INFO - 01:00:36:     93%|█████████▎| 93/100 [00:00<00:00, 1836.11 it/sec, obj=0.127]
    INFO - 01:00:36:     94%|█████████▍| 94/100 [00:00<00:00, 1835.38 it/sec, obj=-1.26]
    INFO - 01:00:36:     95%|█████████▌| 95/100 [00:00<00:00, 1834.87 it/sec, obj=1.01]
    INFO - 01:00:36:     96%|█████████▌| 96/100 [00:00<00:00, 1833.52 it/sec, obj=0.0819]
    INFO - 01:00:36:     97%|█████████▋| 97/100 [00:00<00:00, 1832.03 it/sec, obj=-1.09]
    INFO - 01:00:36:     98%|█████████▊| 98/100 [00:00<00:00, 1831.15 it/sec, obj=-0.762]
    INFO - 01:00:36:     99%|█████████▉| 99/100 [00:00<00:00, 1830.44 it/sec, obj=-0.0429]
    INFO - 01:00:36:    100%|██████████| 100/100 [00:00<00:00, 1829.55 it/sec, obj=-0.813]
    INFO - 01:00:36: Optimization result:
    INFO - 01:00:36:    Optimizer info:
    INFO - 01:00:36:       Status: None
    INFO - 01:00:36:       Message: None
    INFO - 01:00:36:       Number of calls to the objective function by the optimizer: 100
    INFO - 01:00:36:    Solution:
    INFO - 01:00:36:       Objective: -2.6379682068246657
    INFO - 01:00:36:       Design space:
    INFO - 01:00:36:          +------+-------------------------+
    INFO - 01:00:36:          | Name |       Distribution      |
    INFO - 01:00:36:          +------+-------------------------+
    INFO - 01:00:36:          |  y   | norm(mu=0.0, sigma=1.0) |
    INFO - 01:00:36:          +------+-------------------------+
    INFO - 01:00:36: *** End DOEScenario execution (time: 0:00:00.075552) ***

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

Gallery generated by Sphinx-Gallery