How to use the pyswarms.utils.functions.single_obj.eggholder 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_returndims.py View on Github external
def test_eggholder_output_size(common_minima2, targetdim):
    """Test eggholder output size."""
    assert fx.eggholder([-10, 0] * common_minima2).shape == targetdim
github ljvmiranda921 / pyswarms / tests / utils / functions / test_singleobj_dims.py View on Github external
def test_eggholder_dim_fail(outdim):
    """Test eggholder dim exception"""
    with pytest.raises(IndexError):
        fx.eggholder(outdim)
github ljvmiranda921 / pyswarms / tests / utils / functions / test_singleobj_bounds.py View on Github external
def test_eggholder_bound_fail(outbound):
    """Test eggholder bound exception"""
    with pytest.raises(ValueError):
        x = outbound(b["eggholder"].low, b["eggholder"].high, size=(3, 2))
        fx.eggholder(x)
github ljvmiranda921 / pyswarms / tests / utils / functions / test_singleobj_return.py View on Github external
def test_eggholder_output(common_minima2):
    """Tests eggholder function output."""
    assert np.isclose(
        fx.eggholder([512, 404.3219] * common_minima2),
        (-959.6407 * np.ones(3)),
    ).all()