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

📄 getchrom.m

📁 多智能体工具包
💻 M
字号:
function CurrentChrom=getchrom(ThisPopulation)
% GETCHROM	Convert the population to corresponding chromosomes.

%     Copyright (c) 1998-2000 Jiming Liu and Jianbing Wu

global RegionCodeLen DirectCodeLen RobotNum PopulationSize;

CurrentChrom=[];
for loop1=1:PopulationSize
  TempChrom=[];
  % Deal with the POSITION
  for loop2=1:RobotNum
    ChangeValue=ThisPopulation(loop1,loop2);
    BinCode=int2bin(ChangeValue,RegionCodeLen);
    GrayCode=bin2gray(BinCode);
    TempChrom=[TempChrom GrayCode];
  end;

  % Deal with the DIRECTION
  for loop2=1:RobotNum
    ChangeValue=ThisPopulation(loop1,loop2+RobotNum);
    BinCode=int2bin(ChangeValue,DirectCodeLen);
    GrayCode=bin2gray(BinCode);
    TempChrom=[TempChrom GrayCode];
  end;
  CurrentChrom=[CurrentChrom;TempChrom];
end;

⌨️ 快捷键说明

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