Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: Easily Implementation of a Genetic Algorithm Mutation function
Replies: 2   Last Post: Dec 28, 2012 11:32 AM

 Messages: [ Previous | Next ]
 Michael Doukas Posts: 12 Registered: 12/26/12
Easily Implementation of a Genetic Algorithm Mutation function
Posted: Dec 28, 2012 8:31 AM

Hello everybody,

I am developing a simple Genetic Algorithm for a project of mine and i have reached the point where i want to mutate the current individuals of the population.

With help from this forum, i have created a script that generates the initial population. The script is as follows:

init_val_of_columns = [1,4,6,9,13,24,26,28,41,54];
N = length(init_val_of_columns)-1;
M = 40;
Individuals = floor(repmat(diff(init_val_of_columns),M,1).*rand(M,N))+repmat(init_val_of_columns(1:N),M,1);

The script generates a 40x9 matrix, with values constrained for each cell (columnwise) as defined by variable init_val_of_columns.

Therefore, for that population i want the mutation to happen (with probability mutP=0.8/N for each element of the each row), and store the resulting offsprings in a matrix called e.g. NewChromosomes.

What i want is for the resulting chromosomes to obey the ranges imposed by init_val_of_columns (in order to have feasible solutions).