Skip to content

Commit

Permalink
Merge pull request #560 from GregaRubin/ilshade
Browse files Browse the repository at this point in the history
New algorithm: iL-SHADE
  • Loading branch information
firefly-cpp authored Sep 18, 2024
2 parents e0f9374 + 2c6e4f2 commit c387d8d
Show file tree
Hide file tree
Showing 4 changed files with 455 additions and 1 deletion.
20 changes: 20 additions & 0 deletions examples/run_ilshade.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# encoding=utf8
# This is temporary fix to import module from parent folder
# It will be removed when package is published on PyPI
import sys

sys.path.append('../')
# End of fix

from niapy.algorithms.modified import ImprovedLpsrSuccessHistoryAdaptiveDifferentialEvolution
from niapy.task import Task
from niapy.problems import Griewank

# we will run iL-SHADE algorithm for 5 independent runs
algo = ImprovedLpsrSuccessHistoryAdaptiveDifferentialEvolution(population_size=40, extern_arc_rate=2.6, pbest_start=0.2,
pbest_end=0.1, hist_mem_size=6)
for i in range(5):
task = Task(problem=Griewank(dimension=10, lower=-600, upper=600), max_evals=10000, enable_logging=True)
best = algo.run(task)
print('%s -> %s' % (best[0], best[1]))
print(algo.get_parameters())
4 changes: 3 additions & 1 deletion niapy/algorithms/modified/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
SuccessHistoryAdaptiveDifferentialEvolution,
LpsrSuccessHistoryAdaptiveDifferentialEvolution
)
from niapy.algorithms.modified.ilshade import ImprovedLpsrSuccessHistoryAdaptiveDifferentialEvolution

__all__ = [
'HybridBatAlgorithm',
Expand All @@ -44,5 +45,6 @@
'HybridSelfAdaptiveBatAlgorithm',
'ParameterFreeBatAlgorithm',
'SuccessHistoryAdaptiveDifferentialEvolution',
'LpsrSuccessHistoryAdaptiveDifferentialEvolution'
'LpsrSuccessHistoryAdaptiveDifferentialEvolution',
'ImprovedLpsrSuccessHistoryAdaptiveDifferentialEvolution'
]
Loading

0 comments on commit c387d8d

Please sign in to comment.