| 5 | 1/1 | 返回列表 |
| 查看: 2501 | 回復: 7 | |||
| 當前只顯示滿足指定條件的回帖,點擊這里查看本話題的所有回帖 | |||
free0121木蟲 (著名寫手)
|
[求助]
關(guān)于全局最優(yōu)法和遺傳算法 已有2人參與
|
||
|
大家好,最近嘗試了一下遺傳算法,初始種群是系統(tǒng)隨機抽取的,以致于每次算出來的結(jié)果都不太一樣。本來想說通過遺傳算法得到接近全局最優(yōu)的解,結(jié)果這些解好像都是局部最優(yōu)。于是嘗試了一個全局最優(yōu)的算法,先做了個小實驗,但不成功。希望大俠們幫忙看看問題出在哪里了,不勝感激! 對于遺傳算法很熟悉的朋友,也向大家請教一下在使用遺傳算法時當注意什么問題,怎么使得到的解能比較接近全局最優(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 運行后得到 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. 這是為什么呢? |
計算機應用 |
新蟲 (初入文壇)

木蟲 (著名寫手)
鐵蟲 (初入文壇)
鐵蟲 (初入文壇)
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 交通運輸考試264分求工科調(diào)劑 +3 | jike777 2026-04-02 | 3/150 |
|
|---|---|---|---|---|
|
[考研] 319求調(diào)劑 +14 | 太容易1018 2026-04-01 | 14/700 |
|
|
[考研] 農(nóng)學考研求調(diào)劑 +3 | dkdkxm 2026-04-01 | 3/150 |
|
|
[考研] 302求調(diào)劑一志愿華中師范大學 +5 | 小江小江江江 2026-04-02 | 5/250 |
|
|
[考研] 071000生物學調(diào)劑 +6 | 知昭蔓 2026-04-02 | 6/300 |
|
|
[考研] 理學07化學 303求調(diào)劑 +16 | 睿08 2026-03-27 | 17/850 |
|
|
[考研] 一志愿南師大0703化學 275求調(diào)劑 +6 | Ripcord上岸 2026-03-27 | 6/300 |
|
|
[考研] 計算機265跨調(diào)環(huán)境 +5 | Yumeng_6 2026-03-27 | 5/250 |
|
|
[考研] 生物學308分求調(diào)劑(一志愿華東師大) +5 | 相信必會光芒萬?/a> 2026-03-31 | 6/300 |
|
|
[考研] 085410 一志愿211 22408分數(shù)359求調(diào)劑 +3 | 123456789qw 2026-03-31 | 4/200 |
|
|
[考研] 求調(diào)劑推薦 材料 304 +21 | 荷包蛋hyj 2026-03-26 | 21/1050 |
|
|
[考研] 324求調(diào)劑 +10 | hanamiko 2026-03-26 | 12/600 |
|
|
[考研] 309分085801求調(diào)劑 +7 | 學員Gtwj7W 2026-03-31 | 7/350 |
|
|
[有機交流]
10+3
|
kaobao456 2026-03-29 | 4/200 |
|
|
[考研] 085701環(huán)境工程求調(diào)劑 +11 | 多久上課 2026-03-27 | 12/600 |
|
|
[考研] 303求調(diào)劑 +7 | DLkz1314. 2026-03-30 | 7/350 |
|
|
[考研] 085701求調(diào)劑初試286分 +5 | secret0328 2026-03-28 | 5/250 |
|
|
[考研] 085600,專業(yè)課化工原理,321分求調(diào)劑 +5 | 大饞小子 2026-03-28 | 5/250 |
|
|
[考研] 070300化學求調(diào)劑 +4 | 起個名咋這么難 2026-03-27 | 4/200 |
|
|
[考研] 081200-11408-276學碩求調(diào)劑 +4 | 崔wj 2026-03-26 | 4/200 |
|