Thank you, I tested with multithreading using the thread number and its working, I had some problems multithreading with the simulator in the past so that is why I was also asking about how to run the parallel master-slave process in one computer, but multithreading is working fine now.
> If your plan is to run multiple simulators, I'd fire them up during ECJ's startup sequence.
Yes, my plan is to start the same number of simulators as evaluation threads in ECJ's startup sequence by using the java ProcessBuilder class, and then terminate them all when all generations of the evolutionary algorithm have been completed. According to section 2.7.1 of the manual this can be done in the state setup and finisher classes, is the number of evaluation threads available for this classes?
From: ECJ Evolutionary Computation Toolkit <[log in to unmask]> on behalf of Sean Luke <[log in to unmask]>
Sent: Monday, December 8, 2014 10:48 PM
To: [log in to unmask]
Subject: Re: Parallel evaluation with robot simulators
On Dec 4, 2014, at 10:10 AM, Rodrigo Moreno Garcia <[log in to unmask]> wrote:
> Is there a way to identify different threads in the multithread case so that one thread would only control one simulator instance at a time?
If ECJ spawns threads, it assigns each a unique number starting at 0. (if it's a single thread, the thread number is 0). This number is primarily used to identify which random number generator to use (there's an array of them) in the given thread. Many functions are passed the thread number, and you can use that to determine which thread you're in.
Otherwise, you can always use Thread.currentThread().getID() to give you a unique identifier but I would not rely on it because in-between generations there is no guarantee that you won't wind up with all new threads.
> or is there a way to know in which slave a problem is running in the parallel process case?
You can probably use Java APIs to determine what process ID and machine IP address your slave is running on. But I'm not sure why you'd really need this.
> Can the master-slave parallel process system be run on one computer or should it be always used in a cluster?
It can easily be run on a single computer. It's not efficient though -- I'd stick with multithreaded evaluation. If your plan is to run multiple simulators, I'd fire them up during ECJ's startup sequence.
I've made some tweaks to Section 2.7.2 of the manual discussing multithreaded evaluation and simulators. I think it might be useful to you -- check it out via SVN.