| 5 | 1/1 | 返回列表 |
| 查看: 2495 | 回復: 7 | |||
| 當前只顯示滿足指定條件的回帖,點擊這里查看本話題的所有回帖 | |||
[求助]
關于全局最優(yōu)法和遺傳算法 已有2人參與
|
|||
|
大家好,最近嘗試了一下遺傳算法,初始種群是系統隨機抽取的,以致于每次算出來的結果都不太一樣。本來想說通過遺傳算法得到接近全局最優(yōu)的解,結果這些解好像都是局部最優(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ā)表 | |
|---|---|---|---|---|
|
[考研] 297求調劑 +13 | 田洪有 2026-03-26 | 13/650 |
|
|---|---|---|---|---|
|
[考研] 334分 一志愿武理 材料求調劑 +12 | 李李不服輸 2026-03-26 | 12/600 |
|
|
[考研] 085404求調劑,總分309,本科經歷較為豐富 +6 | 來財aa 2026-03-25 | 6/300 |
|
|
[考研] 材料與化工304求B區(qū)調劑 +4 | 邱gl 2026-03-26 | 7/350 |
|
|
[考研] 290求調劑 +3 | dfffsar 2026-03-29 | 3/150 |
|
|
[考研] 調劑310 +12 | 溫柔的晚安 2026-03-25 | 13/650 |
|
|
[考研] 一志愿鄭州大學,080500學碩,總分317分求調劑 +8 | 舉個栗子oi 2026-03-24 | 9/450 |
|
|
[考研] 求收留 +5 | 1943443204 2026-03-28 | 5/250 |
|
|
[考研] 0856求調劑 +13 | zhn03 2026-03-25 | 14/700 |
|
|
[考研] 311(085601)求調劑 +4 | liziyeyeye 2026-03-28 | 4/200 |
|
|
[考研] 347求調劑 +3 | 山頂見α 2026-03-25 | 3/150 |
|
|
[考研] 070300求調劑306分 +4 | 26要上岸 2026-03-27 | 4/200 |
|
|
[考研] 一志愿南昌大學324求調劑 +7 | hanamiko 2026-03-27 | 7/350 |
|
|
[考研] 291求調劑 +6 | HanBeiNingZC 2026-03-24 | 6/300 |
|
|
[考研] 340求調劑 +5 | jhx777 2026-03-27 | 5/250 |
|
|
[考博] 26申博 +3 | 加油沖! 2026-03-26 | 3/150 |
|
|
[考研] 調劑推薦 +5 | 清酒714 2026-03-26 | 6/300 |
|
|
[考研] 求調劑 +6 | 林之夕 2026-03-24 | 6/300 |
|
|
[考研] 一志愿山東大學藥學學碩求調劑 +3 | 開開心心沒煩惱 2026-03-23 | 4/200 |
|
|
[考研] 材料/農業(yè)專業(yè),07/08開頭均可,過線就行 +3 | 呵唔哦豁 2026-03-23 | 4/200 |
|