遗传算法与直接搜索

遗传算法

[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)
%意义同上
posted @ 2024-10-11 19:36  West11  阅读(33)  评论(0)    收藏  举报