Skip to content

Commit

Permalink
Update FireflyAlgorithm.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonma1127 authored Apr 24, 2021
1 parent 0062cf5 commit ece95f1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions FireflyAlgorithm.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import numpy as np
import random as rand
import math
import time

class FireflyAlgorithm():

Expand Down Expand Up @@ -40,6 +41,7 @@ def update(self, i, j):
self.functionArray[i] = self.func(self.tmpArray, self.D)

def doRun(self):
start = time.time()
self.init_FA()
for gen in range(self.iter_max):
print("Generation ", gen+1)
Expand All @@ -49,4 +51,6 @@ def doRun(self):
self.update(i,j)
print(self.populationArray)
print(self.functionArray)
end = time.time()
print("執行時間:%f 秒" % (end - start))
return self.functionArray.min()

0 comments on commit ece95f1

Please sign in to comment.