|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectec.eval.MasterProblemServer
public class MasterProblemServer
MasterProblemServer.java
The server awaits for incoming slaves to connect. Upon one such connection is established, the server creates and starts a worker thread to manage all the incoming communication from this slave.
Parameters
| eval.master.port int |
(the port where the slaves will connect) |
| eval.compression boolean |
(whether the communication with the slaves should be compressed or not) |
| eval.masterproblem.max-jobs-per-slave int |
(the maximum load (number of jobs) per slave at any point in time) |
| Field Summary | |
|---|---|
java.net.ServerSocket |
servSock
The socket where slaves connect. |
SlaveMonitor |
slaveMonitor
|
EvolutionState |
state
|
boolean |
useCompression
Indicates whether compression is used over the socket IO streams. |
| Fields inherited from interface ec.eval.IMasterProblemServer |
|---|
P_EVALCOMPRESSION, P_EVALMASTERPORT, P_MAXIMUMACTIVESLAVES, P_MAXIMUMNUMBEROFCONCURRENTJOBSPERSLAVE |
| Constructor Summary | |
|---|---|
MasterProblemServer()
zero-argument constructor for deserialization |
|
MasterProblemServer(boolean showDebugInfo)
|
|
| Method Summary | |
|---|---|
boolean |
evaluatedIndividualAvailable()
|
QueueIndividual |
getEvaluatedIndividual(EvolutionState state)
|
int |
numAvailableSlaves()
Returns the number of available slave (not busy) |
QueueIndividual |
pollNextEvaluatedIndividual(EvolutionState state,
long timeoutInMilliseconds)
Polls for the next evaluated individual. |
void |
run()
The run method waits for incoming slaves, and launches new worker threads (one per incoming slave) to handle the communication with the slave. |
void |
scheduleJobForEvaluation(EvolutionState state,
Job ed)
Schedules a remote evaluation. |
void |
setJobSize(int jobSize)
A hint as to the maximum number of jobs per slave task. |
void |
setupServerFromDatabase(EvolutionState state)
After the MasterProblemServer is created, it needs to be told to initialize itself from information in the parameter database. |
void |
shutdown()
Indicates that the background thread is to shut down and closes the server socket. |
java.lang.Thread |
spawnThread()
Creates and starts a background thread for this server. |
void |
waitForAllSlavesToFinishEvaluating(EvolutionState state)
Wait for remote evaluation to complete. |
Individual |
waitForIndividual(EvolutionState state)
Wait for one individual to complete evaluation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public SlaveMonitor slaveMonitor
public java.net.ServerSocket servSock
public boolean useCompression
public EvolutionState state
| Constructor Detail |
|---|
public MasterProblemServer()
public MasterProblemServer(boolean showDebugInfo)
| Method Detail |
|---|
public void setJobSize(int jobSize)
IMasterProblemServer
setJobSize in interface IMasterProblemServerpublic void setupServerFromDatabase(EvolutionState state)
setupServerFromDatabase in interface IMasterProblemServerstate - the evolution statepublic void shutdown()
shutdown in interface IMasterProblemServerpublic int numAvailableSlaves()
IMasterProblemServer
numAvailableSlaves in interface IMasterProblemServerpublic boolean evaluatedIndividualAvailable()
evaluatedIndividualAvailable in interface IMasterProblemServer
public void scheduleJobForEvaluation(EvolutionState state,
Job ed)
IMasterProblemServer
scheduleJobForEvaluation in interface IMasterProblemServerstate - Evolution stateed - Evaluation data for one individual or grouppublic void waitForAllSlavesToFinishEvaluating(EvolutionState state)
IMasterProblemServer
waitForAllSlavesToFinishEvaluating in interface IMasterProblemServerpublic Individual waitForIndividual(EvolutionState state)
IMasterProblemServer
waitForIndividual in interface IMasterProblemServerpublic QueueIndividual getEvaluatedIndividual(EvolutionState state)
getEvaluatedIndividual in interface IMasterProblemServer
public QueueIndividual pollNextEvaluatedIndividual(EvolutionState state,
long timeoutInMilliseconds)
IMasterProblemServer
pollNextEvaluatedIndividual in interface IMasterProblemServertimeoutInMilliseconds - Timeout for individual to be received
QueueIndividual, or null if no individual is received before the timeout.public void run()
run in interface java.lang.Runnablepublic java.lang.Thread spawnThread()
spawnThread in interface IMasterProblemServer
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||