| 8 | 1/1 | 返回列表 |
| 查看: 2487 | 回復: 7 | |||
free0121木蟲 (著名寫手)
|
[求助]
關于全局最優(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. 這是為什么呢? |
計算機應用 |
木蟲 (著名寫手)
鐵蟲 (初入文壇)
鐵蟲 (初入文壇)
木蟲 (知名作家)
木蟲 (著名寫手)
新蟲 (初入文壇)

新蟲 (初入文壇)

| 8 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 能源材料化學課題組招收碩士研究生8-10名 +4 | 脫穎而出 2026-03-16 | 12/600 |
|
|---|---|---|---|---|
|
[考研] 本人考085602 化學工程 專碩 +17 | 不知道叫什么! 2026-03-15 | 19/950 |
|
|
[教師之家] 焦慮 +9 | 水冰月月野兔 2026-03-13 | 13/650 |
|
|
[考研] 材料專碩英一數(shù)二306 +5 | z1z2z3879 2026-03-18 | 5/250 |
|
|
[考研] 材料專業(yè)求調(diào)劑 +5 | hanamiko 2026-03-18 | 5/250 |
|
|
[考研] 295求調(diào)劑 +3 | 一志愿京區(qū)211 2026-03-18 | 5/250 |
|
|
[考研] 085600材料與化工 +5 | 安全上岸! 2026-03-16 | 5/250 |
|
|
[考研] 材料與化工一志愿南昌大學327求調(diào)劑推薦 +8 | Ncdx123456 2026-03-13 | 9/450 |
|
|
[考研] 收復試調(diào)劑生 +4 | 雨后秋荷 2026-03-18 | 4/200 |
|
|
[考研] 299求調(diào)劑 +5 | △小透明* 2026-03-17 | 5/250 |
|
|
[考博] 環(huán)境領域全國重點實驗室招收博士1-2名 +3 | QGZDSYS 2026-03-13 | 5/250 |
|
|
[考研] 278求調(diào)劑 +5 | 煙火先于春 2026-03-17 | 5/250 |
|
|
[考博] 26博士申請 +3 | 1042136743 2026-03-17 | 3/150 |
|
|
[考研] 296求調(diào)劑 +5 | 大口吃飯 身體健 2026-03-13 | 5/250 |
|
|
[考研] 308求調(diào)劑 +4 | 是Lupa啊 2026-03-16 | 4/200 |
|
|
[考研] 有沒有道鐵/土木的想調(diào)劑南林,給自己招師弟中~ +3 | TqlXswl 2026-03-16 | 7/350 |
|
|
[考博] 26申博 +4 | 八6八68 2026-03-16 | 4/200 |
|
|
[考研] 考研調(diào)劑 +3 | 淇ya_~ 2026-03-17 | 5/250 |
|
|
[考研] 304求調(diào)劑 +5 | 素年祭語 2026-03-15 | 5/250 |
|
|
[考研] 0856材料與化工301求調(diào)劑 +5 | 奕束光 2026-03-13 | 5/250 |
|