遗传算法与直接搜索
遗传算法
[x, fval] = ga(@fitnessfun, nvars, A, b, Aeq, beq, LB, UB, @nonlcon, options)
%x和fval为变量的值和目标函数的值
%ga函数内部的参数与非线性规划函数的意义一样,nvars为变量数。
直接搜索
[x, fval] = patternsearch(@fun, nvars, A, b, Aeq, beq, LB, UB, @nonlcon, options)
%意义同上
-
遗传算法和直接搜索等优化问题的现代算法在Global Optimization Toolbox中
https://www.mathworks.com/help/releases/R2023b/gads/ga.html
https://ww2.mathworks.cn/help/gads/patternsearch.html