Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit76bb230

Browse files
authored
Fix issueahmedfgad#89
Fixes this issue:ahmedfgad#89In the tournament_selection() method, this line:parents_indices.append(selected_parent_idx)is replaced by this line:parents_indices.append(rand_indices[selected_parent_idx])
1 parente7e8d22 commit76bb230

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎pygad.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1412,7 +1412,7 @@ def tournament_selection(self, fitness, num_parents):
14121412
rand_indices=numpy.random.randint(low=0.0,high=len(fitness),size=self.K_tournament)
14131413
K_fitnesses=fitness[rand_indices]
14141414
selected_parent_idx=numpy.where(K_fitnesses==numpy.max(K_fitnesses))[0][0]
1415-
parents_indices.append(selected_parent_idx)
1415+
parents_indices.append(rand_indices[selected_parent_idx])
14161416
parents[parent_num, :]=self.population[rand_indices[selected_parent_idx], :].copy()
14171417

14181418
returnparents,parents_indices

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp