Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions kernel_tuner/strategies/firefly_algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def __init__(self, bounds):
"""Create Firefly at random position within bounds."""
super().__init__(bounds)
self.bounds = bounds
self.intensity = 1 / self.score
self.intensity = -self.score

def distance_to(self, other):
"""Return Euclidian distance between self and other Firefly."""
Expand All @@ -103,10 +103,7 @@ def distance_to(self, other):
def compute_intensity(self, fun):
"""Evaluate cost function and compute intensity at this position."""
self.evaluate(fun)
if self.score == sys.float_info.max:
self.intensity = -sys.float_info.max
else:
self.intensity = 1 / self.score
self.intensity = -self.score

def move_towards(self, other, beta, alpha):
"""Move firefly towards another given beta and alpha values."""
Expand Down