资源简介
内附NEAT算法源程序,各位可以参考,根据具体问题进行修改。
代码片段和文件信息
%%%%%%%%%%%%%%%%%%%%%%% generate minimal initial population
%% Neuro_Evolution_of_Augmenting_Topologies - NEAT
%% developed by Kenneth Stanley (kstanley@cs.utexas.edu) & Risto Miikkulainen (risto@cs.utexas.edu)
%% Coding by Christian Mayr (matlab_neat@web.de)
function [populationinnovation_record]=initial_population(number_individualsnumber_input_nodesnumber_output_nodesvector_connected_input_nodes);
% nodegenes is array 4rows * (number_input_nodes+number_output_nodes+hidden-nodes(not existent in initial population) +1 (bias-node))columns
% nodegenes contains consecutive node ID‘s (upper row) node type (lower row) 1=input 2=output 3=hidden 4=bias node input state and node output state (used for evaluation all input states zero initially except bias node which is always 1)
% connectiongenes is array 5 rows * number_connections columns
% from top to bottom those five rows contain: innovation number connection from connection to weight enable bit
% the rest of the elements in the structure for an individual should be self-explanatory
% innovation_record tracks innovations in a 5rows by (number of innovations) columns matrix contains innovation number connect_from_node as well as connect_to_node for this innovation)
% the new node (if it is a new node mutation then this node will appear in the 4th row when it is first connected. There will always be two innovations with one node mutation since there is a connection to and from the new node.
% In the initial population this will be abbreviated to the Node with the highest number appearing in the last column of the record since only this is needed as starting point for the rest of the algorithm)
% and 5th row is generation this innovation occured (generation is assumed to be zero for the innovations in the initial population)
%compute number and matrix of initial connections (all connections between output nodes and the nodes listed in vector_connected_input_nodes)
number_connections=(length(vector_connected_input_nodes)+1)*number_output_nodes;
vector_connection_from=rep([vector_connected_input_nodesnumber_input_nodes+1][1 number_output_nodes]);
vector_connection_to=[];
for index_output_node=(number_input_nodes+2):(number_input_nodes+1+number_output_nodes)
vector_connection_to=[vector_connection_toindex_output_node*ones(1length(vector_connected_input_nodes)+1)];
end
connection_matrix=[vector_connection_from;
vector_connection_to];
for index_individual=1:number_individuals;
population(index_individual).nodegenes=[1:(number_input_nodes+1+number_output_nodes);
ones(1number_input_nodes)42*ones(1number_output_nodes);
zeros(1number_input_nodes)1zeros(1number_output_nodes);
zeros(1number_input_nodes+1+number_output_nodes)];
population(index_individual).connectiongenes=[1:
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3594 2003-09-01 05:52 matlab_neat源程序\README
文件 3675 2003-05-20 03:26 matlab_neat源程序\initial_population.m
文件 15156 2003-08-22 22:37 matlab_neat源程序\neat_main.m
文件 1162 1994-04-18 13:00 matlab_neat源程序\rep.m
文件 30437 2003-08-19 03:56 matlab_neat源程序\reproduce.m
文件 4904 2003-08-22 22:30 matlab_neat源程序\xor_experiment.m
文件 4136 2003-08-22 22:30 matlab_neat源程序\xor_experiment_vec.m
目录 0 2017-10-31 10:52 matlab_neat源程序\
- 上一篇:人脸分割matlab
- 下一篇:SVPWM驱动异步电机matlab2008a
评论
共有 条评论