【本科畢業(yè)設(shè)計(jì)】基本遺傳算法及其在函數(shù)優(yōu)化中的應(yīng)用
《【本科畢業(yè)設(shè)計(jì)】基本遺傳算法及其在函數(shù)優(yōu)化中的應(yīng)用》由會(huì)員分享,可在線(xiàn)閱讀,更多相關(guān)《【本科畢業(yè)設(shè)計(jì)】基本遺傳算法及其在函數(shù)優(yōu)化中的應(yīng)用(13頁(yè)珍藏版)》請(qǐng)?jiān)谘b配圖網(wǎng)上搜索。
1、 《人工智能及其應(yīng)用大作業(yè)(一)》 題 目: 基本遺傳算法及其在函數(shù)優(yōu)化中的作用 學(xué) 號(hào): 姓 名: 基本遺傳算法及其在函數(shù)優(yōu)化中的應(yīng)用 摘要: 從遺傳算法的編碼、遺傳算子等方面剖析了遺傳算法求解無(wú)約束函數(shù)優(yōu)化問(wèn)題的一般步驟,并以一個(gè)實(shí)例說(shuō)明遺傳算法能有效地解決函數(shù)優(yōu)化問(wèn)題。本文利用基本遺傳算法求解函數(shù)優(yōu)化問(wèn)題,選用 f(x)=xsin(10πx)+2.0,取值范圍在中,利用基本遺傳算法求解兩
2、個(gè)函數(shù)的最優(yōu)值,遺傳算法每次100代,一共執(zhí)行10次,根據(jù)運(yùn)算結(jié)果分析得到最優(yōu)解。 關(guān)鍵字:遺傳算法 選擇 交叉 變異 函數(shù)優(yōu)化 1.前言 1.1基本概念 遺傳算法(Genetic Algorithm)是一類(lèi)借鑒生物界的進(jìn)化規(guī)律(適者生存,優(yōu)勝劣汰遺傳機(jī)制)演化而來(lái)的隨機(jī)化搜索方法。遺傳算法是一種群體型操作,該操作以群體中的所有個(gè)體為對(duì)象。選擇(Selection)、交叉(Crossover)和變異(Mutation)是遺傳算法的3個(gè)主要操作算子,它們構(gòu)成了所謂的遺傳操作(genetic operation),使遺傳算法具有了其它傳統(tǒng)方法所沒(méi)有的特性。 1.2
3、遺傳算法的特點(diǎn) 其主要特點(diǎn)是直接對(duì)結(jié)構(gòu)對(duì)象進(jìn)行操作,不存在求導(dǎo)和函數(shù)連續(xù)性的限定;具有內(nèi)在的隱并行性和更好的全局尋優(yōu)能力;采用概率化的尋優(yōu)方法,能自動(dòng)獲取和指導(dǎo)優(yōu)化的搜索空間,自適應(yīng)地調(diào)整搜索方向,不需要確定的規(guī)則。 1.3遺傳算法的應(yīng)用 函數(shù)優(yōu)化,組合優(yōu)化,機(jī)器人智能控制,及組合圖像處理和模式識(shí)別等。 2. 基本遺傳算法 2.1簡(jiǎn)單遺傳算法的求解步驟 Step1:參數(shù)設(shè)置及種群初始化; Step2:適應(yīng)度評(píng)價(jià); Step3:選擇操作; Step4:交叉操作; Step5:變異操作; Step6:終止條件判斷,若未達(dá)到終止條件,則轉(zhuǎn)到Step3;
4、 Step7:輸出結(jié)果。 2.2停機(jī)準(zhǔn)則 (1) 完成了預(yù)先給定的進(jìn)化代數(shù)則停止; (2) 群體中的最優(yōu)個(gè)體在連續(xù)若干代沒(méi)有改進(jìn)或平均適應(yīng)度在連續(xù)若干代基本沒(méi)有改進(jìn)時(shí)停止。 2.3基本遺傳算法框圖 開(kāi)始 Gen=0 編碼 隨機(jī)產(chǎn)生M個(gè)初始個(gè)體 滿(mǎn)足終止條件? 計(jì)算群體中各個(gè)體適應(yīng)度 從左至右依次執(zhí)行遺傳算子 j = 0 j = 0 j = 0 根據(jù)適應(yīng)度選擇復(fù)制個(gè)體 選擇兩個(gè)交叉?zhèn)€體 選擇個(gè)體變異點(diǎn) 執(zhí)行變異 執(zhí)行交叉 執(zhí)行復(fù)制 將復(fù)制的個(gè)體添入新群體中 將交叉后的兩個(gè)新個(gè)體添入新群體中 將變異后的個(gè)體添入新群體中 j = j+1 j = j+
5、2 j = j+1 j = M? j = pcM? j = pmLM? Gen=Gen+1 輸出結(jié)果 終止 Y N Y Y Y N N N pc pm 3.實(shí)驗(yàn)與結(jié)果 本小節(jié)采用以下函數(shù): f(x)=xsin(10πx)+2.0,x[-1,2] 3.1編碼 表現(xiàn)型:x 基因型:二進(jìn)制編碼(串長(zhǎng)取決于求解精度) 按編碼原理:假設(shè)要求求解精度到6位小數(shù),區(qū)間長(zhǎng)度為2-(-1)=3,即需將區(qū)間分為3/0.
6、000001=3106等份。 所以編碼的二進(jìn)制串長(zhǎng)應(yīng)為22位。 3.2產(chǎn)生初始種群 產(chǎn)生的方式:隨機(jī) 產(chǎn)生的結(jié)果:長(zhǎng)度為22的二進(jìn)制串 產(chǎn)生的數(shù)量:種群的大?。ㄒ?guī)模),如30,50,… 1111010011100001011000 1100110011101010101110 1010100011110010000100 1011110010011100111001 0001100101001100000011
7、 0000011010010000000000 ... 3.3計(jì)算適應(yīng)度 直接用目標(biāo)函數(shù)作為適應(yīng)度函數(shù) ①解碼:將個(gè)體s轉(zhuǎn)化為[-1,2]區(qū)間的實(shí)數(shù): s=<1000101110110101000111> → x=0.637197 ②計(jì)算x的函數(shù)值(適應(yīng)度): f(x)=xsin(10πx)+2.0=2.586345 3.4遺傳操作 選擇:比例選擇法; 交叉:?jiǎn)吸c(diǎn)交叉; 變異:小概率變異 3.5模擬結(jié)果 設(shè)置的參數(shù): 種群大小80;
8、交叉概率0.75;變異概率0.05;最大代數(shù)100。 運(yùn)行結(jié)果如下表: 1 2 3 4 5 6 7 8 9 10 best_fit 16.8503 16.8503 16.8454 16.8503 16.8461 16.8491 16.7952 16.8500 16.8120 16.8500 best_f 3.8503 3.8503 3.8454 3.8503 3.8461 3.8491 3.7952 3.8500 3.8120 3.8501 best_x 1.8006 1.8009 1
9、.8038 1.8012 1.7979 1.7992 1.7903 1.8015 1.8000 1.810 由上表可以分析得出的最優(yōu)解為x=1.8,最大值為3.85。 4.結(jié)論 遺傳算法在適應(yīng)度函數(shù)選擇不當(dāng)?shù)那闆r下有可能收斂于局部最優(yōu),而不能達(dá)到全局最優(yōu)。 選擇的過(guò)程很重要,決定著最終結(jié)果和收斂速度等。 對(duì)于任何一個(gè)具體的優(yōu)化問(wèn)題,調(diào)節(jié)遺傳算法的參數(shù)可能會(huì)有利于更好的更快的收斂,這些參數(shù)包括個(gè)體數(shù)目、交叉律和變異律。 遺傳算法并不一定總是最好的優(yōu)化策略,優(yōu)化問(wèn)題要具體情況具體分析。 參考文獻(xiàn): (1)蔡自興,徐光祐《人工智能及其應(yīng)用》
10、(2)馬永,賈俊芳.遺傳算法研究綜述.第23卷.第三期.2007年12月; 附錄: 1.代碼 主函數(shù): clear clc my_scale=50; %種群規(guī)模 gen_len=22; %基因長(zhǎng)度 M=100; %迭代次數(shù) pc=0.75; %交叉概率 pm=0.05; %變異概率 new_scale=produscale(my_scale,gen_len); %產(chǎn)生初始種群 fitfit=[];
11、 fittimer=[]; best_f1=[]; best_x1=[]; for i=1:M my_f=cal_my_f(new_scale); %計(jì)算函數(shù)值 my_fit=cal_my_fit(my_f); %計(jì)算適應(yīng)度值 next_scale=my_sellect(new_scale,my_fit); %采用賭輪盤(pán)法選擇 cross_scale=my_cross(next_scale,pc); %按概率交叉 mut_scale=m
12、y_mutat(cross_scale,pm); %按概率變異
%尋找每一代中的最優(yōu)適應(yīng)度值所對(duì)應(yīng)的個(gè)體
best_fit=my_fit(1);
[sx,sy]=size(new_scale);
for j=2:length(my_fit)
if best_fit 13、 best_x=my2to10(new_scale(j,:));
best_x=-2+best_x.*4./(2^sy-1);
end
end
new_scale=mut_scale;
fitfit=[fitfit,best_fit];
best_f1=[best_f1,best_f];
best_x1=[best_x1,best_x];
fittimer=[fittimer,i];
end
[best_fit,loca]=max(fitf 14、it);
best_f=best_f1(loca);
best_x=best_x1(loca);
disp([best_fit,best_f,best_x]=)
disp([best_fit,best_f,best_x])
subplot(2,2,1)
plot(fittimer,fitfit)
xlabel(迭代次數(shù)(1)-wxb);
ylabel(適應(yīng)度函數(shù))
grid on
%子函數(shù):產(chǎn)生初始種群
function initscale=produscale(my_scale,gen_ 15、len)
initscale=round(rand(my_scale,gen_len));
end
%子函數(shù):計(jì)算函數(shù)值
function my_f=cal_my_f(new_scale)
mychange=my2to10(new_scale);
[sx,sy]=size(new_scale);
change_x=-1+mychange.*3./(2^sy-1);
my_f=change_x*sin(10π*change_x)+2;
end
%子函數(shù):計(jì)算適應(yīng)度值
functi 16、on my_fit=cal_my_fit(my_f)
f_min=5;
for i=1:length(my_f)
if my_f(i)+f_min<=0
my_fit(i)=0;
else
my_fit(i)=my_f(i)+f_min;
end
end
my_fit=my_fit;
end
%子函數(shù):采用賭輪盤(pán)法選擇
function next_scale 17、=my_sellect(new_scale,my_fit)
sum_of_f=sum(my_fit);
accum=my_fit/sum_of_f;
accum=cumsum(accum);
[sx,sy]=size(new_scale);
j=1;
while j<=sx
a=rand;
for i=1:sx-1
if accum(1)>=a
next_scale(j,:)=ne 18、w_scale(1,:);
else if accum(i)=a
next_scale(j,:)=new_scale(i+1,:);
j=j+1;
end
end
end
end
end
%子函數(shù):按概率交叉
function cross_scale=my_cross(new_scale,pc)
[sx,sy]=size( 19、new_scale);
cross_scale=new_scale;
for i=1:2:sx-1
if rand 20、unction mut_scale=my_mutat(new_scale,pm)
[sx,sy]=size(new_scale);
mut_scale=new_scale;
for i=1:sx
if rand 21、 else
mut_scale(i,a)=0;
end
end
end
%子函數(shù):2進(jìn)制轉(zhuǎn)10進(jìn)制
function mychange=my2to10(new_scale)
[sx,sy]=size(new_scale);
new_scale1=new_scale;
for i=1:sy
new_scale1(:,i)=2.^(sy-i).*new_scale(:,i);
end
mychange=sum 22、(new_scale1,2);
end
2.實(shí)驗(yàn)結(jié)果截圖
g an employment tribunal claim
Employment tribunals sort out disagreements between employers and employees.
You may need to make a claim to an employment tribunal if:
you dont agree with the disciplinary action your employer has taken against 23、 you
your employer dismisses you and you think that you have been dismissed unfairly.
For more information about dismissal and unfair dismissal, seeDismissal.
You can make a claim to an employment tribunal, even if you haventappealedagainst the disciplinary action your employer has taken against 24、 you. However, if you win your case, the tribunal may reduce any compensation awarded to you as a result of your failure to appeal.
Remember that in most cases you must make an application to an employment tribunal within three months of the date when the event you are complaining about happened. I 25、f your application is received after this time limit, the tribunal will not usually accept it.
If you are worried about how the time limits apply to you, take advice from one of the organisations listed underFurther help.
Employment tribunals are less formal than some other courts, but it is still 26、 a legal process and you will need to give evidence under an oath or affirmation.
Most people find making a claim to an employment tribunal challenging. If you are thinking about making a claim to an employment tribunal, you should get help straight away from one of the organisations listed underFu 27、rther help.
If you are being represented by a solicitor at the tribunal, they may ask you to sign an agreement where you pay their fee out of your compensation if you win the case. This is known as adamages-based agreement. In England and Wales, your solicitor cant charge you more than 35% of your 28、compensation if you win the case.
If you are thinking about signing up for a damages-based agreement, you should make sure youre clear about the terms of the agreement. It might be best to get advice from an experienced adviser, for example, at a Citizens Advice Bureau. To find your nearest CAB, in 29、cluding those that give advice by e-mail, click onnearest CAB.
For more information about making a claim to an employment tribunal, seeEmployment tribunals.
The (lack of) air up there
Watch mCayman Islands-based Webb, the head of Fifas anti-racism taskforce, is in London for the Football A 30、ssociations 150th anniversary celebrations and will attend Citys Premier League match at Chelsea on Sunday.
"I am going to be at the match tomorrow and I have asked to meet Yaya Toure," he told BBC Sport.
"For me its about how he felt and I would like to speak to him first to find out what his exp 31、erience was."
Uefa hasopened disciplinary proceedings against CSKAfor the "racist behaviour of their fans" duringCitys 2-1 win.
Michel Platini, president of European footballs governing body, has also ordered an immediate investigation into the referees actions.
CSKA said they were "surprised and 32、 disappointed" by Toures complaint. In a statement the Russian side added: "We found no racist insults from fans of CSKA."
Age has reached the end of the beginning of a word. May be guilty in his seems to passing a lot of different life became the appearance of the same day; May be back in the past 33、, to oneself the paranoid weird belief disillusionment, these days, my mind has been very messy, in my mind constantly. Always feel oneself should go to do something, or write something. Twenty years of life trajectory deeply shallow, suddenly feel something, do it.
一字開(kāi)頭的年齡已經(jīng)到了尾聲?;蛟S是愧疚于自己似乎把轉(zhuǎn)瞬即逝的 34、很多個(gè)不同的日子過(guò)成了同一天的樣子;或許是追溯過(guò)去,對(duì)自己那些近乎偏執(zhí)的怪異信念的醒悟,這些天以來(lái),思緒一直很凌亂,在腦海中不斷糾纏。總覺(jué)得自己自己似乎應(yīng)該去做點(diǎn)什么,或者寫(xiě)點(diǎn)什么。二十年的人生軌跡深深淺淺,突然就感覺(jué)到有些事情,非做不可了。
The end of our life, and can meet many things really do?
而窮盡我們的一生,又能遇到多少事情是真正地非做不可?
During my childhood, think lucky money and new clothes are necessary for New Year, but as 35、 the advance of the age, will be more and more found that those things are optional; Junior high school, thought to have a crush on just means that the real growth, but over the past three years later, his writing of alumni in peace, suddenly found that isnt really grow up, it seems is not so import 36、ant; Then in high school, think dont want to give vent to out your inner voice can be in the high school children of the feelings in a period, but was eventually infarction when graduation party in the throat, later again stood on the pitch he has sweat profusely, looked at his thrown a basketball h 37、oops, suddenly found himself has already cant remember his appearance.
童年時(shí),覺(jué)得壓歲錢(qián)和新衣服是過(guò)年必備,但是隨著年齡的推進(jìn),會(huì)越來(lái)越發(fā)現(xiàn),那些東西根本就可有可無(wú);初中時(shí),以為要有一場(chǎng)暗戀才意味著真正的成長(zhǎng),但三年過(guò)去后,自己心平氣和的寫(xiě)同學(xué)錄的時(shí)候,突然就發(fā)現(xiàn)是不是真正的成長(zhǎng)了,好像并沒(méi)有那么重要了;然后到了高中,覺(jué)得非要吐露出自己的心聲才能為高中生涯里的懵懂情愫劃上一個(gè)句點(diǎn),但畢業(yè)晚會(huì)的時(shí)候最終還是被梗塞在了咽喉,后來(lái)再次站在他曾經(jīng)揮汗如雨的球場(chǎng),看著他投過(guò)籃球的球框時(shí),突然間發(fā)現(xiàn)自己已經(jīng)想不起他的容顏。
O 38、riginally, this world, can produce a chemical reaction to an event, in addition to resolutely, have to do, and time.
原來(lái),這個(gè)世界上,對(duì)某個(gè)事件能產(chǎn)生化學(xué)反應(yīng)的,除了非做不可的堅(jiān)決,還有,時(shí)間。
A persons time, your ideas are always special to clear. Want, want, line is clear, as if nothing could shake his. Also once seemed to be de 39、termined to do something, but more often is he backed out at last. Dislike his cowardice, finally found that there are a lot of love, there are a lot of miss, like shadow really have been doomed. Those who do, just green years oneself give oneself an arm injection, or is a self-righteous spiritual.
40、
一個(gè)人的時(shí)候,自己的想法總是特別地清晰。想要的,不想要的,界限明確,好像沒(méi)有什么可以撼動(dòng)自己。也曾經(jīng)好像已經(jīng)下定了決心去做某件事,但更多的時(shí)候是最后又打起了退堂鼓。嫌惡過(guò)自己的怯懦,最終卻發(fā)現(xiàn)有很多緣分,有很多錯(cuò)過(guò),好像冥冥之中真的已經(jīng)注定。那些曾經(jīng)所謂的非做不可,只是青蔥年華里自己給自己注射的一支強(qiáng)心劑,或者說(shuō),是自以為是的精神寄托罷了。
At the moment, the sky is dark, the air is fresh factor after just rained. Suddenly thought of blue plaid shirt; Those were 41、broken into various shapes of stationery; From the corner at the beginning of deep friendship; Have declared the end of the encounter that havent start planning... Those years, those days of do, finally, like youth, will end in our life.
此刻,天空是陰暗的,空氣里有著剛下過(guò)雨之后的清新因子。突然想到那件藍(lán)格子襯衫;那些被折成各種各樣形狀的信紙;那段從街角 42、深巷伊始的友誼;還有那場(chǎng)還沒(méi)有開(kāi)始就宣告了終結(jié)的邂逅計(jì)劃……那些年那些天的非做不可,終于和青春一樣,都將在我們的人生中謝幕。
Baumgartner the disappointing news: Mission aborted. r plays an important role in this mission. Starting at the ground, conditions have to be very calm -- winds less than 2 mph, with no precipitation or humidity and limited cloud cove 43、r. The balloon, with capsule attached, will move through the lower level of the atmosphere (the troposphere) where our day-to-day weather lives. It will climb higher than the tip of Mount Everest (5.5 miles/8.85 kilometers), drifting even higher than the cruising altitude of commercial airliners (5. 44、6 miles/9.17 kilometers) and into the stratosphere. As he crosses the boundary layer (called the tropopause),e can expect a lot of turbulence.
The supersonic descent could happen as early as Sunda.
The weatheThe balloon will slowly drift to the edge of space at 120,000 feet (
Then, I 45、 would assume, he will slowly step out onto something resembling an Olympic diving platform.
Below, the Earth becomes the concrete bottom of a swimming pool that he wants to land on, but not too hard. Still, hell be traveling fast, so despite the distance, it will not be like diving into the deep e 46、nd of a pool. It will be like he is diving into the shallow end.
Skydiver preps for the big jump
When he jumps, he is expected to reach the speed of sound -- 690 mph (1,110 kph) -- in less than 40 seconds. Like hitting the top of the water, he will begin to slow as he approaches the more dense a 47、ir closer to Earth. But this will not be enough to stop him completely.
If he goes too fast or spins out of control, he has a stabilization parachute that can be deployed to slow him down. His team hopes its not needed. Instead, he plans to deploy his 270-square-foot (25-square-meter) main chute at 48、 an altitude of around 5,000 feet (1,524 meters).
In order to deploy this chute successfully, he will have to slow to 172 mph (277 kph). He will have a reserve parachute that will open automatically if he loses consciousness at mach speeds.
Even if everything goes as planned, it wont. Baumgartner still will free fall at a speed that would cause you and me to pass out, and no parachute is guaranteed to work higher than 25,000 feet (7,620 meters).
cause there
- 溫馨提示:
1: 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
2: 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
3.本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
5. 裝配圖網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 設(shè)備采購(gòu)常用的四種評(píng)標(biāo)方法
- 車(chē)間員工管理須知(應(yīng)知應(yīng)會(huì))
- 某公司設(shè)備維護(hù)保養(yǎng)工作規(guī)程
- 某企業(yè)潔凈車(chē)間人員進(jìn)出管理規(guī)程
- 企業(yè)管理制度之5S管理的八個(gè)口訣
- 標(biāo)準(zhǔn)化班前會(huì)的探索及意義
- 某企業(yè)內(nèi)審員考試試題含答案
- 某公司環(huán)境保護(hù)考核管理制度
- 現(xiàn)場(chǎng)管理的定義
- 員工培訓(xùn)程序
- 管理制度之生產(chǎn)廠長(zhǎng)的職責(zé)與工作標(biāo)準(zhǔn)
- 某公司各級(jí)專(zhuān)業(yè)人員環(huán)保職責(zé)
- 企業(yè)管理制度:5S推進(jìn)與改善工具
- XXX公司環(huán)境風(fēng)險(xiǎn)排查及隱患整改制度
- 生產(chǎn)車(chē)間基層管理要點(diǎn)及建議