# Path: pyswarms/utils/functions/single_obj.py
# def rosenbrock(x):
#     """Rosenbrock objective function.
# 
#     Also known as the Rosenbrock's valley or Rosenbrock's banana
#     function. Has a global minimum of :code:`np.ones(dimensions)` where
#     :code:`dimensions` is :code:`x.shape[1]`. The search domain is
#     :code:`[-inf, inf]`.
# 
#     Parameters
#     ----------
#     x : numpy.ndarray
#         set of inputs of shape :code:`(n_particles, dimensions)`
# 
#     Returns
#     -------
#     numpy.ndarray
#         computed cost of size :code:`(n_particles, )`
#     """
# 
#     r = np.sum(
#         100 * (x.T[1:] - x.T[:-1] ** 2.0) ** 2 + (1 - x.T[:-1]) ** 2.0, axis=0
#     )
# 
#     return r
# 
# def sphere(x):
#     """Sphere objective function.
# 
#     Has a global minimum at :code:`0` and with a search domain of
#         :code:`[-inf, inf]`
# 
#     Parameters
#     ----------
#     x : numpy.ndarray
#         set of inputs of shape :code:`(n_particles, dimensions)`
# 
#     Returns
#     -------
#     numpy.ndarray
#         computed cost of size :code:`(n_particles, )`
#     """
#     j = (x ** 2.0).sum(axis=1)
# 
#     return j


import abc
import numpy as np
import pytest
        import multiprocessing
from pyswarms.utils.functions.single_obj import rosenbrock, sphere
        raise NotImplementedError("NotImplementedError::optimizer")

    @pytest.fixture
    def optimizer_history(self):
        """Run the optimizer for 1000 iterations and return its instance"""
        raise NotImplementedError("NotImplementedError::optimizer_history")

    @pytest.fixture
    def optimizer_reset(self):
        """Reset the optimizer and return its instance"""
        raise NotImplementedError("NotImplementedError::optimizer_reset")

    @pytest.fixture
    def options(self):
        """Default options dictionary for most PSO use-cases"""
        return {"c1": 0.3, "c2": 0.7, "w": 0.9, "k": 2, "p": 2, "r": 1}

    @pytest.fixture
    def obj_with_args(self):
        """Objective function with arguments"""

        def obj_with_args_(x, a, b):
            f = (a - x[:, 0]) ** 2 + b * (x[:, 1] - x[:, 0] ** 2) ** 2
            return f

        return obj_with_args_

    @pytest.fixture
    def obj_without_args(self):
        """Objective function without arguments"""

# Path: pyswarms/utils/functions/single_obj.py
# def rosenbrock(x):
#     """Rosenbrock objective function.
# 
#     Also known as the Rosenbrock's valley or Rosenbrock's banana
#     function. Has a global minimum of :code:`np.ones(dimensions)` where
#     :code:`dimensions` is :code:`x.shape[1]`. The search domain is
#     :code:`[-inf, inf]`.
# 
#     Parameters
#     ----------
#     x : numpy.ndarray
#         set of inputs of shape :code:`(n_particles, dimensions)`
# 
#     Returns
#     -------
#     numpy.ndarray
#         computed cost of size :code:`(n_particles, )`
#     """
# 
#     r = np.sum(
#         100 * (x.T[1:] - x.T[:-1] ** 2.0) ** 2 + (1 - x.T[:-1]) ** 2.0, axis=0
#     )
# 
#     return r
# 
# def sphere(x):
#     """Sphere objective function.
# 
#     Has a global minimum at :code:`0` and with a search domain of
#         :code:`[-inf, inf]`
# 
#     Parameters
#     ----------
#     x : numpy.ndarray
#         set of inputs of shape :code:`(n_particles, dimensions)`
# 
#     Returns
#     -------
#     numpy.ndarray
#         computed cost of size :code:`(n_particles, )`
#     """
#     j = (x ** 2.0).sum(axis=1)
# 
#     return j


# Path: tests/optimizers/abc_test_optimizer.py
import abc
import numpy as np
import pytest
        import multiprocessing
from pyswarms.utils.functions.single_obj import rosenbrock, sphere

        raise NotImplementedError("NotImplementedError::optimizer")

    @pytest.fixture
    def optimizer_history(self):
        """Run the optimizer for 1000 iterations and return its instance"""
        raise NotImplementedError("NotImplementedError::optimizer_history")

    @pytest.fixture
    def optimizer_reset(self):
        """Reset the optimizer and return its instance"""
        raise NotImplementedError("NotImplementedError::optimizer_reset")

    @pytest.fixture
    def options(self):
        """Default options dictionary for most PSO use-cases"""
        return {"c1": 0.3, "c2": 0.7, "w": 0.9, "k": 2, "p": 2, "r": 1}

    @pytest.fixture
    def obj_with_args(self):
        """Objective function with arguments"""

        def obj_with_args_(x, a, b):
            f = (a - x[:, 0]) ** 2 + b * (x[:, 1] - x[:, 0] ** 2) ** 2
            return f

        return obj_with_args_

    @pytest.fixture
    def obj_without_args(self):
        """Objective function without arguments"""

        return rosenbrock