Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
knshnb committed Oct 24, 2022
1 parent 9bdfb09 commit 2dfa281
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion cmaes/_cmawm.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ def ellipsoid_onemax(x, n_zdim):
return ellipsoid + 10 * onemax
binary_dim, continuous_dim = 10, 10
dim = binary_dim + continuous_dim
bounds = np.concatenate(
[
np.tile([0, 1], (binary_dim, 1)),
np.tile([-np.inf, np.inf], (continuous_dim, 1)),
]
)
steps = np.concatenate([np.ones(binary_dim), np.zeros(continuous_dim)])
optimizer = CMAwM(mean=np.zeros(binary_dim + continuous_dim), sigma=2.0, bounds=bounds, steps=steps)
optimizer = CMAwM(mean=np.zeros(dim), sigma=2.0, bounds=bounds, steps=steps)
evals = 0
while True:
Expand Down
16 changes: 10 additions & 6 deletions examples/cmaes_with_margin.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ def ellipsoid_onemax(x, n_zdim):


def main():
dim = 20
binary_dim = dim // 2
discrete_space = np.tile(
np.arange(0, 2, 1), (binary_dim, 1)
) # binary variables (dim_bi x 2)
optimizer = CMAwM(mean=0 * np.ones(dim), sigma=2.0, discrete_space=discrete_space)
binary_dim, continuous_dim = 10, 10
dim = binary_dim + continuous_dim
bounds = np.concatenate(
[
np.tile([0, 1], (binary_dim, 1)),
np.tile([-np.inf, np.inf], (continuous_dim, 1)),
]
)
steps = np.concatenate([np.ones(binary_dim), np.zeros(continuous_dim)])
optimizer = CMAwM(mean=np.zeros(dim), sigma=2.0, bounds=bounds, steps=steps)
print(" evals f(x)")
print("====== ==========")

Expand Down

0 comments on commit 2dfa281

Please sign in to comment.