📄 ga_griewank.m
字号:
% GA_Griewank.m file
% Fin min of a function of 2 varaibles
% PenChen Chou, 4-22-2002
clear all
ans=1;
who
fprintf('>>>Start this program [GA_Griewank.m] now. Please wait!\n');
pause(1)
global MIN_offset MUL_factor
MIN_offset=2;
MUL_factor=0.01;
%**********************************************************/
% User can modify the following in blocks
%**********************************************************/
obj_fcn = 'GA_fgrie'; % Objective function
% Range is from -500 to 500.
range = [84 84
105 105]; % Range of the input variables
IC=[]; elite=1;
gen_no=1000;
popuSize=100;
bit_n=100;
xover_rate=0.8;
mutate_rate=0.2;
%************************************************************
% call GA written by Chang
tic
% Calling GA_genetic
[popu, popu_real, fcn_value, upper, average,...
lower, BEST_popu, popuSize, gen_no, para, best_pi,...
bit_n, xover_rate, mutate_rate]=...
GA_genetic(obj_fcn, range, IC, elite, gen_no, popuSize,...
bit_n, xover_rate, mutate_rate);
t=toc/60;
fprintf('==> Computation time is (%.2f) minutes.\n\n',t);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -