https://github.com/jasonma1127/artificialbeecolony
Using Artificial Bee Colony to find the minimal/maximal solution of Rastrigin function and Styblinski-Tang function
https://github.com/jasonma1127/artificialbeecolony
abc artificial-bee-colony artificialbeecolony
Last synced: about 1 month ago
JSON representation
Using Artificial Bee Colony to find the minimal/maximal solution of Rastrigin function and Styblinski-Tang function
- Host: GitHub
- URL: https://github.com/jasonma1127/artificialbeecolony
- Owner: jasonma1127
- Created: 2021-04-19T13:14:24.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-06-27T08:07:19.000Z (about 5 years ago)
- Last Synced: 2025-12-29T08:12:19.999Z (6 months ago)
- Topics: abc, artificial-bee-colony, artificialbeecolony
- Language: Python
- Homepage:
- Size: 9.77 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ArtificialBeeColony
## CODE EXAMPLE:
```python
def test(X,D):
x1 = X[0]
x2 = X[1]
return x1**2 - x1*x2 + x2**2 + 2*x1 + 4*x2 + 3
def RastriginFunc(X, D):
funsum = 0
for i in range(D):
x = X[i]
funsum += x**2-10*np.cos(2*np.pi*x)
funsum += 10*D
return funsum
def StyblinskiTangFunc(X, D):
funsum = 0
for i in range(D):
x = X[i]
funsum += (x**4) - 16*(x**2) + 5*x
funsum *= 0.5
return funsum
# ArtificialBeeColony(D, Lb, Ub, n, generation, ans[min=0/max=1], func)
abc = ArtificialBeeColony(2, -5, 5, 5, 100, 0, test)
abc.doRun()
```