遗传算法求sinx最大值 import random import math import numpy as np import matplotlib.pyplot as pltpopulation_size = 400 # 种群数量 generations = 2000 # 迭代次数 chrom_length = 8 #