Skip to content

Commit 3c25f0b

Browse files
author
Morvan Zhou
committed
update
1 parent bb2287d commit 3c25f0b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tutorial-contents/Genetic Algorithm/Genetic Algorithm Basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def select(pop, fitness): # nature selection wrt pop's fitness
3434
def crossover(parent, pop_copy): # mating process (genes crossover)
3535
if np.random.rand() < CROSS_RATE:
3636
i_ = np.random.choice(np.arange(POP_SIZE), size=1) # select another individual from pop
37-
cross_points = np.random.randint(0, 2, DNA_SIZE).astype(np.bool) # choose a crossover points
37+
cross_points = np.random.randint(0, 2, DNA_SIZE).astype(np.bool) # choose crossover points
3838
parent[cross_points] = pop[i_, cross_points] # mating and produce one child
3939
return parent
4040

0 commit comments

Comments
 (0)