【优化算法】学生心理学优化算法(SPBO)【含Matlab源码 1430期】
【摘要】
一、获取代码方式
获取代码方式1: 通过订阅紫极神光博客付费专栏,凭支付凭证,私信博主,可获得此代码。
获取代码方式2: 完整代码已上传我的资源:【优化算法】学生心理学优化算法(SPBO)【含Matl...
一、获取代码方式
获取代码方式1:
通过订阅紫极神光博客付费专栏,凭支付凭证,私信博主,可获得此代码。
获取代码方式2:
完整代码已上传我的资源:【优化算法】学生心理学优化算法(SPBO)【含Matlab源码 1430期】
备注:
订阅紫极神光博客付费专栏,可免费获得1份代码(有效期为订阅日起,三天内有效);
二、部分源代码
% Student psychology based optimization (SPBO)algorithm
%
%
%
%
% Main paper:
% Bikash Das, V Mukherjee, Debapriya Das, Student psychology based optimization algorithm: A new population based
% optimization algorithm for solving optimization problems, Advances in Engineering Software, 146 (2020) 102804.
%_______________________________________________________________________________________________
% You can simply define your objective function in a seperate file and load its handle to fobj
% The initial parameters that you need are:
%__________________________________________
% fobj = @Objective function
% variable = number of your variables
% Max_iteration = maximum number of iterations
% student = number of search agents
% mini=[mini1,mini2,...,minin] where mini is the lower bound of variable n
% maxi=[maxi1,maxi2,...,maxin] where maxi is the upper bound of variable n
% If all the variables have equal lower bound you can just
% define mini and maxi as two single numbers
% To run SPBO: [Best_fitness,Best_student,Convergence_curve]=SPBO(student,Max_iteration,mini,maxi,variable,fobj)
%______________________________________________________________________________________________
clear all
clc
student=20; % Number of student (population)
Function_name='F5'; % Name of the test function that can be from F1 to F23
Max_iteration=1000; % Maximum number of iterations
% Load details of the selected benchmark function
[mini,maxi,variable,fobj]=Functions(Function_name);
%Solution obtained using SPBO
[Best_fitness,Best_student,Convergence_curve]=SPBO(student,Max_iteration,maxi,mini,variable,fobj);
% Converging Curve
figure (1)
plot (Convergence_curve);
title('Convergence curve')
xlabel('Iteration');
ylabel('Fitness of best student so far');
display(['The best solution obtained by SPBO is : ', num2str(Best_student)]);
display(['The best optimal value of the objective funciton found by SPBO is : ', num2str(Best_fitness)]);
% Student psychology based optimization (SPBO)algorithm
%
% Source codes demo version 1.0
%
% Developed in MATLAB R2017b
%
% Author and programmer: Bikash Das, V. Mukherjee, D. Das
%
% e-Mail: bcazdas@gmail.com, vivek_agamani@yahoo.com, ddas@ee.iitkgp.ernet.in
%
%
% Main paper:
% Bikash Das, V Mukherjee, Debapriya Das, Student psychology based optimization algorithm: A new population based
% optimization algorithm for solving optimization problems, Advances in Engineering Software, 146 (2020) 102804.
%_______________________________________________________________________________________________
% You can simply define your objective function in a seperate file and load its handle to fobj
% The initial parameters that you need are:
%__________________________________________
% fobj = @Objective function
% variable = number of your variables
% Max_iteration = maximum number of iterations
% student = number of search agents
% mini=[mini1,mini2,...,minin] where mini is the lower bound of variable n
% maxi=[maxi1,maxi2,...,maxin] where maxi is the upper bound of variable n
% If all the variables have equal lower bound you can just
% define mini and maxi as two single numbers
% To run SPBO: [Best_fitness,Best_student,Convergence_curve]=SPBO(student,Max_iteration,mini,maxi,variable,fobj)
%______________________________________________________________________________________________
function [mini,maxi,variable,fobj] = Functions(F)
switch F
case 'F1'
fobj = @F1;
mini=-5.12;
maxi=5.12;
variable=10;
case 'F2'
fobj = @F2;
mini=-10;
maxi=10;
variable=10;
case 'F3'
fobj = @F3;
mini=-100;
maxi=100;
variable=10;
case 'F4'
fobj = @F4;
mini=-5.12;
maxi=5.12;
variable=10;
case 'F5'
fobj = @F5;
mini=-1.28;
maxi=1.28;
variable=10;
end
end
% Step
% F1
function o = F1(x)
o=sum(((x+.5)).^2);
end
% Sum Square
% F2
function o = F2(x)
variable=size(x,2);
o=sum([1:variable].*(x.^2));
end
% Sphere
% F3
function o = F3(x)
o=sum((x).^2);
end
% Rastrigin
% F4
function o = F4(x)
variable=size(x,2);
o=sum(x.^2-10*cos(2*pi.*x))+10*variable;
end
% Quartic
% F5
function o = F5(x)
variable=size(x,2);
o=sum([1:variable].*(x.^4));
end
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 167
三、运行结果
四、matlab版本及参考文献
1 matlab版本
2014a
2 参考文献
[1] 包子阳,余继周,杨杉.智能优化算法及其MATLAB实例(第2版)[M].电子工业出版社,2016.
[2]张岩,吴水根.MATLAB优化算法源代码[M].清华大学出版社,2017.
文章来源: qq912100926.blog.csdn.net,作者:海神之光,版权归原作者所有,如需转载,请联系作者。
原文链接:qq912100926.blog.csdn.net/article/details/120915033
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)