📄 ga_ex25a.m
字号:
% GA_ex25A.m file
% Fin min of a function of 5 varaibles
%**********************************************************/
% User can modify the following in blocks
%**********************************************************/
clear all
ans=1;
who
fprintf('>>>Start this program now. Please wait!\n');
pause(1)
global MIN_offset MUL_factor LOCUS x_data y_data
MIN_offset=27; MUL_factor=1; LOCUS=0; x_data=[]; y_data=[];
obj_fcn = 'GA_f25'; % Objective function
range = [-5.12 -5.12 -5.12 -5.12 -5.12
5.12 5.12 5.12 5.12 5.12]; % Range of the input variables
IC=[]; elite=1;
gen_no=500; popuSize=50;
bit_n=10; % DO NOT USE TOO LARGE OF THIS NUMBER
%************************************************************
% call GA
tic
%GA_genetic(obj_fcn, range, IC, elite,...
% gen_no, popuSize, bit_n, xover_rate, mutate_rate);
[popu, popu_real, fcn_value, upper, average, lower, ...
popuSize, gen_no] = GA_genetic(obj_fcn, range,...
IC, elite, gen_no, popuSize, bit_n);
t=toc/60;
fprintf('==> Computation time is (%.2f) minutes.\n',t);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -