Skip to content

hobinkwak/Whale-Optimization-Algorithm-python

Repository files navigation

Whale Optimization Algorithm python

  • simple WOA (Whale Optimization Algorithm) implementation
  • used Numpy for matrix computation (No For Loop)
  • Original Paper here

Test

  • Rosenbrock function (=Banana function)
    • minimum solution : (1, 1)
def f(X):
    a, b = 1, 100
    sol = []
    for x in X:
        sol.append(((a - x[0]) ** 2) + b*(x[1]-x[0]**2)**2)
    return np.array(sol)
  • Rastrigin function
    • minimum solution : (0, 0)
def f(X):
    A = 10
    sol = []
    for ind in X:
        sol.append(A*len(ind) + sum([(i**2 - A * np.cos(2 * np.pi * i)) for i in ind]) )
    return np.array(sol)

WOA

  • Whale Optimization Algorithm Code in woa.py
    • # of whales : n_whale (default: 100, init parameter)
    • # of iterations : n_iter (default: 100, init parameter)
    • Spiral Constant : spiral_constant (default: 0.5, init parameter)
      • controls the shape of the spiral which whales follow (from here)

Requirements

  • matplotlib==3.5.1
  • numpy==1.20.0

About

simple WOA (Whale Optimization Algorithm) implementation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy