Optimal LHS vs LHS

A first standard LHS, A second standard LHS, An LHS optimized with simulated annealing, An LHS optimized with Monte Carlo
from __future__ import annotations

import matplotlib.pyplot as plt

from gemseo.algos.doe.factory import DOELibraryFactory

n_samples = 30
n_parameters = 2

factory = DOELibraryFactory()

lhs = factory.create("OT_LHS")
samples = lhs.compute_doe(n_parameters, n_samples)
samples2 = lhs.compute_doe(n_parameters, n_samples)

olhs = factory.create("OT_OPT_LHS")
o_samples = olhs.compute_doe(n_parameters, n_samples)

olhs = factory.create("OT_OPT_LHS")
o_a_samples = olhs.compute_doe(n_parameters, n_samples, annealing=False)

_, ax = plt.subplots(2, 2)
ax[0, 0].plot(samples[:, 0], samples[:, 1], "o")
ax[0, 0].set_title("A first standard LHS")
ax[0, 1].plot(samples2[:, 0], samples[:, 1], "o")
ax[0, 1].set_title("A second standard LHS")
ax[1, 0].plot(o_samples[:, 0], o_samples[:, 1], "o")
ax[1, 0].set_title("An LHS optimized with simulated annealing")
ax[1, 1].plot(o_a_samples[:, 0], o_a_samples[:, 1], "o")
ax[1, 1].set_title("An LHS optimized with Monte Carlo")

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

Gallery generated by Sphinx-Gallery