📄 readcodemeth.sci
字号:
function ReadCodeMeth(CodeFile)
// read code/decode method and their parameters
if nargin<1
CodeFile = 'code.ini';
end
global RealDecodeMeth;
global RealSelectMeths;
global RealXoverMeths;
global RealMutateMeths;
global BinDecodeMeth;
global BinSelectMeths;
global BinXoverMeths;
global BinMutateMeths;
global GrayDecodeMeth;
global GraySelectMeths;
global GrayXoverMeths;
global GrayMutateMeths;
global OrderDecodeMeth;
global OrderSelectMeths;
global OrderXoverMeths;
global OrderMutateMeths;
global AdjRealSelectMeths;
global AdjRealXoverMeths;
global AdjRealMutateMeths;
global AdjBinSelectMeths;
global AdjBinXoverMeths;
global AdjBinMutateMeths;
global AdjGraySelectMeths;
global AdjGrayXoverMeths;
global AdjGrayMutateMeths;
global AdjOrderSelectMeths;
global AdjOrderXoverMeths;
global AdjOrderMutateMeths;
global RealFitScalingMeths;
global RealClusterNicheMeths;
global RealShareNicheMeths;
global BinFitScalingMeths;
global BinClusterNicheMeths;
global BinShareNicheMeths;
global GrayFitScalingMeths;
global GrayClusterNicheMeths;
global GrayShareNicheMeths;
global OrderFitScalingMeths;
global OrderClusterNicheMeths;
global OrderShareNicheMeths;
RealDecodeMeth=list();
RealSelectMeths=list();
RealXoverMeths=list();
RealMutateMeths=list();
BinDecodeMeth=list();
BinSelectMeths=list();
BinXoverMeths=list();
BinMutateMeths=list();
GrayDecodeMeth=list();
GraySelectMeths=list();
GrayXoverMeths=list();
GrayMutateMeths=list();
OrderDecodeMeth=list();
OrderSelectMeths=list();
OrderXoverMeths=list();
OrderMutateMeths=list();
AdjRealSelectMeths=list();
AdjRealXoverMeths=list();
AdjRealMutateMeths=list();
AdjBinSelectMeths=list();
AdjBinXoverMeths=list();
AdjBinMutateMeths=list();
AdjGraySelectMeths=list();
AdjGrayXoverMeths=list();
AdjGrayMutateMeths=list();
AdjOrderSelectMeths=list();
AdjOrderXoverMeths=list();
AdjOrderMutateMeths=list();
RealFitScalingMeths=list();
RealClusterNicheMeths=list();
RealShareNicheMeths=list();
BinFitScalingMeths=list();
BinClusterNicheMeths=list();
BinShareNicheMeths=list();
GrayFitScalingMeths=list();
GrayClusterNicheMeths=list();
GrayShareNicheMeths=list();
OrderFitScalingMeths=list();
OrderClusterNicheMeths=list();
OrderShareNicheMeths=list();
fid= fopen(CodeFile, 'r');
while 1
if feof(fid) then
break
end
tline = stripblanks(fgetl(fid));
select tline
case 'Decode:' then
tline = fgetl(fid);
while ~strcmp(stripblanks(tline), 'end')
c = parse(tline);
if (strcmp(stripblanks(c(1,:)),'Real')) then
RealDecodeMeth=c(2,:);
end
if (strcmp(stripblanks(c(1,:)),'Binary')) then
BinDecodeMeth=c(2,:);
end
if (strcmp(stripblanks(c(1,:)),'Gray')) then
GrayDecodeMeth=c(2,:);
end
if (strcmp(stripblanks(c(1,:)),'Order')) then
OrderDecodeMeth=c(2,:);
end
tline = fgetl(fid);
end
case 'Select:' then
tline = fgetl(fid);
while ~strcmp(stripblanks(tline), 'end')
c = parse(tline);
if (strcmp(stripblanks(c(1,:)),'All')) then
RealSelectMeths(0) = list(c(2,:),c(3,:));
BinSelectMeths(0) = list(c(2,:),c(3,:));
GraySelectMeths(0) = list(c(2,:),c(3,:));
OrderSelectMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Real')) then
RealSelectMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Binary')) then
BinSelectMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Gray')) then
GraySelectMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(c(1,:),'Order')) then
OrderSelectMeths(0) = list(c(2,:),c(3,:));
end
tline = fgetl(fid);
end
case 'Crossover:' then
tline = fgetl(fid);
while ~strcmp(stripblanks(tline), 'end')
c = parse(tline);
if (strcmp(stripblanks(c(1,:)),'All')) then
RealXoverMeths(0) = list(c(2,:),c(3,:));
BinXoverMeths(0) = list(c(2,:),c(3,:));
GrayXoverMeths(0) = list(c(2,:),c(3,:));
OrderXoverMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Real')) then
RealXoverMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Binary')) then
BinXoverMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Gray')) then
GrayXoverMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(c(1,:),'Order')) then
OrderXoverMeths(0) = list(c(2,:),c(3,:));
end
tline = fgetl(fid);
end
case 'Mutation:' then
tline = fgetl(fid);
while ~strcmp(stripblanks(tline), 'end')
c = parse(tline);
if (strcmp(stripblanks(c(1,:)),'All')) then
RealMutateMeths(0) = list(c(2,:),c(3,:));
BinMutateMeths(0) = list(c(2,:),c(3,:));
GrayMutateMeths(0) = list(c(2,:),c(3,:));
OrderMutateMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Real')) then
RealMutateMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Binary')) then
BinMutateMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Gray')) then
GrayMutateMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(c(1,:),'Order')) then
OrderMutateMeths(0) = list(c(2,:),c(3,:));
end
tline = fgetl(fid);
end
case 'AdjSelect:' then
tline = fgetl(fid);
while ~strcmp(stripblanks(tline), 'end')
c = parse(tline);
if (strcmp(stripblanks(c(1,:)),'All')) then
AdjRealSelectMeths(0) = list(c(2,:),c(3,:));
AdjBinSelectMeths(0) = list(c(2,:),c(3,:));
AdjGraySelectMeths(0) = list(c(2,:),c(3,:));
AdjOrderSelectMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Real')) then
AdjRealSelectMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Binary')) then
AdjBinSelectMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Gray')) then
AdjGraySelectMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(c(1,:),'Order')) then
AdjOrderSelectMeths(0) = list(c(2,:),c(3,:));
end
tline = fgetl(fid);
end
case 'AdjCrossover:' then
tline = fgetl(fid);
while ~strcmp(stripblanks(tline), 'end')
c = parse(tline);
if (strcmp(stripblanks(c(1,:)),'All')) then
AdjRealXoverMeths(0) = list(c(2,:),c(3,:));
AdjBinXoverMeths(0) = list(c(2,:),c(3,:));
AdjGrayXoverMeths(0) = list(c(2,:),c(3,:));
AdjOrderXoverMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Real')) then
AdjRealXoverMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Binary')) then
AdjBinXoverMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Gray')) then
AdjGrayXoverMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(c(1,:),'Order')) then
AdjOrderXoverMeths(0) = list(c(2,:),c(3,:));
end
tline = fgetl(fid);
end
case 'AdjMutation:' then
tline = fgetl(fid);
while ~strcmp(stripblanks(tline), 'end')
c = parse(tline);
if (strcmp(stripblanks(c(1,:)),'All')) then
AdjRealMutateMeths(0) = list(c(2,:),c(3,:));
AdjBinMutateMeths(0) = list(c(2,:),c(3,:));
AdjGrayMutateMeths(0) = list(c(2,:),c(3,:));
AdjOrderMutateMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Real')) then
AdjRealMutateMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Binary')) then
AdjBinMutateMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Gray')) then
AdjGrayMutateMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(c(1,:),'Order')) then
AdjOrderMutateMeths(0) = list(c(2,:),c(3,:));
end
tline = fgetl(fid);
end
case 'FitScaling:' then
tline = fgetl(fid);
while ~strcmp(stripblanks(tline), 'end')
c = parse(tline);
if (strcmp(stripblanks(c(1,:)),'All')) then
RealFitScalingMeths(0) = list(c(2,:),c(3,:));
BinFitScalingMeths(0) = list(c(2,:),c(3,:));
GrayFitScalingMeths(0) = list(c(2,:),c(3,:));
OrderFitScalingMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Real')) then
RealFitScalingMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Binary')) then
BinFitScalingMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Gray')) then
GrayFitScalingMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(c(1,:),'Order')) then
OrderFitScalingMeths(0) = list(c(2,:),c(3,:));
end
tline = fgetl(fid);
end
case 'ClusterNiche:' then
tline = fgetl(fid);
while ~strcmp(stripblanks(tline), 'end')
c = parse(tline);
if (strcmp(stripblanks(c(1,:)),'All')) then
RealClusterNicheMeths(0) = list(c(2,:),c(3,:));
BinClusterNicheMeths(0) = list(c(2,:),c(3,:));
GrayClusterNicheMeths(0) = list(c(2,:),c(3,:));
OrderClusterNicheMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Real')) then
RealClusterNicheMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Binary')) then
BinClusterNicheMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Gray')) then
GrayClusterNicheMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(c(1,:),'Order')) then
OrderClusterNicheMeths(0) = list(c(2,:),c(3,:));
end
tline = fgetl(fid);
end
case 'ShareNiche:' then
tline = fgetl(fid);
while ~strcmp(stripblanks(tline), 'end')
c = parse(tline);
if (strcmp(stripblanks(c(1,:)),'All')) then
RealShareNicheMeths(0) = list(c(2,:),c(3,:));
BinShareNicheMeths(0) = list(c(2,:),c(3,:));
GrayShareNicheMeths(0) = list(c(2,:),c(3,:));
OrderShareNicheMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Real')) then
RealShareNicheMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Binary')) then
BinShareNicheMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(stripblanks(c(1,:)),'Gray')) then
GrayShareNicheMeths(0) = list(c(2,:),c(3,:));
end
if (strcmp(c(1,:),'Order')) then
OrderShareNicheMeths(0) = list(c(2,:),c(3,:));
end
tline = fgetl(fid);
end
else
disp('Error: unrecognizable symbol!');
break;
end
//disp(tline)
end
fclose(fid);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -