genetic_algorithm
Genetic Algorithm
mutation
import numpy as np pop_size = 5 length = 3 pop = np.zeros((pop_size, length)) def mutate(pop, prob=0.5): r = np.random.random((pop_size, length)) < prob v = np.random.random((pop_size, length)) - 0.5 return pop + r * v for _ in range(5): pop = mutate(pop) print(3 + _, pop)
genetic_algorithm.txt · 마지막으로 수정됨: 2024/03/23 02:38 저자 127.0.0.1