| 查看: 2462 | 回复: 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年秋博士招生-物理学-活性胶体方向-高永祥课题组
已经有17人回复
论物质与能量的统一模型及物理现象解释
已经有0人回复
物理学I论文润色/翻译怎么收费?
已经有160人回复
基于基元I统一理论的数学相关应用推导
已经有0人回复
基元I统一理论:宇宙本质、层级演化与修炼文明的本源规律
已经有1人回复
基元I理论下三大核心空间现象精准推导与细节解析
已经有0人回复
基于基元 I 统一理论的反重力理论推导
已经有0人回复
基于基元I统一理论的量子力学本源推导
已经有1人回复
推荐一款可以AI辅助写作的Latex编辑器SmartLatexEditor,超级好用,AI润色,全免费
已经有16人回复
【EI|Scopus 双检索】第六届智能机器人系统国际会议(ISoIRS 2026)
已经有0人回复
2026年第四届电动车与车辆工程国际会议(CEVVE 2026)
已经有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













回复此楼