基于自适应适应度-距离平衡的随机分形搜索算法(Matlab代码实现)

简介: 基于自适应适应度-距离平衡的随机分形搜索算法(Matlab代码实现)

💥1 概述

参考文献:

提出了基于自适应适应度-距离平衡选择的随机分形搜索(FDB-SFS)算法。对实验研究中提出的方法的结果进行了统计评估,并与文献中竞争优化算法的结果进行了比较。对比表明,所提出的FDB-SFS算法在寻找最优解方面优于其他算法,并且收敛速度更快达到最优解。根据实验研究结果,所提出的FDB-SFS算法在OPF问题中的优化成本比AO、GBO、GPC、HGS、HHO、RUN、TSO、LSHADE、LSHADE-EPSIN、LSHADE-CNEPSIN、LSHADE-SPACMA和MadDE优化算法好5.7362%、0.0954%、7.6244、0.1785%、2.4329%、1.7408%、1.95317%、3.5486%、2.2007%和1.5203%。  


📚2 运行结果

部分代码:

function []=case_1()
[nPop, dimension, maxIteration, lbArray, ubArray] = problem_terminate();
S.Start_Point = nPop;            
S.Maximum_Diffusion = 0;
S.Walk = 1; % *Important
S.Ndim = dimension;
S.Lband = lbArray;
S.Uband = ubArray;
S.Maximum_Generation  = maxIteration;
    P = zeros(S.Start_Point,S.Ndim);
%Creating random points in considered search space=========================
    point = repmat(S.Lband,S.Start_Point,1) + rand(S.Start_Point, S.Ndim).* ...
        (repmat(S.Uband - S.Lband,S.Start_Point,1));
%==========================================================================
%Calculating the fitness of first created points=========================== 
    FirstFit = zeros(1,S.Start_Point);
    for i = 1 : size(point,1)
        FirstFit(i) = problem(point(i,:)); 
    end
    [Sorted_FitVector, Indecis] = sort(FirstFit);
    point = point(Indecis,:);%sorting the points based on obtaind result
%==========================================================================
%Finding the Best point in the group=======================================
    BestPoint = point(1, :);
    fbest = Sorted_FitVector(1);%saving the first best fitness
%==========================================================================
nfeval = 1;
%Starting Optimizer========================================================
while ( ( nfeval < S.Maximum_Generation) )
    New_Point = point;
    FitVector = Sorted_FitVector;
    %diffusion process occurs for all points in the group
    if S.Maximum_Diffusion>0
        for i = 1 : S.Start_Point
            %creating new points based on diffusion process
            [NP, fit] = Diffusion_Process(point(i,:),Sorted_FitVector(i),S,nfeval,BestPoint,fhd, fNumber);
            New_Point(i,:) = NP; FitVector(i) = fit;
            nfeval = nfeval + 1;
           if nfeval >= S.Maximum_Generation
               S.Start_Point = 0;
               break;
           end
        end  
    end
    fit = FitVector';
    [~, sortIndex] = sort(fit);
    Pa = zeros(1,S.Start_Point);
    %Starting The First Updating Process====================================
    for i=1:1:S.Start_Point     
        Pa(sortIndex(i)) = (S.Start_Point - i + 1) / S.Start_Point; 
    end
    RandVec1 = randperm(S.Start_Point);
    RandVec2 = randperm(S.Start_Point);
    FDBIndex = fitnessDistanceBalance( point, fit);
    for i = 1 : S.Start_Point
        for j = 1 : size(New_Point,2)
            if rand > Pa(i)
                if Sigmoid_Func_1_Increase(S.Maximum_Generation, nfeval)
                    P(i,j) = New_Point(FDBIndex,j) - rand*(New_Point(RandVec2(i),j) - New_Point(i,j)); 
                else
                    P(i,j) = New_Point(RandVec1(i),j) - rand*(New_Point(RandVec2(i),j) - New_Point(i,j)); 
                end
            else
                P(i,j)= New_Point(i,j);
            end
        end
    end
    P = Bound_Checking(P,S.Lband,S.Uband);%for checking bounds
    for i = 1 : S.Start_Point
        Fit_FirstProcess = problem(P(i,:)); 
        if Fit_FirstProcess<=fit(i)
            New_Point(i,:)=P(i,:);
            fit(i)=Fit_FirstProcess;
        end
        nfeval = nfeval + 1;
       if nfeval >= S.Maximum_Generation
           S.Start_Point = 0;
           break;
       end
    end
    FitVector = fit;
    %======================================================================    
    [Sorted_FitVector,SortedIndex] = sort(FitVector);
    New_Point = New_Point(SortedIndex,:);
    BestPoint = New_Point(1,:);%first point is the best  
    pbest = New_Point(1,:);
    fbest = FitVector(1);
    point = New_Point;
    %Starting The Second Updating Process==================================
    Pa = sort(SortedIndex/S.Start_Point, 'descend');
    for i = 1 : S.Start_Point
       if rand > Pa(i)
           %selecting two different points in the group
           R1 = ceil(rand*size(point,1));
           R2 = ceil(rand*size(point,1));
            while R1 == R2
                R2 = ceil(rand*size(point,1));
            end
            if rand < .5
                ReplacePoint = point(i,:) - rand * (point(R2,:) - BestPoint); 
            else
                ReplacePoint = point(i,:) + rand * (point(R2,:) - point(R1,:)); 
            end
            ReplacePoint = Bound_Checking(ReplacePoint,S.Lband,S.Uband);
            replaceFit =  problem(ReplacePoint); 
            if replaceFit < Sorted_FitVector(i)
                point(i,:) = ReplacePoint;
                Sorted_FitVector(i) = replaceFit;
            end
            if replaceFit < fbest
                pbest = ReplacePoint;
                fbest = replaceFit;
                BestPoint = pbest;
            end
            nfeval = nfeval + 1;
            if nfeval >= S.Maximum_Generation
               break;
            end
       end
    end
end
bestFitness=fbest;
bestSolution=pbest;
    fprintf('Best Fitness: %d\n', bestFitness);
    disp('Best Solution:'); 
    disp(bestSolution);
end
function p = Bound_Checking(p,lowB,upB)
    for i = 1 : size(p,1)
        upper = double(gt(p(i,:),upB));
        lower = double(lt(p(i,:),lowB));
        up = find(upper == 1);
        lo = find(lower == 1);
        if (size(up,2)+ size(lo,2) > 0 )
            for j = 1 : size(up,2)
                p(i, up(j)) = (upB(up(j)) - lowB(up(j)))*rand()...
                    + lowB(up(j));
            end
            for j = 1 : size(lo,2)
                p(i, lo(j)) = (upB(lo(j)) - lowB(lo(j)))*rand()...
                    + lowB(lo(j));
            end
        end
    end
end
function [createPoint, fitness] = Diffusion_Process(Point,Fitness,S,g,BestPoint, fhd, fNumber)
    %calculating the maximum diffusion for each point
    NumDiffiusion = S.Maximum_Diffusion;
    New_Point = zeros(S.Maximum_Diffusion+1,S.Ndim);
    fitness = zeros(1,S.Maximum_Diffusion+1);
    New_Point(1,:) = Point;
    fitness(1) = Fitness;
    %Diffiusing Part*******************************************************
    for i = 1 : NumDiffiusion
        %consider which walks should be selected.
        if rand < S.Walk 
            GeneratePoint = normrnd(BestPoint, (log(g)/g)*(abs((Point - BestPoint))), [1 size(Point,2)]) + (randn*BestPoint - randn*Point); % E艧itlik (11)
        else
            GeneratePoint = normrnd(Point, (log(g)/g)*(abs((Point - BestPoint))),[1 size(Point,2)]); % E艧itlik (12) 
        end
        New_Point(i+1,:) = GeneratePoint;
    end
    %check bounds of New Point
    New_Point = Bound_Checking(New_Point,S.Lband,S.Uband);
    %sorting fitness
    for i = 2 : size(New_Point,1)
        fitness(i) = problem(New_Point(i,:)); 
    end
    [fit_value,fit_index] = sort(fitness);
    fitness = fit_value(1,1);
    New_Point = New_Point(fit_index,:);
    createPoint = New_Point(1,:);
    %======================================================================
end


🌈3 Matlab代码实现

🎉4 参考文献

部分理论来源于网络,如有侵权请联系删除。


[1]Duman, S., Kahraman, H. T., Kati, M., "Economical operation of modern power grids incorporating uncertainties of renewable energy sources and load demand using the adaptive fitness-distance balance-based stochastic fractal search algorithm", Engineering Applications of Artificial Intelligence, Volume 117, Part A, 2023, 105501,https://doi.org/10.1016/j.engappai.2022.105501.  

目录
打赏
0
0
0
0
78
分享
相关文章
基于和声搜索优化算法的机器工作调度matlab仿真,输出甘特图
本程序基于和声搜索优化算法(Harmony Search, HS),实现机器工作调度的MATLAB仿真,输出甘特图展示调度结果。算法通过模拟音乐家即兴演奏寻找最佳和声的过程,优化任务在不同机器上的执行顺序,以最小化完成时间和最大化资源利用率为目标。程序适用于MATLAB 2022A版本,运行后无水印。核心参数包括和声记忆大小(HMS)等,适应度函数用于建模优化目标。附带完整代码与运行结果展示。
阿里云 AI 搜索开放平台:从算法到业务——AI 搜索驱动企业智能化升级
本文介绍了阿里云 AI 搜索开放平台的技术的特点及其在各行业的应用。
103 3
基于AES的遥感图像加密算法matlab仿真
本程序基于MATLAB 2022a实现,采用AES算法对遥感图像进行加密与解密。主要步骤包括:将彩色图像灰度化并重置大小为256×256像素,通过AES的字节替换、行移位、列混合及轮密钥加等操作完成加密,随后进行解密并验证图像质量(如PSNR值)。实验结果展示了原图、加密图和解密图,分析了图像直方图、相关性及熵的变化,确保加密安全性与解密后图像质量。该方法适用于保护遥感图像中的敏感信息,在军事、环境监测等领域具有重要应用价值。
基于免疫算法的最优物流仓储点选址方案MATLAB仿真
本程序基于免疫算法实现物流仓储点选址优化,并通过MATLAB 2022A仿真展示结果。核心代码包括收敛曲线绘制、最优派送路线规划及可视化。算法模拟生物免疫系统,通过多样性生成、亲和力评价、选择、克隆、变异和抑制机制,高效搜索最优解。解决了物流仓储点选址这一复杂多目标优化问题,显著提升物流效率与服务质量。附完整无水印运行结果图示。
基于免疫算法的最优物流仓储点选址方案MATLAB仿真
基于GA遗传优化TCN-GRU时间卷积神经网络时间序列预测算法matlab仿真
本项目基于MATLAB2022a开发,提供无水印算法运行效果预览及核心程序(含详细中文注释与操作视频)。通过结合时间卷积神经网络(TCN)和遗传算法(GA),实现复杂非线性时间序列的高精度预测。TCN利用因果卷积层与残差连接提取时间特征,GA优化超参数(如卷积核大小、层数等),显著提升模型性能。项目涵盖理论概述、程序代码及完整实现流程,适用于金融、气象、工业等领域的时间序列预测任务。
基于遗传优化算法的多AGV栅格地图路径规划matlab仿真
本程序基于遗传优化算法实现多AGV栅格地图路径规划的MATLAB仿真(测试版本:MATLAB2022A)。支持单个及多个AGV路径规划,输出路径结果与收敛曲线。核心程序代码完整,无水印。算法适用于现代工业与物流场景,通过模拟自然进化机制(选择、交叉、变异)解决复杂环境下的路径优化问题,有效提升效率并避免碰撞。适合学习研究多AGV系统路径规划技术。
基于GA遗传算法的斜拉桥静载试验车辆最优布载matlab仿真
本程序基于遗传算法(GA)实现斜拉桥静载试验车辆最优布载的MATLAB仿真,旨在自动化确定车辆位置以满足加载效率ηq(0.95≤ηq≤1.05)的要求,目标是使ηq尽量接近1,同时减少加载车辆数量和布载耗时。程序通过迭代优化计算车辆位置、方向、类型及占用车道等参数,并展示适应度值收敛过程。测试版本为MATLAB2022A,包含核心代码与运行结果展示。优化模型综合考虑车辆总重量、间距及桥梁允许载荷密度等约束条件,确保布载方案科学合理。
基于ECC簇内分组密钥管理算法的无线传感器网络matlab性能仿真
本程序基于ECC(椭圆曲线密码学)簇内分组密钥管理算法,对无线传感器网络(WSN)进行MATLAB性能仿真。通过对比网络通信开销、存活节点数量、网络能耗及数据通信量四个关键指标,验证算法的高效性和安全性。程序在MATLAB 2022A版本下运行,结果无水印展示。算法通过将WSN划分为多个簇,利用ECC生成和分发密钥,降低计算与通信成本,适用于资源受限的传感器网络场景,确保数据保密性和完整性。
基于GA遗传优化TCN时间卷积神经网络时间序列预测算法matlab仿真
本内容介绍了一种基于遗传算法优化的时间卷积神经网络(TCN)用于时间序列预测的方法。算法运行于 Matlab2022a,完整程序无水印,附带核心代码、中文注释及操作视频。TCN通过因果卷积层与残差连接学习时间序列复杂特征,但其性能依赖超参数设置。遗传算法通过对种群迭代优化,确定最佳超参数组合,提升预测精度。此方法适用于金融、气象等领域,实现更准确可靠的未来趋势预测。
基于LSB最低有效位的音频水印嵌入提取算法FPGA实现,包含testbench和MATLAB对比
本项目展示了一种基于FPGA的音频水印算法,采用LSB(最低有效位)技术实现版权保护与数据追踪功能。使用Vivado2019.2和Matlab2022a开发,完整代码含中文注释及操作视频。算法通过修改音频采样点的最低有效位嵌入水印,人耳难以察觉变化。然而,面对滤波或压缩等攻击时,水印提取可能受影响。该项目运行效果无水印干扰,适合实时应用场景,核心逻辑简单高效,时间复杂度低。

热门文章

最新文章

AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等