Christmas: Slices Of Slices

Over Christmas, I built a prototype version of the genetic algorithm that uses binary values. I fixed most issues but I am currently having a problem with the crossover function of the genetic algorithm. It seems that Go has no convenient way of appending or merging elements from two slices of slices.

Currently I have created a matrix that represents the whole population. It’s a simple slices of slices that forms a matrix (e.g. [][]genePopulation). Each slice in the matrix represents an individual from the population and it’s sub-slice defines that individuals chromosome. During genetic crossover, the genes from each individuals chromosome are swapped at certain points to create hybrids of the individuals which are referred to as the children. Doing this crossover efficiently in a slice of slices is proving a challenge. What needs to be done is grab two slices from the [][]genePopulation, then pick a point within the two slices at which the elements from one [:3]slice, will be merged with the elements  from another [3:]slice to create a new child. Attempts have been made using the inbuilt functions for merge and append which have all failed. Attempts to manually do this through new slices proved troublesome as the assignment operator passes a reference to the subsection of the old slices which leads to the overwriting of the values for individuals in the population.

When I deal with this problem, I can then focus on parallelising the genetic algorithm and getting the HFC (Hierarchical Fair Competition) structure of the algorithm implemented. The planned completion date for this is this week.

Comments   

0 #2 Jon Kerridge 2014-01-21 13:35
This reminds me of a protocol due Valliant called Bulk Synchronous Protocol
Quote
0 #1 Jon Kerridge 2014-01-21 13:33
At last somehting I can comment on!
Please tell me about these problems because it will help when it comes to writing up because you will not have to try and remember what problems you fixed.

I would suggest you use a deep copy mecahnism to get the algorithm working and then worry about a more efficient mecahnism.

There are much more interesting aspects to the parallelisation than worrying about this.

Please keep the blog up to date and put in the other problems you have already fixed.

Remeber you only have a fixed number of cores. Use the cores fopr large components, any smaller scale parallelism is probably not worthwhile because it will take longer to set up the parallel than do it sequentially. You will need to justify this in your report!

for each level until finished
go that level
swap data between levels

good luck
Quote

Add comment


Security code
Refresh