예제 #1
0
def test_lhd():
    lhd = LatinHypercube(dim=4, num_pts=10)
    X = lhd.generate_points()
    assert isinstance(lhd, ExperimentalDesign)
    assert np.all(X.shape == (10, 4))
    assert lhd.num_pts == 10
    assert lhd.dim == 4
예제 #2
0
def test_lhd():
    lhd = LatinHypercube(dim=4, num_pts=10, criterion='c')
    X = lhd.generate_points()
    assert (isinstance(lhd, ExperimentalDesign))
    assert (np.all(X.shape == (10, 4)))
    assert (lhd.num_pts == 10)
    assert (lhd.dim == 4)
예제 #3
0
def test_lhd_round():
    num_pts = 10
    dim = 3
    lb = np.array([1, 2, 3])
    ub = np.array([3, 4, 5])
    int_var = np.array([1])

    np.random.seed(0)
    lhd = LatinHypercube(dim=dim, num_pts=num_pts)
    X = lhd.generate_points(lb=lb, ub=ub, int_var=int_var)

    assert np.all(np.round(X[:, 1] == X[:, 1]))  # Should be integers
    assert np.all(np.max(X, axis=0) <= ub)
    assert np.all(np.min(X, axis=0) >= lb)