Posts

Showing posts from March 12, 2023

New Post

Whale Optimization Algorithm Code Implementation || WOA CODE || ~xRay Pixy

Image
Whale Optimization Algorithm Code Implementation Whale Optimization Algorithm Code Files function obj_fun(test_fun) switch test_fun     case 'F1'         x = -100:2:100; y=x;     case 'F2'         x = -10:2:10; y=x; end end function [LB,UB,D,FitFun]=test_fun_info(C) switch C     case 'F1'         FitFun = @F1;         LB = -100;          UB = 100;         D = 30;     case 'F2'         FitFun = @F2;         LB = -10;         UB = 10;         D = 30; end % F1 Test Function     function r = F1(x)         r = sum(x.^2);     end % F2 Test Function     function r = F2(x)         r = sum(abs(x))+prod(abs(x));     end end function Position = initialize(Pop_Size,D,UB,LB) SS_Bounds = size(UB,2); if SS_Bounds == 1     Position = rand(Pop_Size,D).*(UB-LB)+LB; end if SS_Bounds>1     for i = 1:D         UB_i = UB(i);         LB_i = LB(i);         Position(:,i) = rand(Pop_Size,1).*(UB_i-LB_i)+LB_i;      end end end function [Best_Val,Best_Pos,Convergence_Curve]=WOA(
More posts