資源簡介
這個(gè)是一個(gè)關(guān)于雙目標(biāo)優(yōu)化的內(nèi)容.大家可以看一下!

代碼片段和文件信息
%?主函數(shù),用遺傳算法解決雙目標(biāo)優(yōu)化問題
%?Sun?Qifeng?2010、4、26
%?=====================目標(biāo)函數(shù)======================
%?min?f1=300/x+500/y+300/(100-x-y)
%?min?f2=30(300/x-3)+12(500/y-5)+(300/(100-x-y)-3)????
%?======================約束=========================
%?x、y為正整數(shù),且x+y<100
%?======================調(diào)用函數(shù)說明=================
%?inipop.m????生成初始種群
%?Pareto.m????把種群中的pareto解保存到popbest中
%?crossover.m?交叉操作
%?mutation.m??變異操作
%?decoding.m??解碼操作
%?elimination.m?將popbest中的非pareto解去掉
%?selection.m?選擇操作
%?=======================變量說明====================
%===================================================
clear?all
global?popsize?L
popsize=100;%種群規(guī)模
Maxgen=100;%最大迭代次數(shù)
pm=0.15;%變異概率
pc=0.8;%交叉概率
L=14;%?100的二進(jìn)制為1100100,所以由x、y構(gòu)成的染色體長度為14。
[popobjective]=inipop();
popbest=[];%記憶庫,記錄已搜到的pareto解個(gè)體
objectivebest=[];%記錄相應(yīng)的目標(biāo)值
[popbestobjectivebest]=Pareto(popobjectivepopbestobjectivebest);
for?generation=1:Maxgen
????oldpop=pop;
????pop=crossover(poppc);
????pop=mutation(poppm);
????[popobjective]=decoding(popoldpop);
????[popbestobjectivebest]=Pareto(popobjectivepopbestobjectivebest);
????[popbestobjectivebest]=elimination(popbestobjectivebest);
????[pop]=selection(popobjective);
end
[objectivebestindex]=sortrows(objectivebest);%排序,方便畫圖
x=bin2dec(popbest(index1:L/2));
y=bin2dec(popbest(indexL/2+1:end));
figure(1);
plot(objectivebest(:1)objectivebest(:2)‘r-*‘);
xlabel(‘f1‘);
ylabel(‘f2‘);
title(‘最優(yōu)帕累托值‘);
figure(2);
plot(xy‘r-*‘);
xlabel(‘x‘);
ylabel(‘y‘);
title(‘相應(yīng)x、y坐標(biāo)點(diǎn)‘);
clear?global
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????1706??2010-04-27?17:58??雙目標(biāo)\biob
?????文件???????1706??2010-04-27?17:58??雙目標(biāo)\biob
?????文件????????390??2010-04-27?18:04??雙目標(biāo)\inipop.m
?????文件????????327??2010-04-27?16:53??雙目標(biāo)\inipop.asv
?????文件????????918??2010-04-27?18:01??雙目標(biāo)\Pareto.m
?????文件????????606??2010-04-27?14:32??雙目標(biāo)\Pareto.asv
?????文件????????315??2010-04-27?11:09??雙目標(biāo)\crossover.m
?????文件????????219??2010-04-27?11:07??雙目標(biāo)\crossover.asv
?????文件????????238??2010-04-27?17:00??雙目標(biāo)\mutation.m
?????文件????????227??2010-04-27?11:12??雙目標(biāo)\mutation.asv
?????文件???????1850??2010-04-27?18:05??雙目標(biāo)\decoding.m
?????文件???????1822??2010-04-27?18:04??雙目標(biāo)\decoding.asv
?????文件????????650??2010-04-27?18:45??雙目標(biāo)\elimination.m
?????文件???????1410??2010-04-27?16:56??雙目標(biāo)\selection.m
?????文件???????1070??2010-04-27?15:37??雙目標(biāo)\selection.asv
?????目錄??????????0??2010-04-27?09:21??雙目標(biāo)
-----------?---------??----------?-----??----
????????????????13454????????????????????16
評論
共有 條評論