資源簡介
這個是一個關于雙目標優化的內容.大家可以看一下!

代碼片段和文件信息
%?主函數,用遺傳算法解決雙目標優化問題
%?Sun?Qifeng?2010、4、26
%?=====================目標函數======================
%?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為正整數,且x+y<100
%?======================調用函數說明=================
%?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;%種群規模
Maxgen=100;%最大迭代次數
pm=0.15;%變異概率
pc=0.8;%交叉概率
L=14;%?100的二進制為1100100,所以由x、y構成的染色體長度為14。
[popobjective]=inipop();
popbest=[];%記憶庫,記錄已搜到的pareto解個體
objectivebest=[];%記錄相應的目標值
[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(‘最優帕累托值‘);
figure(2);
plot(xy‘r-*‘);
xlabel(‘x‘);
ylabel(‘y‘);
title(‘相應x、y坐標點‘);
clear?global
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1706??2010-04-27?17:58??雙目標\biob
?????文件???????1706??2010-04-27?17:58??雙目標\biob
?????文件????????390??2010-04-27?18:04??雙目標\inipop.m
?????文件????????327??2010-04-27?16:53??雙目標\inipop.asv
?????文件????????918??2010-04-27?18:01??雙目標\Pareto.m
?????文件????????606??2010-04-27?14:32??雙目標\Pareto.asv
?????文件????????315??2010-04-27?11:09??雙目標\crossover.m
?????文件????????219??2010-04-27?11:07??雙目標\crossover.asv
?????文件????????238??2010-04-27?17:00??雙目標\mutation.m
?????文件????????227??2010-04-27?11:12??雙目標\mutation.asv
?????文件???????1850??2010-04-27?18:05??雙目標\decoding.m
?????文件???????1822??2010-04-27?18:04??雙目標\decoding.asv
?????文件????????650??2010-04-27?18:45??雙目標\elimination.m
?????文件???????1410??2010-04-27?16:56??雙目標\selection.m
?????文件???????1070??2010-04-27?15:37??雙目標\selection.asv
?????目錄??????????0??2010-04-27?09:21??雙目標
-----------?---------??----------?-----??----
????????????????13454????????????????????16
評論
共有 條評論