Skip to content

Commit 3987b11

Browse files
committed
minor fixes
1 parent 2900c9e commit 3987b11

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
matrix:
1515
os: [ubuntu-latest, windows-latest, macos-latest]
16-
python-version: ['3.9', '3.10']
16+
python-version: ['3.9', '3.10', '3.11', '3.12']
1717
defaults:
1818
run:
1919
shell: bash

examples/run.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
import numpy as np
21
from fireflyalgorithm import FireflyAlgorithm
3-
4-
5-
def sphere(x):
6-
return np.sum(x ** 2)
2+
from fireflyalgorithm.problems import sphere
73

84

95
FA = FireflyAlgorithm()

fireflyalgorithm/problems.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def katsuura(x):
5656
dim = len(x)
5757
k = np.atleast_2d(np.arange(1, 33)).T
5858
i = np.arange(0, dim * 1)
59-
inner = np.round(2**k * x) * (2 ** (-k))
59+
inner = np.round(2**k * x) * (2.0 ** (-k))
6060
return np.prod(np.sum(inner, axis=0) * (i + 1) + 1)
6161

6262

@@ -165,7 +165,9 @@ def schaffer4(x):
165165

166166
def schwefel(x):
167167
dim = len(x)
168-
return 418.9829 * dim - np.sum(x * np.sin(np.sqrt(np.abs(x))))
168+
return 418.982887272433799807913601398 * dim - np.sum(
169+
x * np.sin(np.sqrt(np.abs(x)))
170+
)
169171

170172

171173
def schwefel21(x):

0 commit comments

Comments
 (0)