✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
🍎个人主页:Matlab科研工作室
🍊个人信条:格物致知。
更多Matlab仿真内容点击👇
⛄ 内容介绍
基于金鹰算法解单目标优化问题(GoldenEagleOptimizer,GEO)是一种基于自然界中金鹰觅食行为特点和优化算法的单目标优化方法。该算法通过模拟金鹰的觅食行为来搜索问题的最优解。
以下是GEO算法的基本步骤:
- 问题建模:将单目标优化问题转化为一个数学模型。定义目标函数和约束条件,目标函数可以是需要最小化或最大化的目标指标。
- 随机初始化种群:随机生成一组初始解作为种群,每个解表示问题的一个候选解。
- 金鹰觅食行为:根据金鹰的觅食行为,对种群中的每个个体进行评估,并选择适应度值较高的个体作为“猎物”。
- 竞争行为:根据金鹰的竞争行为,对种群中的个体进行竞争和交流,以促进解的多样性和探索能力。
- 探索行为:根据金鹰的探索行为,对种群中的个体进行随机扰动和变异,引入随机性和多样性。
- 终止条件判断:根据预设的终止条件(如达到最大迭代次数、目标函数收敛等),判断是否终止优化过程。
- 更新种群:根据金鹰的觅食行为和竞争行为,更新种群中个体的位置和适应度值。
- 输出最优解:在优化过程结束后,输出具有最优目标函数值的个体作为最优解。
⛄ 部分代码
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) 2019-present, Mahmoud Afifi% York University, Canada% Email: mafifi@eecs.yorku.ca - m.3afifi@gmail.com%% This source code is licensed under the license found in the% LICENSE file in the root directory of this source tree.% All rights reserved.%%%% Please cite the following work if this program is used:% Mahmoud Afifi and Michael S. Brown. Sensor Independent Illumination % Estimation for DNN Models. In BMVC, 2019%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%clcclear allclose allMatlab_ver = 'higher'; %'2018b', '2019a', or 'higher'image_name = fullfile('imgs_w_normalization',... 'Cube+_challenge_CanonEOS550D_243.png'); %image name %Note: be sure that the image is in the raw-RGB linear space and the %black/saturation normalization is correctly applied to the image before %using it.model_name = 'trained_model_wo_NUS_Canon1DsMkIII'; %trained model namedevice = 'gpu'; %cpuin_img_sz = 150; %our network accepts 150x150 raw-RGB imageif strcmpi(Matlab_ver, '2018b') == 1 || strcmpi(Matlab_ver,'2019a') == 1 old = 1; load(fullfile('models_old',model_name)); %load the trained modelelse old = 0; load(fullfile('models',model_name)); %load the trained modelendI_ = imread(image_name); %read the imagesz =size(I_);if sz(1)~=in_img_sz || sz(2)~=in_img_sz I = imresize(I_,[in_img_sz,in_img_sz]); %resize the imageelse I = I_;end%estimate the scene illuminantif old == 1 est_ill = predict(trained_model,I,'ExecutionEnvironment',device); else est_ill = predict_(trained_model,I,device); %estimate the scene illuminantendest_ill = est_ill./norm(est_ill); %make it a unit vectorfprintf('Estimated scene illuminant = %f, %f, %f\n',... est_ill(1),est_ill(2),est_ill(3)); %display the resultfactor = 6; %scale factor to aid visualizationsubplot(1,3,1); imshow(I_*factor); title('Input raw-RGB image'); %show input raw-RGB image (scaled to aid visualization)subplot(1,3,2); imshow(imresize(imread('mapped.png')*factor,[sz(1) sz(2)]));title('mapped image');subplot(1,3,3); imshow(reshape(... reshape(im2double(I_),[],3)*diag(est_ill(2)./est_ill),sz)*factor); %apply white balance correction then show the result (scaled to aid visualization)title('White-balanced raw-RGB image');linkaxes
⛄ 运行结果
⛄ 参考文献
[1] Mohammadi-Balani A , Nayeri M D , Azar A ,et al.Golden Eagle Optimizer: A nature-inspired metaheuristic algorithm[J].Computers & Industrial Engineering, 2020, 152:107050.DOI:10.1016/j.cie.2020.107050.