Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thread error #57

Open
epochstamp opened this issue Jul 6, 2014 · 1 comment
Open

Thread error #57

epochstamp opened this issue Jul 6, 2014 · 1 comment
Labels

Comments

@epochstamp
Copy link

Hi,

I have some trouble using pyevolve's multiprocessing. Specifically, I have issue with threads. This is the error that I get :

...
File "build/bdist.linux-x86_64/egg/pyevolve/GSimpleGA.py", line 824, in evolve
File "build/bdist.linux-x86_64/egg/pyevolve/GSimpleGA.py", line 668, in step
File "build/bdist.linux-x86_64/egg/pyevolve/GPopulation.py", line 365, in evaluate
File "/usr/lib64/python2.7/multiprocessing/init.py", line 232, in Pool
return Pool(processes, initializer, initargs, maxtasksperchild)
File "/usr/lib64/python2.7/multiprocessing/pool.py", line 184, in init
self._result_handler.start()
File "/usr/lib64/python2.7/threading.py", line 746, in start
_start_new_thread(self.__bootstrap, ())
thread.error: can't start new thread

I don't think that my code is involved in this error, but just in case :

eval func =>
def eval_gen(seq):

len_seq = len(seq)
j = 0
state = [0,0,0,0]
pmin = float("+inf")
while j < len_seq and not(is_terminal(state)) :
    a = 5 if seq[j] == 0 else -5 
    state = compute_next_state(a,state)
    cost = d(state)
    if cost <= pmin:
        pmin = cost
    j += 1
return pmin + j

GA =>

ga = GSimpleGA.GSimpleGA(genome,interactiveMode=False)
ga.setGenerations(50)
ga.setMinimax(Consts.minimaxType["minimize"])
ga.setCrossoverRate(0.5)
ga.setMutationRate(0.1)
ga.setPopulationSize(20)
ga.setMultiProcessing(True)
genome.evaluator.set(eval_gen)
ga.evolve()
seq = ga.bestIndividual()

Thanks for you help!

@epochstamp
Copy link
Author

PS : except the pyevolve part (I mean the method ga.evolve()), all the code is monothread.

@perone perone added the bug label Jul 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants