Title self explainitory :)
I've been trying to create a population of individuals each of which contains a string/or array of numbers.
For example: Individual A: 110010101101
then basically * 100 to get 100 copies.
I need to be able to call each individual and then call each element of the individual so i can mutate them.
here is what i tryed out:
Output is our Individual, and contains 21 int's of (1,0)Code:
void GetPopulation(int (&Output), int (&Pop)[PopSize])
for ( index = 0; index < PopSize; index++)
for ( j = 0; j < 21; j++)
Out = Output[j];
Pop[index][j] = Pop[index][Out];
cout << Pop[index][j];
I was hoping the code would populate 100 arrays Pop[index]
each of which would contain a copy of the original individual
Then try and print out what is in the arrays: ie
Pop[1st ind][1-21] = "01010101010101" etc
then on to the next ad infinitum.
Sadly it only prints out "0" then crashes at the end :)
Output and Pop are both declared in Main()
Popsize is defined as 100
Is there anything grossly wrong,
And i understand that there maybe better ways of doing it, ie someone suggesting Vectors etc but until i learn about them i'd rather stick with plain old arrays :D
Unless i fundementally have to change it :(
Thanks for any help