⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 车间作业调度问题遗传算法matlab源码.htm

📁 车间调度问题的遗传算法matlab源程序
💻 HTM
📖 第 1 页 / 共 2 页
字号:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="style_index.css" rel="stylesheet" type="text/css">
<title>车间作业调度问题遗传算法Matlab源码</title>
</HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=2 > 
<SCRIPT language=JavaScript src="sy/simp_trad.js" 
type=text/JavaScript></SCRIPT>

<SCRIPT language=JavaScript type=text/JavaScript> 
function DT_Simp_Trad(){ 
document.body.innerHTML=document.body.innerHTML.s2t(); 
} 
function DT_Trad_Simp(){ 
document.body.innerHTML=document.body.innerHTML.t2s(); 
} 
</SCRIPT>

</HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=2>
<p>
<script type="text/JavaScript" language="JavaScript" src="DT_inc/simp_trad.js"></script> 
<script type="text/JavaScript" language="JavaScript"> 
function DT_Simp_Trad(){ 
document.body.innerHTML=document.body.innerHTML.s2t(); 
} 
function DT_Trad_Simp(){ 
document.body.innerHTML=document.body.innerHTML.t2s(); 
} 
</script> 


<TABLE width=765  border=0 align=center cellPadding=0 cellSpacing=0 background="images/dx1.gif">
  
    <TR>
      <TD width="200" height=80>&nbsp;<a href="http://www.shumo88.com"><img src="images/Logo_deepteach.gif" width="180" height="60" border="0" title="湖北数学建模网"></a></TD>
      <TD>


<div align="center">
  <script type="text/javascript"><!--
google_ad_client = "pub-9628114057925132";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as_rimg";
google_cpa_choice = "CAAQq8b8zwEaCGyZtT-0SR1TKJnA93M";
google_ad_channel = "";
//-->
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>



      </TD>
      <TD width="100"><p align="center"><a href="old" target=_blank>旧版入口</a><br>
          <a href="http://www.shumo88.com" onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.shumo88.com')" target=_self>设为首页</a><br>
          <a href="http://www.shumo88.com" onClick="window.external.addFavorite('http://www.shumo88.com','【湖北数学建模网】湖北数学建模网')" target=_self>收藏本站</a><br><a href="javascript:DT_Simp_Trad()">繁体</a><a href="javascript:DT_Trad_Simp()">简体</a> 
        </p></TD>
    </TR>
  
</TABLE>
<TABLE width="765" border=0 align="center" cellPadding=0 cellSpacing=0>
  
    <TR>
      <TD width=16><IMG height=41  src="images/index1_1.gif" width=16> </TD>
      <TD width=472 valign="middle" background=images/index1_2.gif>&nbsp; 

&nbsp;<a href="index.asp" title="首页">首 页</a>

&nbsp;<a href="index_Article_Content_all.asp" title="文章中心">文章中心</a>

&nbsp;<a href="index_soft_all.asp" title="教程课件、DW源码">下载中心</a>

&nbsp;<a href="asp" title="快乐家园">综合频道</a>

&nbsp;<a href="free" title="网址精彩导航">精彩导航</a>

&nbsp;<a href="wz" title="网络文学">网络文学</a>

&nbsp;<a href="old" title="旧版入口">静态入口</a>

&nbsp;<a href="old/gbook" title="数模论坛 雁过留声">数模论坛</a>
      </TD>
      <TD valign="top" background=images/index1_5.gif><IMG height=41  src="images/index1_4.gif" width=30></TD>
      <TD width="200" valign="bottom" background=images/index1_5.gif><div align="right">http://www.shumo88.com</div></TD>
      <TD width=14 valign="top"><IMG src="images/index1_7.gif" width=14 height=41 align="top"></TD>
    </TR>
  
</TABLE>

</p>
<TABLE cellSpacing=0 cellPadding=0 width=765 align=center border=0>
  <TR>
    <TD width=765></TD>
  <TR>
    <TD width=765 height="35" align=middle vAlign=top bgColor=#f9f9f9>
      <TABLE width=97% border=0 align="center" cellPadding=0 cellSpacing=0>
        <TR>
          <TD width="16"><IMG height=41  
                        src="images/index1_1.gif" width=16></TD>
          <TD width=250 background=images/index1_2.gif 
                      height=41><div align="left"><IMG src="images/d5.gif"> </div></TD>
          <TD width=30 background=images/index1_5.gif><IMG 
                        height=41  src="images/index1_4.gif" 
                        width=30></TD>
          <TD background=images/index1_5.gif></TD>
          <TD width=14><IMG height=41  
                        src="images/index1_7.gif" width=14></TD>
        </TR>
        <TR>
          <TD background=images/index1_8.gif></TD>
          <TD vAlign=top background=images/index1_9.gif 
                      colSpan=3>


                          <table width="95%" align="center" cellpadding="10">
                            <tr>
                              <td><p align="center"><h4>车间作业调度问题遗传算法Matlab源码</h4></p>
                                <p align="center">作者:佚名&nbsp; 来源:网络&nbsp;&nbsp;时间:2007-3-28 12:51:33&nbsp; 阅读次数:498</p>
                                <hr>
                              </td>
                            </tr>
                            <tr>
                              <td><div align="left"><div style="float: right; marging: 0 0 5px 5px; padding: 0px; width: 710; height: 90px; background:#FFFF;">&nbsp;<img border="0" src="images/soft_download.gif" width="21" height="16">
								<font color="#FF0000">本站提示:以下信息更精彩</font>


<div align="center">
  <script type="text/javascript"><!--
google_ad_client = "pub-9628114057925132";
google_ad_width = 700;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel = "";
google_color_border = "C3D9FF";
google_color_bg = "FFFFFF";
google_color_link = "0099FF";
google_color_text = "000000";
google_color_url = "0099FF";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>


</div><br><br><P><FONT face="Times New Roman">function [Zp,Y1p,Y2p,Y3p,Xp,LC1,LC2]=JSPGA(M,N,Pm,T,P)<BR>%--------------------------------------------------------------------------<BR>%&nbsp; JSPGA.m<BR>%&nbsp; 车间作业调度问题遗传算法<BR>%--------------------------------------------------------------------------<BR>%&nbsp; 输入参数列表<BR>%&nbsp; M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 遗传进化迭代次数<BR>%&nbsp; N&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 种群规模(取偶数)<BR>%&nbsp; Pm&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 变异概率<BR>%&nbsp; T&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m×n的矩阵,存储m个工件n个工序的加工时间<BR>%&nbsp; P&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1×n的向量,n个工序中,每一个工序所具有的机床数目<BR>%&nbsp; 输出参数列表<BR>%&nbsp; Zp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 最优的Makespan值<BR>%&nbsp; Y1p&nbsp;&nbsp;&nbsp;&nbsp; 最优方案中,各工件各工序的开始时刻,可根据它绘出甘特图<BR>%&nbsp; Y2p&nbsp;&nbsp;&nbsp;&nbsp; 最优方案中,各工件各工序的结束时刻,可根据它绘出甘特图<BR>%&nbsp; Y3p&nbsp;&nbsp;&nbsp;&nbsp; 最优方案中,各工件各工序使用的机器编号<BR>%&nbsp; Xp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 最优决策变量的值,决策变量是一个实数编码的m×n矩阵<BR>%&nbsp; LC1&nbsp;&nbsp;&nbsp;&nbsp; 收敛曲线1,各代最优个体适应值的记录<BR>%&nbsp; LC2&nbsp;&nbsp;&nbsp;&nbsp; 收敛曲线2,各代群体平均适应值的记录<BR>%&nbsp; 最后,程序还将绘出三副图片:两条收敛曲线图和甘特图(各工件的调度时序图)</FONT></P>
<P><FONT face="Times New Roman">%第一步:变量初始化<BR>[m,n]=size(T);%m是总工件数,n是总工序数<BR>Xp=zeros(m,n);%最优决策变量<BR>LC1=zeros(1,M);%收敛曲线1<BR>LC2=zeros(1,N);%收敛曲线2</FONT></P>
<P><FONT face="Times New Roman">%第二步:随机产生初始种群<BR>farm=cell(1,N);%采用细胞结构存储种群<BR>for k=1:N<BR>&nbsp;&nbsp;&nbsp; X=zeros(m,n);<BR>&nbsp;&nbsp;&nbsp; for j=1:n<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for i=1:m<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; X(i,j)=1+(P(j)-eps)*rand;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end<BR>&nbsp;&nbsp;&nbsp; end<BR>&nbsp;&nbsp;&nbsp; farm{k}=X;<BR>end</FONT></P>
<P><FONT face="Times New Roman">counter=0;%设置迭代计数器<BR>while counter<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp; %第三步:交叉<BR>&nbsp;&nbsp;&nbsp; newfarm=cell(1,N);%交叉产生的新种群存在其中<BR>&nbsp;&nbsp;&nbsp; Ser=randperm(N);<BR>&nbsp;&nbsp;&nbsp; for i=1:2:(N-1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A=farm{Ser(i)};%父代个体<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; B=farm{Ser(i+1)};<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Manner=unidrnd(2);%随机选择交叉方式<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if Manner==1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cp=unidrnd(m-1);%随机选择交叉点<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; %双亲双子单点交叉<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a=[A(1:cp,:);B((cp+1):m,:)];%子代个体<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b=[B(1:cp,:);A((cp+1):m,:)];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cp=unidrnd(n-1);%随机选择交叉点<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a=[A(:,1:cp),B(:,(cp+1):n)];%双亲双子单点交叉<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b=[B(:,1:cp),A(:,(cp+1):n)];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newfarm{i}=a;%交叉后的子代存入newfarm<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newfarm{i+1}=b;<BR>&nbsp;&nbsp;&nbsp; end<BR>&nbsp;&nbsp;&nbsp; %新旧种群合并<BR>&nbsp;&nbsp;&nbsp; FARM=[farm,newfarm];<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp; %第四步:选择复制<BR>&nbsp;&nbsp;&nbsp; FITNESS=zeros(1,2*N);<BR>&nbsp;&nbsp;&nbsp; fitness=zeros(1,N);<BR>&nbsp;&nbsp;&nbsp; plotif=0;<BR>&nbsp;&nbsp;&nbsp; for i=1:(2*N)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; X=FARM{i};<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Z=COST(X,T,P,plotif);%调用计算费用的子函数<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FITNESS(i)=Z;<BR>&nbsp;&nbsp;&nbsp; end<BR>&nbsp;&nbsp;&nbsp; %选择复制采取两两随机配对竞争的方式,具有保留最优个体的能力<BR>&nbsp;&nbsp;&nbsp; Ser=randperm(2*N);<BR>&nbsp;&nbsp;&nbsp; for i=1:N<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; f1=FITNESS(Ser(2*i-1));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; f2=FITNESS(Ser(2*i));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if f1&lt;=f2<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; farm{i}=FARM{Ser(2*i-1)};<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fitness(i)=FITNESS(Ser(2*i-1));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; farm{i}=FARM{Ser(2*i)};<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fitness(i)=FITNESS(Ser(2*i));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end<BR>&nbsp;&nbsp;&nbsp; end<BR>&nbsp;&nbsp;&nbsp; %记录最佳个体和收敛曲线<BR>&nbsp;&nbsp;&nbsp; minfitness=min(fitness)<BR>&nbsp;&nbsp;&nbsp; meanfitness=mean(fitness)<BR>&nbsp;&nbsp;&nbsp; LC1(counter+1)=minfitness;%收敛曲线1,各代最优个体适应值的记录<BR>&nbsp;&nbsp;&nbsp; LC2(counter+1)=meanfitness;%收敛曲线2,各代群体平均适应值的记录<BR>&nbsp;&nbsp;&nbsp; pos=find(fitness==minfitness);<BR>&nbsp;&nbsp;&nbsp; Xp=farm{pos(1)};<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp; %第五步:变异<BR>&nbsp;&nbsp;&nbsp; for i=1:N<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if Pm&gt;rand;%变异概率为Pm<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; X=farm{i};<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I=unidrnd(m);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; J=unidrnd(n);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; X(I,J)=1+(P(J)-eps)*rand;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; farm{i}=X;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end<BR>&nbsp;&nbsp;&nbsp; end<BR>&nbsp;&nbsp;&nbsp; farm{pos(1)}=Xp;<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp; counter=counter+1<BR>end</FONT></P>
<P><FONT face="Times New Roman">%输出结果并绘图<BR>figure(1);<BR>plotif=1;<BR>X=Xp;<BR>[Zp,Y1p,Y2p,Y3p]=COST(X,T,P,plotif);<BR>figure(2);<BR>plot(LC1);<BR>figure(3);<BR>plot(LC2);</FONT><FONT face="Times New Roman">&nbsp;</FONT></P><br>
                                </div></td>
                            </tr>
                            <tr>
                              <td><table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#336699">
                                  <tbody>
                                    <tr>
                                      <td bgcolor="#c8d0ff" height="20"><div align="left"><strong>&nbsp;&nbsp;&nbsp;相关内容</strong> </div></td>
                                    </tr>
                                    <tr>
                                      <td height="40" align="middle" bgcolor="#ffffff"><div align="left">&nbsp;<a href="http://www.baidu.com/baidu?tn=advert&word=车间作业调度问题遗传算法Matlab源码" target=_blank>查看更多关于“车间作业调度问题遗传算法Matlab源码”的文章</a>	
                                          <br />

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -