zoukankan      html  css  js  c++  java
  • pso

    看不懂代码的话,运行一下程序就知道了。

    %PSO
    % options :
    % https://ww2.mathworks.cn/help/gads/particleswarm.html
    % https://ww2.mathworks.cn/help/gads/particle-swarm-options.html
    % https://ww2.mathworks.cn/help/gads/_mw_2d669aeb-37d3-4294-8490-8340f88c256e.html
    %参数选择:

    rng default
    % options=optimoptions('particleswarm','MinNeighborsFraction',0.1,'SelfAdjustmentWeight',1.8, ...
    % 'SocialAdjustmentWeight',1.5,'SwarmSize',40,'PlotFcn',@pswplotbestf, ...
    % 'InertiaRange',[0.6,0.8]);

    options=optimoptions('particleswarm');
    options.HybridFcn=@fminunc;
    options.PlotFcn=@pswplotbestf;
    x0=zeros(10,4); %4个变量
    options.InitialSwarmMatrix=x0;
    fun=@multirosenbrock; %测试函数
    lb=[];%lb=-10*ones(1,4);
    ub=[];%ub=10*ones(1,4);
    [x,fval,exitFlag,output]=particleswarm(fun,4,lb,ub,options);
    formatstring='particleswarm reached the value %f using %d function evalution. ';
    fprintf(formatstring,fval,output.funccount);

  • 相关阅读:
    事务
    触发器
    SQL 存储过程
    SQL 视图 索引
    SQL 函数
    SQL查询语句练习
    SQL约束
    SQL Server 数据的添加修改删除和查询
    The type ProxyGenerator is not accessible due to restriction on required library问题的解决
    ==与equals
  • 原文地址:https://www.cnblogs.com/lancezliang/p/10424042.html
Copyright © 2011-2022 走看看