| 查看: 2414 | 回复: 7 | ||||
[求助]
关于全局最优法和遗传算法 已有2人参与
|
|
大家好,最近尝试了一下遗传算法,初始种群是系统随机抽取的,以致于每次算出来的结果都不太一样。本来想说通过遗传算法得到接近全局最优的解,结果这些解好像都是局部最优。于是尝试了一个全局最优的算法,先做了个小实验,但不成功。希望大侠们帮忙看看问题出在哪里了,不胜感激! 对于遗传算法很熟悉的朋友,也向大家请教一下在使用遗传算法时当注意什么问题,怎么使得到的解能比较接近全局最优。谢谢! 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. 这是为什么呢? |
» 收录本帖的淘帖专辑推荐
计算机应用 |
» 猜你喜欢
【复旦大学】二维材料方向招收2026年博士研究生1名
已经有0人回复
北京纳米能源与系统研究所 王中林院士/曹南颖研究员课题组2026级硕/博/博后招生
已经有10人回复
物理学I论文润色/翻译怎么收费?
已经有190人回复
荷兰Utrecht University超快太赫兹光谱王海教授课题招收2026 CSC博士生
已经有23人回复
反铁磁体中的磁性切换:两种不同的机制已成功可视化
已经有0人回复
求标准粉末衍射卡号 ICDD 01-076-1802
已经有0人回复
新西兰Robinson研究所招收全奖PhD
已经有0人回复
石墨烯转移--二氧化硅衬底石墨烯
已经有0人回复
» 本主题相关价值贴推荐,对您同样有帮助:
请问,分子动力学模拟和分子力学模拟的区别是什么呢?
已经有7人回复
请教下优化类的算法 处理带约束问题
已经有7人回复
拟牛顿法求解复杂(带根号的)非线性方程组
已经有17人回复
matlab 拟合反应动力学参数结果很差。大家帮忙看一下
已经有14人回复
如何MATLAB程序实现遗传算法
已经有11人回复
遗传算法,,,什么意思?
已经有15人回复
探讨一下关于接力式优化和全局最优化的异同
已经有3人回复
关于反应动力学产物浓度的测定
已经有16人回复
【国基金(含重点)】【项目进展报告】国家自然科学基金标书大全
已经有170人回复
SCI论文从入门到精通(第一版)
已经有93人回复
2楼2014-01-20 21:46:47
3楼2014-01-20 21:50:37
4楼2014-01-20 21:54:56
戴钢盔的猪头
木虫 (知名作家)
- 应助: 200 (高中生)
- 金币: 5083.9
- 散金: 1310
- 红花: 18
- 帖子: 6001
- 在线: 319.9小时
- 虫号: 2854040
- 注册: 2013-12-07
- 性别: GG
- 专业: 波谱分析与成像分析
5楼2014-01-21 08:49:39
6楼2014-02-04 03:42:36

7楼2014-04-25 18:57:51

8楼2014-04-25 19:01:03













回复此楼