PytLab / gaft

A Genetic Algorithm Framework in Python (not for production level)
http://gaft.readthedocs.io/
GNU General Public License v3.0
739 stars 218 forks source link

变异或交叉后数值溢出问题 #27

Closed caowencai closed 5 years ago

caowencai commented 6 years ago

以整数为例: 假设chrom1 = '1000',ranges = [0,10],chrom1变异为1100则outrange,此处在库里面没看到相关处理; 同理,假设chrom2 = '0101',与chrom1在第2位交叉,也会出现outrange; 当然,outrange异常可以在fitness中进行惩罚,但这点不得不提一下。

PytLab commented 5 years ago

你好,为了能使得最大值对应二进制编码序列的最大值1111...,程序会对离散精度进行自动的调节,一般会使得精度降低(尽可能降低,但是基本争取不会影响最后的优化结果