| 8 | 1/1 | 返回列表 |
| 查看: 2486 | 回復(fù): 7 | |||
free0121木蟲 (著名寫手)
|
[求助]
關(guān)于全局最優(yōu)法和遺傳算法 已有2人參與
|
|
大家好,最近嘗試了一下遺傳算法,初始種群是系統(tǒng)隨機(jī)抽取的,以致于每次算出來的結(jié)果都不太一樣。本來想說通過遺傳算法得到接近全局最優(yōu)的解,結(jié)果這些解好像都是局部最優(yōu)。于是嘗試了一個(gè)全局最優(yōu)的算法,先做了個(gè)小實(shí)驗(yàn),但不成功。希望大俠們幫忙看看問題出在哪里了,不勝感激! 對(duì)于遺傳算法很熟悉的朋友,也向大家請(qǐng)教一下在使用遺傳算法時(shí)當(dāng)注意什么問題,怎么使得到的解能比較接近全局最優(yōu)。謝謝! function main clear all close all clc A=[];b=[]; Aeq=[];beq=[]; lb=[0.2;0.1]; ub=[4.0;1.6]; x0=[2.5;1.0]; opts1 = optimset('Algorithm','interior-point'); opts2 = optimset('Algorithm','sqp'); opts3 = optimset('Algorithm','trust-region-reflective'); opts4 = optimset('Algorithm','active-set'); problem1 = createOptimProblem('fmincon','objective',... @objfun,'x0',x0, 'Aineq', A, 'bineq', b, 'nonlcon', @mycon, 'options',opts1); problem2 = createOptimProblem('fmincon','objective',... @objfun,'x0',x0, 'Aineq', A, 'bineq', b, 'nonlcon', @mycon, 'options',opts2); problem3 = createOptimProblem('fmincon','objective',... @objfun,'x0',x0, 'Aineq', A, 'bineq', b, 'nonlcon', @mycon, 'options',opts3); problem4 = createOptimProblem('fmincon','objective',... @objfun,'x0',x0, 'Aineq', A, 'bineq', b, 'nonlcon', @mycon, 'options',opts4); gs = GlobalSearch; [x1,fval1] = run(gs,problem1); [x2,fval2] = run(gs,problem2); [x3,fval3] = run(gs,problem3); [x4,fval4] = run(gs,problem4); end % objective function function f0=objfun(x) f0=x(1)*sqrt(1.0+x(2)^2); end % constraint function function [f,ceq]=mycon(x) f=(0.124*(8.0/x(1)+1.0/(x(1)*x(2)))*sqrt(1.0+x(2)^2))-1.0; ceq=[]; end 運(yùn)行后得到 GlobalSearch stopped because it analyzed all the trial points. 1 out of 39 local solver runs converged with a positive local solver exit flag. No solution found. GlobalSearch did not find any solutions after 399 local solver runs. Warning: The default trust-region-reflective algorithm does not solve problems with the constraints you have specified. FMINCON will use the active-set algorithm instead. For information on applicable algorithms, see Choosing the Algorithm in the documentation. > In fmincon at 486 In C:\Program Files\MATLAB\R2011b\toolbox\globaloptim\globaloptim\private\globalsearchnlp.p>globalsearchnlp at 152 In GlobalSearch>GlobalSearch.run at 330 GlobalSearch stopped with one or more of the local solver runs stopping prematurely. 15 out of 39 local solver runs exceeded the iteration limit (problem.options.MaxIter) or the function evaluation limit (problem.options.MaxFunEvals). None of the 39 local solver runs converged with a positive local solver exit flag. GlobalSearch stopped with one or more of the local solver runs stopping prematurely. 13 out of 36 local solver runs exceeded the iteration limit (problem.options.MaxIter) or the function evaluation limit (problem.options.MaxFunEvals). None of the 36 local solver runs converged with a positive local solver exit flag. 這是為什么呢? |
計(jì)算機(jī)應(yīng)用 |
木蟲 (著名寫手)
鐵蟲 (初入文壇)
鐵蟲 (初入文壇)
木蟲 (知名作家)
木蟲 (著名寫手)
新蟲 (初入文壇)

新蟲 (初入文壇)

| 8 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考博] 東華理工大學(xué)化材專業(yè)26屆碩士博士申請(qǐng) +8 | zlingli 2026-03-13 | 8/400 |
|
|---|---|---|---|---|
|
[考研]
|
.6lL 2026-03-18 | 6/300 |
|
|
[考研] 材料專碩274一志愿陜西師范大學(xué)求調(diào)劑 +8 | 薛云鵬 2026-03-13 | 8/400 |
|
|
[考研] 一志愿天津大學(xué)化學(xué)工藝專業(yè)(081702)315分求調(diào)劑 +11 | yangfz 2026-03-17 | 11/550 |
|
|
[考研] 0703化學(xué) 305求調(diào)劑 +4 | FY_yy 2026-03-14 | 4/200 |
|
|
[考研] 材料專業(yè)求調(diào)劑 +5 | hanamiko 2026-03-18 | 5/250 |
|
|
[考研] 26調(diào)劑/材料/英一數(shù)二/總分289/已過A區(qū)線 +7 | 步川酷紫123 2026-03-13 | 7/350 |
|
|
[考研] 070300化學(xué)319求調(diào)劑 +6 | 錦鯉0909 2026-03-17 | 6/300 |
|
|
[考研] 312求調(diào)劑 +8 | 陌宸希 2026-03-16 | 9/450 |
|
|
[考研] 268求調(diào)劑 +6 | 簡(jiǎn)單點(diǎn)0 2026-03-17 | 6/300 |
|
|
[考研] 278求調(diào)劑 +5 | 煙火先于春 2026-03-17 | 5/250 |
|
|
[基金申請(qǐng)] 被我言中:新模板不強(qiáng)調(diào)格式了,假專家開始管格式了 +4 | beefly 2026-03-14 | 4/200 |
|
|
[考研] 藥學(xué)383 求調(diào)劑 +3 | 藥學(xué)chy 2026-03-15 | 4/200 |
|
|
[考研] 一志愿211 0703方向310分求調(diào)劑 +3 | 努力奮斗112 2026-03-15 | 3/150 |
|
|
[考研] 0703一志愿211 285分求調(diào)劑 +5 | ly3471z 2026-03-13 | 5/250 |
|
|
[考研] 070300化學(xué)學(xué)碩求調(diào)劑 +6 | 太想進(jìn)步了0608 2026-03-16 | 6/300 |
|
|
[考研] 中科院材料273求調(diào)劑 +4 | yzydy 2026-03-15 | 4/200 |
|
|
[考研] 求老師收留調(diào)劑 +4 | jiang姜66 2026-03-14 | 5/250 |
|
|
[考研] 求材料調(diào)劑 085600英一數(shù)二總分302 前三科235 精通機(jī)器學(xué)習(xí) 一志愿哈工大 +4 | 林yaxin 2026-03-12 | 4/200 |
|
|
[考研] 311求調(diào)劑 +3 | 冬十三 2026-03-13 | 3/150 |
|