Skip to content

Commit 4820978

Browse files
committed
improve convergence
1 parent 7365634 commit 4820978

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
@@ -46,7 +46,7 @@ def mutate(child):
4646
return child
4747

4848

49-
pop = np.random.randint(0, 2, (1, DNA_SIZE)).repeat(POP_SIZE, axis=0) # initialize the pop DNA
49+
pop = np.random.randint(2, size=(POP_SIZE, DNA_SIZE)) # initialize the pop DNA
5050

5151
plt.ion() # something about plotting
5252
x = np.linspace(*X_BOUND, 200)

0 commit comments

Comments
 (0)