Skip to content

Commit 67acdb8

Browse files
committed
wip
1 parent b92db57 commit 67acdb8

7 files changed

+3
-2
lines changed
-3.65 KB
Binary file not shown.

__pycache__/fish.cpython-35.pyc

-1.51 KB
Binary file not shown.
-4.01 KB
Binary file not shown.

__pycache__/functions.cpython-35.pyc

-2.19 KB
Binary file not shown.

__pycache__/parameters.cpython-35.pyc

-270 Bytes
Binary file not shown.

__pycache__/particle.cpython-35.pyc

-2.53 KB
Binary file not shown.

fish_school_search.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import functools
33
import random
44
import math
5+
import numpy as np
56

67
from particle import Fish
78
from parameters import num_of_individuos, dimensions, iterations_number
@@ -69,7 +70,7 @@ def search(self):
6970
# calculates the baricenter
7071
weights_sum = 0
7172
for fish in self.population:
72-
weights_sum = fish.weights
73+
weights_sum += fish.weights
7374

7475
weights_sum_times_position = 0
7576
for fish in self.population:
@@ -80,7 +81,7 @@ def search(self):
8081

8182
# executes volitive moviment
8283
for fish in self.population:
83-
distance_to_baricenter = self._euclidian_distance(fish.current_position, baricenter)
84+
distance_to_baricenter = np.linalg.norm([fish.current_position, baricenter])
8485

8586
volational_array = []
8687
difference_to_baricenter = []

0 commit comments

Comments
 (0)