How to use the pyswarms.utils.functions.single_obj.crossintray 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_return.py View on Github external
def test_crossintray_output(x, minima):
    """Tests crossintray function output."""
    assert np.isclose(fx.crossintray(x), minima).all()
github ljvmiranda921 / pyswarms / tests / utils / functions / test_singleobj_bounds.py View on Github external
def test_crossintray_bound_fail(outbound):
    """Test crossintray bound exception"""
    with pytest.raises(ValueError):
        x = outbound(b["crossintray"].low, b["crossintray"].high, size=(3, 2))
        fx.crossintray(x)
github ljvmiranda921 / pyswarms / tests / utils / functions / test_singleobj_returndims.py View on Github external
def test_crossintray_output_size(common_minima2, targetdim):
    """Test crossintray output size."""
    assert fx.crossintray([-10, 0] * common_minima2).shape == targetdim
github ljvmiranda921 / pyswarms / tests / utils / functions / test_singleobj_dims.py View on Github external
def test_crossintray_dim_fail(outdim):
    """Test crossintray dim exception"""
    with pytest.raises(IndexError):
        fx.crossintray(outdim)