Skip to content

Commit

Permalink
Merge pull request #190 from y0z/feature/support-1d
Browse files Browse the repository at this point in the history
[Proposal] Support 1D search space in CMA-ES
  • Loading branch information
nomuramasahir0 authored Nov 12, 2024
2 parents 766ffe9 + db4f773 commit 291376e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmaes/_cma.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def __init__(
), f"Abs of all elements of mean vector must be less than {_MEAN_MAX}"

n_dim = len(mean)
assert n_dim > 1, "The dimension of mean must be larger than 1"
assert n_dim > 0, "The dimension of mean must be positive"

if population_size is None:
population_size = 4 + math.floor(3 * math.log(n_dim)) # (eq. 48)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_fuzzing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class TestFuzzing(unittest.TestCase):
data=st.data(),
)
def test_cma_tell(self, data):
dim = data.draw(st.integers(min_value=2, max_value=100))
dim = data.draw(st.integers(min_value=1, max_value=100))
mean = data.draw(npst.arrays(dtype=float, shape=dim))
sigma = data.draw(st.floats(min_value=1e-16))
n_iterations = data.draw(st.integers(min_value=1))
Expand Down

0 comments on commit 291376e

Please sign in to comment.