⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ga_extra1.m

📁 其中提到遺傳學的程式碼與應用提供給次淚相向的研究者參考下載
💻 M
字号:
% GA_extra1.m file
% Fin min of a function of 2 varaibles
% minimize f(x,y)=x*x*(4-2.1*x*x+x^4/3)+x*y+y*y*(-4+4*y*y)
% x:-3 to 3, y:-2 to 2
% PenChen Chou, 2003-11-12

clear all
ans=1;
who
fprintf('>>>Start this program [GA_extra1.m] now. Please wait!\n');
pause(1)
global MIN_offset MUL_factor LOCUS x_data y_data
MIN_offset=5; LOCUS=0; x_data=[]; y_data=[];
MUL_factor=1;
%**********************************************************/
%       User can modify the following in blocks
%**********************************************************/
obj_fcn = 'GA_fextra1';	% Objective function
range = [-3 -2
    3  2];	% Range of the input variables
IC=[]; elite=1; 
gen_no=400;popuSize=50;bit_n=40;
xover_rate=0.8;mutate_rate=0.05;
%************************************************************
% call GA_genetic
tic
[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); 

% Plot 3-D
plot_extra1;

% SAMPLE RESULTS
%The best generation occurred at generation #541.
%   x1 =  -0.08984200
%   x2 =   0.71265700
%==>Best fitness for MIN. problem is (-1.03162845)
%==>  Computation time is (1.31) minutes.

%The best generation occurred at generation #181.
%   x1 =   0.08984200
%   x2 =  -0.71265600
%==>Best fitness for MIN. problem is (-1.03162845)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -