在遗传算法中永远不会达到100%
never reach 100% in Genetic algorithm
我的主要程序,我认为这一切都正确,有人可以告诉我我的错误,我从来没有100%健身
我对此很反感,如果您知道
,请回答我void mutate(population *parent,int ratio){
for(unsigned int i=0; i<sizeof(parent[0].gen); i++){
int condition = (rand()%11);
int temp0 = (int)parent[0].gen[i];
int temp1 = (int)parent[1].gen[i];
if(condition < ratio){
if(temp0+10 <127 ){
parent[0].gen[i] = char(temp0 + 10);
//cout<<temp0<<endl;
}else{
temp0 = temp0 + 10 - 80;
parent[0].gen[i] = char(temp0);
// cout<<(int)parent[0].gen[i]<<endl;
}
if(temp1+10 <127 ){
parent[1].gen[i] = char(temp1 + 10);
//cout<<temp0<<endl;
}else{
temp1 = temp1 + 10 - 80;
parent[1].gen[i] = char(temp1);
}
}
}
这是我用于突变的示例代码,如下图中的图片中的完整程序
genitygorithm_1genitygorithm_1
尚不清楚您要解决的问题,但很可能是NP完整性,如果没有机器学习,其他类型可以更有效地解决。但是您必须了解,NP完整性问题的精确解决方案需要详尽的搜索所有可能的解决方案。机器学习无法避免此问题,因此100%准确性的成就比基于Brutfors的方法更容易。机器学习的目的,特别是遗传算法的目的是在A 中找到可接受的解决方案>可接受的时间。
相关文章:
- 为什么这个运算符<重载函数对 STL 算法不可见?
- C++向量初始化遗传算法的代理向量
- 编程作业:机器人遗传算法
- 在遗传算法中永远不会达到100%
- 多线程galib247遗传算法陷入局部极大值
- 遗传算法中的单点交叉
- 如何利用遗传算法求C中数的平方根来实现选择和交叉
- 遗传算法的选择机制
- 在遗传算法中使用二进制编码是必要的吗
- 遗传算法和神经网络:临时地址[-fallowive]
- 访问基于遗传算法的PNRG中的数组? " no match for operator[] "
- 使用控件(按钮等)动态填充100%窗口的算法
- 在遗传算法中,对于非排序群体,应该如何组织轮盘选择
- 为什么我的遗传算法不收敛
- 为遗传算法分配和检索逐位内存值
- 测量在算法库中对100万个0到1之间的浮点数进行排序的时间
- 神经网络与遗传算法问题
- 种群变得陈旧——遗传算法
- 如何为遗传算法生成随机数?
- 用C(++)语言将double转换为遗传算法的位数组