Skip to content

Commit

Permalink
fix: bounds in DECC-G
Browse files Browse the repository at this point in the history
- Add clipping to final weighted individual of DECC-G;
- The previous fix didn't include this clipping after the optimization
  process;
  • Loading branch information
moesio-f committed Sep 17, 2023
1 parent c3905f7 commit 22ca470
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "decc"
version = "0.2.1"
version = "0.2.2"
readme = "README.md"
description = "Cooperative Co-evolutionary Differential Evolution algorithms in Python."

Expand Down
3 changes: 3 additions & 0 deletions src/decc/optimizers/decc_g.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ def _update_pop_w_weights(idx: int):
for i, g in enumerate(groups):
weighted_individual[g] = best_w[i] * population[idx, g]

# Clipping weighted individual
weighted_individual = np.clip(weighted_individual, l, u)

# Update population in this idx
population[idx] = weighted_individual
population_fitness[idx] = best_w_f
Expand Down

0 comments on commit 22ca470

Please sign in to comment.