selector.tournament_bookkeeping

This module contains functions for bookkeeping of tournaments.

Functions

get_get_tournament_membership_with_ray_id(...)

For a Ray task ID, return the tournament it belongs to.

get_tasks(taskdic, tasks)

Map back a Ray object to the configuration/instance pair.

get_tournament_membership(tournaments, conf)

For a list of tournaments, determine which ones a configuration is a member of.

termination_check(termination_criterion, ...)

Check the termination criterion for the main tournament loop and return True if the criterion is not met yet.

update_tasks(tasks, next_task, tournament, ...)

Update tasks and add new tasks if needed.

selector.tournament_bookkeeping.get_get_tournament_membership_with_ray_id(task_id, tournaments)[source]

For a Ray task ID, return the tournament it belongs to.

Parameters:
  • task_id (object) – The Ray task ID.

  • tournaments (list) – List of tournaments.

Returns:

The tournament the task ID belongs to.

Return type:

selector.pool.Tournament

selector.tournament_bookkeeping.get_tasks(taskdic, tasks)[source]

Map back a Ray object to the configuration/instance pair.

Parameters:
  • taskdic (dict) – Nested dictionary of the form {conf: {instance: ray object}}.

  • tasks (list) – List of Ray objects that are currently running.

Returns:

List of [conf, instance] pairs that are currently running.

Return type:

list

selector.tournament_bookkeeping.get_tournament_membership(tournaments, conf)[source]

For a list of tournaments, determine which ones a configuration is a member of.

Parameters:
  • tournaments (list) – List of tournaments.

  • conf (object) – Configuration.

Returns:

Tournaments the configuration is a member of.

Return type:

list

selector.tournament_bookkeeping.termination_check(termination_criterion, main_loop_start, total_runtime, total_tournament_number, tournament_counter)[source]

Check the termination criterion for the main tournament loop and return True if the criterion is not met yet.

Parameters:
  • termination_criterion (str) – Termination criterion for the tournament main loop.

  • main_loop_start (int) – Time of the start of the tournament main loop.

  • total_runtime (int, optional) – Total runtime for the main loop when the termination criterion is “total_runtime”.

  • total_tournament_number (int, optional) – Total number of tournaments for the main loop when the termination criterion is “total_tournament_number”.

  • tournament_counter (int) – Number of tournaments that have already finished.

Returns:

True if the termination criterion is not met, False otherwise.

Return type:

bool

selector.tournament_bookkeeping.update_tasks(tasks, next_task, tournament, global_cache, ta_wrapper, scenario)[source]

Update tasks and add new tasks if needed.

Parameters:
  • tasks (list) – List of Ray objects.

  • next_task (list) – List of [conf, instance] pairs.

  • tournament (object) – Tournament the next task is part of.

  • global_cache (object) – Ray cache.

  • ta_wrapper (object) – Target algorithm wrapper.

  • scenario (object) – Scenario configuration.

Returns:

Updated list of Ray objects.

Return type:

list