Skip to content

Commit

Permalink
Merge pull request #1447 from BenHBLiu/develop
Browse files Browse the repository at this point in the history
update
  • Loading branch information
weihuayi authored Jan 14, 2025
2 parents 05f6d70 + 1114d83 commit 6f67970
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fealpy/opt/exponential_trigonometric_opt_alg.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def run(self):

d1 = 0.1 * bm.exp(bm.array(-0.01 * (it + 1))) * bm.cos(bm.array(0.5 * MaxIT * (1 - it / MaxIT))) # Eq.(10)
d2 = -0.1 * bm.exp(bm.array(-0.01 * (it + 1))) * bm.cos(bm.array(0.5 * MaxIT * (1 - it / MaxIT))) # Eq.(11)
CM = (bm.sqrt(bm.array(it / MaxIT)) ** bm.tan(d1 / (d2 + 1e-8))) * bm.random.rand(N, 1) * 0.01 # Eq.(18)
CM = (bm.sqrt(bm.array((it + 1) / MaxIT)) ** bm.tan(d1 / (d2 + 1e-8))) * bm.random.rand(N, 1) * 0.01 # Eq.(18)
if it == CEi:
j = bm.random.randint(0, dim, (1,))
r1 = bm.random.rand(1, 1)
Expand Down Expand Up @@ -78,6 +78,7 @@ def run(self):
# The second phase(
x = ((CM > 1) * (x + bm.exp(bm.tan(bm.abs(d1 / (d2 + 1e-8)) * bm.abs(bm.random.rand(N, dim) * alpha_2 * self.gbest - x)))) + # Eq.(16)
(CM <= 1) * (x + 3 * (bm.abs(bm.random.rand(N, dim) * alpha_2 * self.gbest - x)) * (1 - 2 * (q1 > 0.5)))) # Eq.(12)
CEi = CEi_temp
x = x + (LB - x) * (x < LB) + (UB - x) * (x > UB)
fit = self.fun(x)
self.update_gbest(x, fit)
Expand Down

0 comments on commit 6f67970

Please sign in to comment.