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

📄 binarymutation.m

📁 18个遗传算法程序matlab源码
💻 M
字号:
function [parent] = binaryMutate(parent,bounds,Ops)% Binary mutation changes each of the bits of the parent% based on the probability of mutation%% function [newSol] = binaryMutate(parent,bounds,Ops)% parent  - the first parent ( [solution string function value] )% bounds  - the bounds matrix for the solution space% Ops     - Options for binaryMutation [gen prob_of_mutation]pm=Ops(2);numVar = size(parent,2)-1; 		% Get the number of variables % Pick a variable to mutate randomly from 1-number of varsrN=rand(1,numVar)<pm;parent=[abs(parent(1:numVar) - rN) parent(numVar+1)];  

⌨️ 快捷键说明

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