导航:首页 > 源码编译 > 基于遗传算法

基于遗传算法

发布时间:2022-01-25 23:10:27

❶ 基于遗传算法的路径优化

有木有诚意啊,加你的QQ的验证问题竟然是你的真名叫什么……

❷ 基于遗传算法的DNA序列编码。。谁告诉我这个题目什么意思啊。。我只学过遗传算法。。。

大哥,你要真的把基因编码写出来了,你就是活生生的神啊。

遗传算法演算的遗传编码只是计算得到的一个或多个方程的解,代表是的是性状,而且是种群的表现性,可以理解为宏观遗传学,同样的性状的控制基因都是不确定的,甚至还涉及到表观遗传学。怎么去搞?

❸ 基于遗传算法的自动组卷系统的设计与实现(毕业设计) 求大神给一个系统

请问最后您是用什么方式实现的呢,不知是否保留代码?诚求!(价钱可继续商议)

❹ 基于遗传算法路径优化C++编程

[cpp]
bool CAStar::Search(int X, int Y, std::list<POINT> &lResult, double dbGapBreak)
{
if(X < 0 || Y < 0
|| X > m_dwMapWidth || Y > m_dwMapWidth ||
m_dwDestinationX < 0 || m_dwDestinationX < 0 ||
m_dwDestinationX > m_dwMapWidth || m_dwDestinationY > m_dwMapHeight)
{
//_outf("坐标或地图参数错误!");
return false;
}

LPAPOINT p = new APOINT;
p->x = X;
p->y = Y;
p->parent = NULL;
p->dbGap = _p2g(X, Y, m_dwDestinationX, m_dwDestinationY);
m_lOpen.push_front(p);//起始节点加入到开启列表
m_lSafe.push_back(p);//加入到公共容器,任何新分配的节点,都要加入到这里,便于算法执行完后清理

std::list<LPAPOINT>::iterator it;
DWORD dwTime = clock();
while(!m_lOpen.empty())
{
//这里就是反复遍历开启列表选择距离最小的节点
it = GetMingapNode();
if((*it)->dbGap <= dbGapBreak)
break;
p = *it;
GenerateSuccessors(it);
}

if(!m_lOpen.empty())
{
//如果列表不为空,从最后一个节点开始拷贝路径到返回值中
//_outf("最终寻路到:%X, %X", p->x, p->y);
POINT point;
while(p)
{
point.x = p->x;
point.y = p->y;
lResult.push_front(point);
p = p->parent;
}
}

for(it = m_lSafe.begin(); it != m_lSafe.end(); ++it)
{
//清理内存
if(*it != NULL)
{
m_pMap[(*it)->y][(*it)->x] = 1;//会被添加到m_lSafe的节点,一定是最初为1的节点,所以可以在这里恢复地图数据
delete (*it);
*it = NULL;
}
}

m_lSafe.clear();//清空容器

//_outf("耗时:%d 毫秒", clock() - dwTime);

if(m_lOpen.empty())
{
//_outf("寻路失败");
return false;
}

m_lOpen.clear();//清空开启列表
//_outf("寻路成功,节点数:%d", lResult.size());
return true;
}
bool CAStar::Search(int X, int Y, std::list<POINT> &lResult, double dbGapBreak)
{
if(X < 0 || Y < 0
|| X > m_dwMapWidth || Y > m_dwMapWidth ||
m_dwDestinationX < 0 || m_dwDestinationX < 0 ||
m_dwDestinationX > m_dwMapWidth || m_dwDestinationY > m_dwMapHeight)
{
//_outf("坐标或地图参数错误!");
return false;
}

LPAPOINT p = new APOINT;
p->x = X;
p->y = Y;
p->parent = NULL;
p->dbGap = _p2g(X, Y, m_dwDestinationX, m_dwDestinationY);
m_lOpen.push_front(p);//起始节点加入到开启列表
m_lSafe.push_back(p);//加入到公共容器,任何新分配的节点,都要加入到这里,便于算法执行完后清理

std::list<LPAPOINT>::iterator it;
DWORD dwTime = clock();
while(!m_lOpen.empty())
{
//这里就是反复遍历开启列表选择距离最小的节点
it = GetMingapNode();
if((*it)->dbGap <= dbGapBreak)
break;
p = *it;
GenerateSuccessors(it);
}

if(!m_lOpen.empty())
{
//如果列表不为空,从最后一个节点开始拷贝路径到返回值中
//_outf("最终寻路到:%X, %X", p->x, p->y);
POINT point;
while(p)
{
point.x = p->x;
point.y = p->y;
lResult.push_front(point);
p = p->parent;
}
}

for(it = m_lSafe.begin(); it != m_lSafe.end(); ++it)
{
//清理内存
if(*it != NULL)
{
m_pMap[(*it)->y][(*it)->x] = 1;//会被添加到m_lSafe的节点,一定是最初为1的节点,所以可以在这里恢复地图数据
delete (*it);
*it = NULL;
}
}

m_lSafe.clear();//清空容器

//_outf("耗时:%d 毫秒", clock() - dwTime);

if(m_lOpen.empty())
{
//_outf("寻路失败");
return false;
}

m_lOpen.clear();//清空开启列表
//_outf("寻路成功,节点数:%d", lResult.size());
return true;
}

新增的SearchEx源代码如下:
nBeginSift 参数为循环初始值,nEndSift为循环结束值,其实就是一个for循环的起始值与结束值。
这个循环的引用计数,最终会被 乘于 10 来作为距离分段选择路径进行路线优化
nBeginSift 与 nEndSift的间距越大,并不表示最终路径就越好,最终优化出来的路径,还是会和地形有关。
其实最好路径优化算法是按照角度的变化来选择路径优化,但是预计开销会比较大,有了这个优化方式作为基础,你可以自己去写根据角度变化来优化的算法。

[cpp]
bool CAStar::SearchEx(int X, int Y, std::list<POINT> &lResult, double dbGapBreak, int nBeginSift, int nEndSift)
{
DWORD dwTime = clock();
if(!Search(X, Y, lResult, dbGapBreak))
return false;
std::list<POINT>::iterator it = lResult.begin();
std::list<POINT>::iterator it2 = it;

std::list<POINT> l2;
for(int i = nBeginSift; i < nEndSift; i++)
{
it = lResult.begin();
it2 = it;
for(;it != lResult.end(); ++it)
{
if(_p2g(it2->x, it2->y, it->x, it->y) > (double)(i * 10))
{
SetDestinationPos(it->x, it->y);
l2.clear();
if(Search(it2->x, it2->y, l2, 0.0))
{
it = lResult.erase(it2, it);
lResult.insert(it, (l2.begin()), (l2.end()));
}
it2 = it;
}
}
}

_outf("耗时:%d 毫秒", clock() - dwTime);
return true;
}
bool CAStar::SearchEx(int X, int Y, std::list<POINT> &lResult, double dbGapBreak, int nBeginSift, int nEndSift)
{
DWORD dwTime = clock();
if(!Search(X, Y, lResult, dbGapBreak))
return false;
std::list<POINT>::iterator it = lResult.begin();
std::list<POINT>::iterator it2 = it;

std::list<POINT> l2;
for(int i = nBeginSift; i < nEndSift; i++)
{
it = lResult.begin();
it2 = it;
for(;it != lResult.end(); ++it)
{
if(_p2g(it2->x, it2->y, it->x, it->y) > (double)(i * 10))
{
SetDestinationPos(it->x, it->y);
l2.clear();
if(Search(it2->x, it2->y, l2, 0.0))
{
it = lResult.erase(it2, it);
lResult.insert(it, (l2.begin()), (l2.end()));
}
it2 = it;
}
}
}

_outf("耗时:%d 毫秒", clock() - dwTime);
return true;
}

❺ 基于遗传算法的多目标网络优化算法的实现代码

Yovf5网站优化所考虑的因素不仅仅是搜索引擎,也包括充分满足用户的需求特征、清晰的网站导航、完善的在线帮助等,在此基础上使得网站功能和信息发挥最好的效果。也就是以企业网站为基础,与网络服务商(如搜索引擎等)、合作伙伴、顾客、供应商、销售商等网络营销环境中各方面因素建立良好的关系。搜索引擎会将站点彼此间的内容做一些相关性的数据比对,然后再由浏览器将这些内容以最快速且接近最完整的方式,呈现给搜索者。网站优化白帽方法,网站优化的白帽法包括遵循搜索引擎哪些可接受哪些不能接受的指导方针。他们的建议一般是为用户创造内容,而非搜索引擎、是让这些内容易于被蜘蛛机器人索引、并且不尝试对搜索引擎系统耍花招。网站员经常于设计或构建他们的网站时,犯下致命错误、疏忽“毒害”该站以致排名不会很好。ivoet

❻ 基于遗传算法的bp模型问题——请高手给思路!!

我会! 线下联系!已经再帮你做了

❼ matlab怎么运行基于遗传算法的vrp

function [x fx string]=fun_SuiJiSuanFa2(N,genLenth,Pc,Pm,downbound,upbound,generation)
%[x fx string]=fun_SuiJiSuanFa2(6,16,0.7,0.01,-3,3,100)
%f 表示函数
%N表示染色体种群大小
%genLenth表示染色体长度
%Pc表示交叉概率
%Pm表示突变概率
%downbound
%upbound
%generation循环代数

%进制编码,此处编写为二进制
num=2;
initdata=randi([0 num-1],N,genLenth);
%二进制编码的权值
weight=(num).^(genLenth/2-1:-1:0);
weights=repmat(weight,N,1);
%保存每代的最好值和平均值,
meanally=zeros(1,generation);
maxally=zeros(1,generation);

Nowx=zeros(generation,genLenth);
for k=1:generation
%解码后的整数
allx1=sum(initdata(:,1:genLenth/2).*weights,2);
allx2=sum(initdata(:,genLenth/2+1:end).*weights,2);
%映射到取值范围
delt=(upbound-downbound)/(num^(genLenth/2)-1);
allx1=allx1.*delt+downbound;
allx2=allx2.*delt+downbound;
%染色体的适应性
ally=f(allx1,allx2);
%平均值,最大值
meanally(k)=mean(ally);
maxally(k)=max(ally);
%找下标,确定是哪条染色体
index=find(ally==maxally(k));
Nowx(k,:)=initdata(index(1),:);
%最大值没有提高就取上次的
if(k>=2&&maxally(k)<maxally(k-1))
maxally(k)=maxally(k-1);
Nowx(k,:)=Nowx(k-1,:);
end
%染色体的适应性比率
ratio=ally./sum(ally);
%交叉,变异
%??交叉几个,从第几个开始。
%此处只交叉1个(总共才6个),随机给一个。
sumRatio=cumsum(ratio);
data=zeros(N,genLenth);
for i=1:N/2
Select1=find(sumRatio>=rand);
Select2=find(sumRatio>=rand);
data(2*i-1,:)=initdata(Select1(1),:);
data(2*i,:)=initdata(Select2(1),:);
if(rand<Pc)
%交叉
location=randi([1,genLenth]);
temp=data(2*i-1,location:end);
data(2*i-1,location:end)=data(2*i,location:end);
data(2*i,location:end)=temp;
else
%变异
if(rand<Pm)
location=randi([1,genLenth]);
data(2*i-1,location)=1-data(2*i-1,location);
end
if(rand<Pm)
location=randi([1,genLenth]);
data(2*i,location)=1-data(2*i,location);
end
end
end
initdata=data;
end

fx=max(maxally);
lastIndex=find(maxally==fx);
string=Nowx(lastIndex(1),:);

x(1)=sum(string(1:genLenth/2).*weight).*(upbound-downbound)/(num^(genLenth/2)-1)+downbound;
x(2)=sum(string(1+genLenth/2:end).*weight).*(upbound-downbound)/(num^(genLenth/2)-1)+downbound;
%绘制性能图
%figure,hold on;
clf;figure(1),hold on;
plot((1:k)',meanally,'b.-');
plot((1:k)',maxally,'r.:');
end

function fun=f(x,y)
fun=(1-x).^2.*exp(-x.^2-(1+y).^2)-(x-x.^3-y.^3).*exp(-x.^2-y.^2);
%fun=-(x-1).^2-3.*(y-2).^2+100;
end

阅读全文

与基于遗传算法相关的资料

热点内容
编程拖放 浏览:40
linux卸载tomcat 浏览:875
手机时间如何校正到服务器 浏览:81
创造与魔法瞬移源码百度 浏览:882
反射优化java 浏览:874
硬件加密播放盒子 浏览:923
xp点击文件夹选项没反应 浏览:537
苹果不显示桌面的app怎么删除 浏览:864
安卓手机怎么换国际服 浏览:415
神兽领域安卓怎么下载 浏览:250
单片机交通灯ad原理图 浏览:413
多功能解压磁铁笔 浏览:80
少儿编程火箭升空 浏览:401
兰斯10游戏解压码 浏览:42
手机proxy服务器地址 浏览:449
吉他清音压缩 浏览:301
简历模板程序员 浏览:882
螺杆压缩机虚标型号 浏览:953
idea开发项目服务器ip地址 浏览:125
串口服务器出现乱码怎么解决 浏览:950