Skip to content

Commit

Permalink
Update de
Browse files Browse the repository at this point in the history
  • Loading branch information
MinyangChen committed Jul 11, 2023
1 parent 1fc6e5a commit 4477a55
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/evox/algorithms/so/de.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ def __init__(
pop_size,
base_vector="rand",
num_difference_vectors=1,

differential_weight=0.5,
cross_probability=0.9,
#batch_size=100,
batch_size=100,
mean = None,
stdvar = None,
):
Expand Down Expand Up @@ -87,7 +86,6 @@ def ask(self, state):
)(indices, R, random_choiced=random_choices, mask=masks)

return trial_vectors, state.update(trial_vectors=trial_vectors, key=key)


def _ask_one(self, index, R, population, best_index, random_choiced, mask):
random_choiced = jnp.where(
Expand All @@ -99,11 +97,8 @@ def _ask_one(self, index, R, population, best_index, random_choiced, mask):
else:
base_vector = population[random_choiced[0], :]


difference_vectors = population[random_choiced[1:], :]

subtrahend_index = jnp.arange(1, self.num_difference_vectors * 2 + 1, 2)

mutation_vectors = (
jnp.sum(difference_vectors.at[subtrahend_index, :].multiply(-1), axis=0)
* self.differential_weight
Expand Down

0 comments on commit 4477a55

Please sign in to comment.