mate.m

来自「基本遗传算法程序包」· M 代码 · 共 15 行

M
15
字号
function [new_gen,mating] = mate(old_gen)%MATE   Randomly reorders (mates) OLD_GEN.%	[NEW_GEN,MATING] = MATE(OLD_GEN) performs random reordering%       on OLD_GEN.  NEW_GEN is the new reordering.  Individual in %       row 1 is to be mated with individual in row 2, etc.  MATING%       is the reordering vector (ie: new_gen=old_gen(mating,:)).%%	Copyright (c) 1993 by the MathWorks, Inc.%	Andrew Potvin 1-10-93.[junk,mating] = sort(rand(size(old_gen,1),1));new_gen = old_gen(mating,:);% end mate

⌨️ 快捷键说明

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