How to use the pyswarms.utils.functions.single_obj.himmelblau 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_dims.py View on Github external
def test_himmelblau_dim_fail(outdim):
    """Test himmelblau dim exception"""
    with pytest.raises(IndexError):
        fx.himmelblau(outdim)
github ljvmiranda921 / pyswarms / tests / utils / functions / test_singleobj_return.py View on Github external
def test_himmelblau_output(x):
    """Tests himmelblau function output."""
    assert np.isclose(fx.himmelblau(x), np.zeros(4)).all()
github ljvmiranda921 / pyswarms / tests / utils / functions / test_singleobj_returndims.py View on Github external
def test_himmelblau_output_size(common_minima, targetdim):
    """Test himmelblau output size."""
    assert fx.himmelblau(common_minima).shape == targetdim
github ljvmiranda921 / pyswarms / tests / utils / functions / test_singleobj_bounds.py View on Github external
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)