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

📄 ga_alloc.m

📁 其中提到遺傳學的程式碼與應用提供給次淚相向的研究者參考下載
💻 M
字号:
% GA_alloc.m file
% Fin max profits of an allocation process

% PenChen Chou, 4-8-2002

clear all
ans=1;
who
fprintf('>>>Start this program [GA_alloc.m] now. Please wait!\n');
pause(1)
global MUL_factor MIN_offset MTX MAX
MUL_factor=1; MIN_offset=0;
MAX=-400;
MTX=[300 960   5 0.8
     150 450 2.5 0.35
     100 250 2.0 0.25
      80 200 8.5 1.3
      50 150 3.0 0.35];
  
%**********************************************************/
%       User can modify the following in blocks
%**********************************************************/
obj_fcn = 'falloc';	% Objective function
%range = [0 0 0 0 0
%    208 444 300 300 300];	% Range of the input variables
range=[-1 -1 -1 -1 -1
    2.8 2.8 2.8 2.8 2.8];
IC=[]; elite=1; 
gen_no=2000;
popuSize=100;
bit_n=40;
xover_rate=0.7;
mutate_rate=0.4;
%************************************************************
% call GA written by Chang
tic
% function 
%[popu, popu_real, fcn_value, upper, average,...
%  lower, BEST_popu, popuSize, gen_no, para, best_pi]=...
%  GA_genetic(obj_fcn, range, IC, elite, gen_no, popuSize,...
%  bit_n, xover_rate, mutate_rate);
[popu, popu_real, fcn_value, upper, average,...
  lower, BEST_popu, popuSize, gen_no, para, best_pi]=...
  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);  
            
% Calculate the last result
load tempx
temp=x*MTX;
fprintf('The max profit=%10.2f\n',temp(4));
fprintf('The max weight=%10.2f(<=70000)\n',temp(1));
fprintf('The max volume=%10.2f(<=200000)\n',temp(2));
fprintf('The max  cost =%10.2f(<= 3000)\n',temp(3));
fprintf('Items=[%3i %3i %3i %3i %3i]\n',x(1),x(2),x(3),x(4),x(5));

⌨️ 快捷键说明

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