ga-nn-ag 
Copyright 2004 Oswaldo Morizaki

Things you need:
	Syslog daemon
	gcc
	Dependencies listed in "my_header.h"	


Some things you need to know:

Put all the files in the same directory, I mean binaries, config files, input 
and output files (you could put input and output in other place, but you should 
add the path in the input_preffix and output_preffix values).

Five syslog facilities are required for the log (using the syslog daemon): 

	local0 (for the genetic algorithm server), 
	local1 (for the genetic algorithm client), 
	local2 (for the neural network), 
	local3 (for additional neural network programs), and 
	local4 (for the remote server)
	
Three config files are required: ga_server_config, nn_train_config, 
nn_test_config.


Configuration files:
=================
ga_server_config:
=================

This file controls the parameters of the genetic algorithm. Most of the 
parameters are mandatory. All the values need to be in the next line below the 
parameter name, followed by an enter (newline).


poblation
This is number of neural networks it would test per generation. Please keep in 
mind that every network requires two process slots to run, so the upper value 
for this will be different for every distribution (I tested with up to 180 and 
works fine).

generations
The maximum number of generations the system works.

level
The error level. In case the error of any neural network becomes below this 
value, the system exits. This parameter is a bit tricky, since the error is the 
sum of all errors in the testing phase (I mean square errors). Just put a low 
value if you want to pass all the generations.

base
The ratio between the best and worse fitness (corresponding to the best and 
worse network). This imply that the best network have base-times more chance to 
breed.

boost
This is the relative influence of the size of the network. It affect the fitness 
value in an inverse exponential way. For example, if boost is equal to one and 
we have 2 networks having the same error, but one is the biggest one, and the 
other is the smallest one in the set, the big one have just 37% (1 / e) of the 
fitness value of the small one. If your not sure, keep it in zero.

max_neuron_mut
The maximum number of neurons that could be added / deleted per network per 
generation in an event of mutation (Note that I said “could”)

mut_new_prob
The probability of getting a whole new offspring (a newly generated random 
network) instead of a child.

mut_neuron_prob
Probability of mutation of a single neuron. This mutation could affect one of 
the parameters of the neuron.

agregation
If zero, the system generates a set for search a solution.
If different of zero, then agregation is the number of outputs to  be added to 
a current solution. This require the result* files of  a previous search. 
(Please make a backup of your result files, since this would be changed if 
aggregation is over zero).

init_preffix
Name preffix for the init (blueprint) of the neural networks: init0 is the 
blueprint for neural network 0, init1 for the neural network 1, and so on.

result_preffix
Similar to init_preffix, but this is the resulting (trained) network.

mut_net_prob
The probability of mutation of a whole network. Mutation would add or delete up 
to max_neuron_mut neurons.

max_num_layer
Maximum number of layers for the starting poblation (including input and output 
layer)

max_num_neuron
Maximum number of neurons per layer for the starting poblation (Not including 
input an output layer).

prob_alpha
prob_conv_rate
prob_bias_corr
prob_delta_type
prob_momentum
prob_num_con
prob_bias
In the event of a neuron mutation, one parameter of the neuron got changed. 
These values are their relative probability of get selected to change. If they 
are equal, then they have equal probability to being selected.

ip
Bind address ip, in num-doted format (xxx.xxx.xxx.xxx). This is the ip where 
remote clients connect.

local_server_port
The port for incoming remote client connections

remote_server_port
Listening port for the ga_server_remote daemon, which spawns the 	remote clients.

hostX
X should be a number (starting with zero, and going up). This is a list of ip of 
remote machines ip, in num-doted format, running the ga_server_remote daemon to 
activate remote clients. If there just one host, remove this parameter.

nicheX
X should be a number (starting with zero, and going up). This is a list of ip of 
remote machines ip, in num-doted format, running the ga_server_remote daemon to 
run remote niches. If there just one niche, remove this parameter.

master
In case of more than one niche, a master niche (who starts everything) must 
exist, so in a multi niche model, the master niche should be a 1, and the other
must be set to zero.
	
==== END OF SECTION ga_server_config ====

================
nn_train_config:
================
This file sets the rules for the neural network under training. Format is equal 
to any other configuration file, values goes below parameter name.

num_pat
This is the number of training patterns. 

num_input
This is the number of elements in the input layer.

num_output
This is the number of elements in the output layer. If agregation is over zero, 
then this number should be the new number of outputs.

trainning
Training flag (note the wrong spell). Zero means no training (no learning), one 
means training, 2 means production. Because this file is for the training phase, 
this value need to be one.

input_preffix
Input file names are designed by a prefix and a number in this way. For example, 
if “num_pat” is 30, and the input_preffix is “input”, then input file names 
would be: input0, input1, input2 ... input28, input29.

Input file content format is simple, just put values in a stack, I mean values 
are separated by the newline character ('\n'). Don't add comments or any text, 
just the input values. For example if the input is formed by the values: “0, 
0.5, 3, 2.5”, Input file content should look like:

0
0.5
3
2.5

Note that there aren't spaces at the beginning of the file.


output_preffix
Similar to input_preffix. Content also is similar to output, with one 
limitation: input values could be any floating point value (In the “C float” 
range). Output is limited to values between zero and one, because of the 
threshold function

==== END OF SECTION nn_train_config ====

==============
nn_test_config
==============
It's very similar to the nn_config file, indeed it could be a carbon copy if you 
want (in such case, you will be testing the network with the training inputs and 
outputs), except for the training value, this need to be zero in this case.

Please consult the example config files for further information. Or you could 
email me: cvn62@yahoo.com

