数学模型–现代优化算法
关于现代的启发式算法,现在只有主要用到的是主流的遗传算法和模拟退火算法,关于其余的蚁群算法等没有涉及。这里只简单了解一下怎么在Matlab中使用:
不使用Matlab工具箱实现可以参考:
- 模拟退火法、神经网络、遗传算法:
http://blog.csdn.net/qq_34861102/article/details/77806124 - 基于模拟退火的遗传算法:
http://blog.csdn.net/qq_34861102/article/details/77899555 - 数学建模–粒子群算法模版:
http://blog.csdn.net/qq_34861102/article/details/77900277 - 数学建模–人工鱼群算法的模版:
http://blog.csdn.net/qq_34861102/article/details/77901867
原文:http://blog.csdn.net/qq_34861102/article/details/77103062
具体的启发式算法可以用C++来实现
遗传算法
模拟退火算法
实例:
代码:
fun1 = @(x)(x(1)-2)^2 + (x(2)-1)^2;
[x val] = ga(fun1,2,[],[],[],[],[],[],@fun2)
%新建函数
function[c,ceq] = fun2(x);
c = -x(1)^2/4 + x(2)^2 - 1;
ceq = [];
代码:
fun3 = @(x) - (x(1)^2+x(2)^2+3*x(3)^2+4*x(4)^2+2*x(5)^2-8*x(1)-2*x(2)-3*x(3)-x(4)-2*x(5));
a = [1 1 1 1 1;1 2 2 1 6;2 1 6 0 0;0 0 1 1 5];
b = [400 800 200 200]'; lb = zeros(5,1); ub = 99*ones(5,1); Intcon = [1:5]; [x,y] = ga(fun3,5,a,b,[],[],lb,ub,[],Intcon)