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

📄 getreal.m

📁 多智能体工具包
💻 M
字号:
function RealValue=getreal(ThisChromsome)
% GETREAL	Return the corresponding value of the chromosome.

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

global RegionCodeLen DirectCodeLen RobotNum;

RealValue=[];
% Deal with the POSITION
for loop1=1:RobotNum
  GrayCode=ThisChromsome((loop1-1)*RegionCodeLen+1:loop1*RegionCodeLen);
  BinCode=gray2bin(GrayCode);
  IntValue=bin2int(BinCode);
  RealValue=[RealValue IntValue];
end;

% Deal with the DIRECTION
for loop1=RobotNum+1:RobotNum*2
  GrayCode=ThisChromsome((loop1-1)*DirectCodeLen+1:loop1*DirectCodeLen);
  BinCode=gray2bin(GrayCode);
  IntValue=bin2int(BinCode);
  RealValue=[RealValue IntValue];
end;

⌨️ 快捷键说明

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