I'm experimenting with GAs. I'm using a Dict to keep tabs on the population and fitness, and I wanted to try using a parallel algorithm to initially populate the Dict.
function pAddQGen( n::Int, dct::Dict{ Array{Int,1}, Float64 }, len::Int=4000, lim::Int=5 )
lst = [ randOrthGen( len, lim, false ) for i = 1 : n ]
function enter( gen:: Array{Int,1}, fit::Float64 )
dct[ gen ] = fit
end
fits = pmap( getQGenFit, lst )
map( enter, lst, fits )
end
The function
randOrthGen just generates a random genome, and
getQGenFit evaluates its fitness. When I test this withpAddQGen( 2, testD, 10, 2 )
as a batch job on the mainframe it seems to run fine, but when I try it with len=4000 it produces the error.
As you've probably grown tired of hearing me say, I'm not a real programmer, so feel free to tell me I'm doing everything all wrong.