c实现遗传算法,模拟花朵的进化(编辑修改稿)内容摘要:

ss + (water[flower] currentWater)。 theFitness = theFitness + (sunlight[flower] currentSunlight)。 theFitness = theFitness + (nutrient[flower] currentNutrient)。 theFitness = theFitness + (beneficialInsect[flower] currentBeneficialInsect)。 theFitness = theFitness + (harmfulInsect[flower] currentHarmfulInsect)。 return (theFitness)。 } /// summary /// 排除适应能力差的花朵,让适应能力强的花朵杂交繁殖,产生下一代。 同时有一定的概率变异。 /// /summary public void Evolve() { int[] fitTemperature = new int[kMaxFlowers]。 int[] fitWater = new int[kMaxFlowers]。 int[] fitSunlight = new int[kMaxFlowers]。 int[] fitNutrient = new int[kMaxFlowers]。 int[] fitBeneficialInsect = new int[kMaxFlowers]。 int[] fitHarmfulInsect = new int[kMaxFlowers]。 int[] fitness = new int[kMaxFlowers]。 int i。 int leastFit = 0。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。