diff --git a/pybop/optimisers/_random_search.py b/pybop/optimisers/_random_search.py index c405fb690..683435c7e 100644 --- a/pybop/optimisers/_random_search.py +++ b/pybop/optimisers/_random_search.py @@ -38,12 +38,14 @@ def __init__(self, x0, sigma0=0.05, boundaries=None): self._boundaries = boundaries # Initialise population - self._candidates = np.random.uniform( - low=self._boundaries.lower(), - high=self._boundaries.upper(), - size=(self._n, self._dim), - ) if self._boundaries else np.random.normal( - self._x0, self._sigma0, size=(self._n, self._dim) + self._candidates = ( + np.random.uniform( + low=self._boundaries.lower(), + high=self._boundaries.upper(), + size=(self._n, self._dim), + ) + if self._boundaries + else np.random.normal(self._x0, self._sigma0, size=(self._n, self._dim)) ) # Initialise best solution @@ -69,7 +71,7 @@ def ask(self): ) else: self._candidates = np.random.normal( - self._x0, self._sigma0, size=(self._n, self._dim) + self._x0, self._sigma0, size=(self._n, self._dim) ) return self.clip_candidates(self._candidates)