Ceci est une ancienne révision du document !
EvaluatorControl and Evaluation Queue
Evaluation Queue
The EvaluatorControl
manages the evaluations. It has a queue of EvalQueuePoints
which are points that need to be evaluated. The points are generated by SearchMethods
, PollMethods
, or other Steps
derived from IterationUtils
. The EvaluatorControl
also handles the Evaluator(s).
The queue is implemented by a vector.
Sorting the Queue
Points may be ordered before evaluation. This is useful for opportunistic evaluation, more so when there is little CPU available (few threads for OpenMP).
There are multiple sorting criteria: DIR_LAST_SUCCESS
, LEXICOGRAPHICAL
, RANDOM
, SURROGATE
; others like QUAD_MODEL
should be added. See parameter EVAL_QUEUE_SORT
.
The default is DIR_LAST_SUCCESS
.
Evaluation of Points
The way the EvaluatorControl
is implemented, the points at the end of the vector are evaluated first - they have the greatest priority.
Points are taken by threads for evaluation. As soon as a thread is done evaluating a point, it is free, and it pops the next point in the queue.
When a point is evaluated, updates are done:
- If opportunism is used, a
FULL_SUCCESS
will stop evaluations. Evaluations that are already in progress will continue, but no new evaluation will be started. Eval
of the point, i.e., evaluation information, is updated in the cache.- The stats to be displayed are updated.
- Some members of
EvaluatorControl
, like the counter for the number of evaluations, are updated.
Main thread(s) and secondary threads
OpenMP computes the number of available threads and uses them all, unless NB_THREADS_OPENMP
is set, in which case this number of threads is used. There is one main thread, which is thread number 0. The other threads are secondary threads. The main threads is the only one that generates points and adds them to the evaluation queue; it is also used for evaluations. The secondary threads are used solely to run the blackbox for evaluating points.
When evaluations are done because all points in the queue are evaluated, or because of opportunism, only the main thread exits from the EvaluatorControl's run
method. The secondary threads keep looping inside the run
methods while waiting for new points to evaluate.
In the case of PSD-Mads
, there is more than one main thread. Each subproblem has its own main thread that generate points and manages algorithms. There can still be additional secondary threads for evaluation only.