org.objectweb.proactive.branchnbound.core
Class Worker

java.lang.Object
  extended byorg.objectweb.proactive.branchnbound.core.Worker
All Implemented Interfaces:
java.io.Serializable

public class Worker
extends java.lang.Object
implements java.io.Serializable

***FOR INTERNAL USE ONLY

Author:
Alexandre di Costanzo Created on Apr 25, 2005
See Also:
Serialized Form

Field Summary
protected static org.apache.log4j.Logger logger
           
 
Constructor Summary
Worker()
          The active object empty constructor.
Worker(TaskQueue taskProvider)
          Construct a new worker with a reference on a task queue.
 
Method Summary
 void alive()
          Pinging the current worker.
 Result execute(Task task)
          Start the computation of the given task.
 Result getBestCurrentResult()
           
 Task getCurrentTask()
           
 void immediateStopComputation()
          Stop the current task computation.
 void informNewBestResult(Result newBest)
          Broadcast the best new localy found solution to all task and to the task queue.
 BooleanWrapper isHungry()
           
 void reset()
          Reset the worker for a new computation.
 void sendSubTasksToTheManager(java.util.Vector subTaskList)
          Add a set of sub-task to the task queue.
 void setBestCurrentResult(Result newBest)
          Update the best local result with the new one.
 void setWorkerGroup(Worker workerGroup)
          Set the group of this worker.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static org.apache.log4j.Logger logger
Constructor Detail

Worker

public Worker()
The active object empty constructor.


Worker

public Worker(TaskQueue taskProvider)
Construct a new worker with a reference on a task queue.

Parameters:
taskProvider - this task queue.
Method Detail

execute

public Result execute(Task task)
Start the computation of the given task.

Parameters:
task - the task to compute.
Returns:
the result or a result with the exception.

setWorkerGroup

public void setWorkerGroup(Worker workerGroup)
Set the group of this worker.

Parameters:
workerGroup - the group of workers.

setBestCurrentResult

public void setBestCurrentResult(Result newBest)
Update the best local result with the new one. If the new best result is no the best, nothing is did.

Parameters:
newBest - a new best result.

getBestCurrentResult

public Result getBestCurrentResult()
Returns:
the best local result.

informNewBestResult

public void informNewBestResult(Result newBest)
Broadcast the best new localy found solution to all task and to the task queue.

Parameters:
newBest - the best new solution.

sendSubTasksToTheManager

public void sendSubTasksToTheManager(java.util.Vector subTaskList)
Add a set of sub-task to the task queue.

Parameters:
subTaskList - the set of sub-tasks.

isHungry

public BooleanWrapper isHungry()
Returns:
true if the task queue needs more tasks.

immediateStopComputation

public void immediateStopComputation()
Stop the current task computation.


getCurrentTask

public Task getCurrentTask()
Returns:
the current task.

alive

public void alive()
Pinging the current worker.


reset

public void reset()
Reset the worker for a new computation.



Copyright 2001-2005 INRIA All Rights Reserved.