|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectec.eval.SlaveMonitor
public class SlaveMonitor
SlaveMonitor.java The SlaveMonitor is the main tool used by the evolutionary computation process to synchronize the work of multiple threads (for example, for different slaves). The monitor is in charge of keeping track of all the slaves (either those that are busy with various jobs they have received, or those that are available to perform jobs on behalf of the main evolutionary process). Additionally, the monitor provides methods to schedule a job to be executed by the next available slave, as well as a mechanism to wait until all jobs have been finished.
| Field Summary | |
|---|---|
static java.lang.String |
P_EVALCOMPRESSION
|
static java.lang.String |
P_EVALMASTERPORT
|
static java.lang.String |
P_MAXIMUMNUMBEROFCONCURRENTJOBSPERSLAVE
|
java.net.ServerSocket |
servSock
The socket where slaves connect. |
EvolutionState |
state
|
boolean |
useCompression
Indicates whether compression is used over the socket IO streams. |
| Constructor Summary | |
|---|---|
SlaveMonitor(boolean showDebugInfo,
int maxJobsPerSlave)
Simple constructor that initializes the data structures for keeping track of the state of each slave. |
|
| Method Summary | |
|---|---|
boolean |
evaluatedIndividualAvailable()
|
QueueIndividual |
getEvaluatedIndividual()
Blocks until an individual comes available |
QueueIndividual |
getNextAvailableIndividual()
Returns null if there is no such individual, else returns the next individual. |
void |
notifyMonitor(java.lang.Object monitor)
|
int |
numAvailableSlaves()
Returns the number of available slave (not busy) |
void |
registerSlave(EvolutionState state,
java.lang.String name,
java.net.Socket socket,
java.io.DataOutputStream out,
java.io.DataInputStream in)
Registers a new slave with the monitor. |
void |
scheduleJobForEvaluation(EvolutionState state,
Job job)
Schedules a job for execution on one of the available slaves. |
void |
shutdown()
Shuts down the slave monitor (also shuts down all slaves). |
void |
unregisterSlave(ec.eval.SlaveConnection slave)
Unregisters a dead slave from the monitor. |
void |
waitForAllSlavesToFinishEvaluating(EvolutionState state)
This method returns only when all slaves have finished the jobs that they were assigned. |
Individual |
waitForIndividual()
|
boolean |
waitOnMonitor(java.lang.Object monitor)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String P_EVALMASTERPORT
public static final java.lang.String P_EVALCOMPRESSION
public static final java.lang.String P_MAXIMUMNUMBEROFCONCURRENTJOBSPERSLAVE
public EvolutionState state
public java.net.ServerSocket servSock
public boolean useCompression
| Constructor Detail |
|---|
public SlaveMonitor(boolean showDebugInfo,
int maxJobsPerSlave)
| Method Detail |
|---|
public boolean waitOnMonitor(java.lang.Object monitor)
public void notifyMonitor(java.lang.Object monitor)
public void registerSlave(EvolutionState state,
java.lang.String name,
java.net.Socket socket,
java.io.DataOutputStream out,
java.io.DataInputStream in)
public void unregisterSlave(ec.eval.SlaveConnection slave)
public void shutdown()
public void scheduleJobForEvaluation(EvolutionState state,
Job job)
public void waitForAllSlavesToFinishEvaluating(EvolutionState state)
public boolean evaluatedIndividualAvailable()
public int numAvailableSlaves()
public QueueIndividual getNextAvailableIndividual()
public QueueIndividual getEvaluatedIndividual()
public Individual waitForIndividual()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||