How to use the pyswarms.utils.functions.single_obj.goldstein function in pyswarms

To help you get started, weโ€™ve selected a few pyswarms examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ljvmiranda921 / pyswarms / tests / utils / functions / test_singleobj_bounds.py View on Github external
def test_goldstein_bound_fail(outbound):
    """Test goldstein bound exception"""
    with pytest.raises(ValueError):
        x = outbound(b["goldstein"].low, b["goldstein"].high, size=(3, 2))
        fx.goldstein(x)
github ljvmiranda921 / pyswarms / tests / utils / functions / test_singleobj_returndims.py View on Github external
def test_goldstein_output_size(common_minima, targetdim):
    """Test goldstein output size."""
    assert fx.goldstein(common_minima).shape == targetdim
github ljvmiranda921 / pyswarms / tests / utils / functions / test_singleobj_return.py View on Github external
def test_goldstein_output(common_minima2):
    """Tests goldstein-price function output."""
    assert np.isclose(
        fx.goldstein([0, -1] * common_minima2), (3 * np.ones(3))
    ).all()
github ljvmiranda921 / pyswarms / tests / utils / functions / test_singleobj_dims.py View on Github external
def test_goldstein_dim_fail(outdim):
    """Test goldstein dim exception"""
    with pytest.raises(IndexError):
        fx.goldstein(outdim)