Exemplo n.º 1
0
def test_himmelblau_dim_fail(outdim):
    """Test himmelblau dim exception"""
    with pytest.raises(IndexError):
        fx.himmelblau(outdim)
Exemplo n.º 2
0
def test_himmelblau_bound_fail(outbound):
    """Test himmelblau bound exception"""
    with pytest.raises(ValueError):
        x = outbound(b["himmelblau"].low, b["himmelblau"].high, size=(3, 2))
        fx.himmelblau(x)
def test_himmelblau_output_size(common_minima, targetdim):
    """Test himmelblau output size."""
    assert fx.himmelblau(common_minima).shape == targetdim
Exemplo n.º 4
0
def test_himmelblau_output(x):
    """Tests himmelblau function output."""
    assert np.isclose(fx.himmelblau(x), np.zeros(4)).all()