rtac.ac_functionalities.tournament_manager

This module contans classes for touenament management according to the RTAC method used.

Functions

tourn_manager_factory(scenario, ta_runner, ...)

Class factory to return the initialized TournamentManager class appropriate to the RTAC method scenario.ac.

Classes

AbstractTournamentManager(scenario, ...)

Abstract tournament manager class.

GrayBox()

This class contains functions needed for the gray-box functionality of the tournament manager classes.

TournamentManager(scenario, ta_runner, logs, ...)

Tournament manager class for the ReACTR implementation.

TournamentManagerCPPL(scenario, ta_runner, ...)

Tournament manager class for the CPPL implementation.

class rtac.ac_functionalities.tournament_manager.AbstractTournamentManager(scenario: Namespace, ta_runner: BaseTARunner, logs: RTACLogs, rtac_data: RTACData | RTACDatapp)[source]

Bases: ABC

Abstract tournament manager class.

Parameters:
  • scenario (argparse.Namespace) – Namespace containing all settings for the RTAC.

  • ta_runner (BaseTARunner) – Target algorithm runner object.

  • logs (RTACLogs) – Object containing loggers and logging functions.

  • rtac_data (RTACData | RTACDatapp) – Object containing data and objects necessary throughout the RTAC modules.

adjust_time_results(rtac_data: RTACData | RTACDatapp) None[source]

Adjusts the time results of the early tournament by the time that was saved from the early starting.

Parameters:

rtac_data (RTACData | RTACDatapp) – Object containing data and objects necessary throughout the RTAC modules.

Return type:

None

general_logging(scenario: Namespace | None = None, rtac_data: RTACData | RTACDatapp | None = None, tournamentstats: TournamentStats | None = None, tourn_nr: int | None = None, tournament: Tournament | Tournamentpp | None = None, early_tourn: bool = False, instance: str | None = None) None[source]

Carries out logging of general information about the tournament.

Parameters:
  • scenario (argparse.Namespace) – Namespace containing all settings for the RTAC.

  • rtac_data (RTACData | RTACDatapp) – Object containing data and objects necessary throughout the RTAC modules.

  • tournamentstats (TournamentStats) – Stats summarizing the tournament results.

  • tourn_nr (int) – Number of the tournament.

  • tournament (Tournament | Tournamentpp) – Tournament object.

  • early_tourn (bool) – True if tournament starts early, Flase if not.

  • instance (str) – ID of the problem instance to be solved.

Return type:

None

get_tourn_nr(rtac_data: RTACData | RTACDatapp) None[source]

Get the number of the tournament to be logged.

Parameters:

rtac_data (RTACData | RTACDatapp) – Object containing data and objects necessary throughout the RTAC modules.

Return type:

None

manage_tournament(instance: str, rtac_data: RTACData | RTACDatapp) None[source]

Manages the procedure of the tournament.

Parameters:
  • instance (str) – Path to the problem instance to solve.

  • rtac_data (RTACData | RTACDatapp) – Object containing data and objects necessary throughout the RTAC modules.

Return type:

None

set_tourn_status(tournamentstats: TournamentStats, rtac_data: RTACData | RTACDatapp, tournament: Tournament | Tournamentpp) TournamentStats[source]

Setting the results of the tournament and status of the target algorithm runs to rtac_data.TournamentStats.

Parameters:
Returns:

Stats summarizing the tournament results.

Return type:

TournamentStats

abstract solve_instance(instance: str, rtac_data: RTACData | RTACDatapp, next_instance: str = None, rtac: RTAC = None) RTACData[source]

Solve the problem instance according to the RTAC method used.

Parameters:
  • instance (str) – Path to the problem instance to solve.

  • rtac_data (RTACData | RTACDatapp) – Object containing data and objects necessary throughout the RTAC modules.

  • next_instance (str) – Problem instance ID. Degaults to None.

  • rtac (RTAC) – The self reference of rtac.rtac.RTAC to enable the tournament manager to start a tournament run ftom RTAC.

Returns:

Updated object containing data and objects necessary throughout the RTAC modules.

Return type:

RTACData

class rtac.ac_functionalities.tournament_manager.GrayBox[source]

Bases: object

This class contains functions needed for the gray-box functionality of the tournament manager classes.

early_start(currenttime: float) None[source]

Starts early tournament with only as many contenders as were terminated by the gray-box model.

Parameters:

currenttime (float) – Time in the tournament at which contenders were terminated.

Return type:

None

es_output(instance: str) None[source]

Prints info from early tournament to terminal.

Parameters:

instance (int) – ID of the instance to be solved in the early starting tournament.

Return type:

None

fill_early_tournament() None[source]

Manages and starts the remaining contenders in the early tournament.

Return type:

None

manage_tournament(instance: str, rtac_data: RTACData | RTACDatapp, **kwargs) None[source]

Manages the procedure of the tournament. Runs early tournament if CPU cores were freed by the gray-box model.

Parameters:
  • instance (str) – Path to the problem instance to solve.

  • rtac_data (RTACData | RTACDatapp) – Object containing data and objects necessary throughout the RTAC modules.

  • **kwargs – Additional keyword arguments that vary by RTAC method.

Return type:

None

train_gray_box_model() None[source]

Train gray-box modelö with the total data gathered so far.

Return type:

None

wait_for_event() None[source]

Waits for the tournament to finish and triggers the start of the remaining cores in the early tournament.

Return type:

None

class rtac.ac_functionalities.tournament_manager.TournamentManager(scenario: Namespace, ta_runner: BaseTARunner, logs: RTACLogs, rtac_data: RTACData | RTACDatapp)[source]

Bases: AbstractTournamentManager

Tournament manager class for the ReACTR implementation.

solve_instance(instance: str, rtac_data: RTACData | RTACDatapp, **kwargs) RTACData[source]

Solving the problem instance according to the ReACTR implementation.

Parameters:
  • instance (str) – Path to the problem instance to solve.

  • rtac_data (RTACData | RTACDatapp) – Object containing data and objects necessary throughout the rtac modules.

  • **kwargs – Additional keyword arguments that vary by RTAC method.

Returns:

Updated object containing data and objects necessary throughout the rtac modules.

Return type:

RTACData

class rtac.ac_functionalities.tournament_manager.TournamentManagerCPPL(scenario: Namespace, ta_runner: BaseTARunner, logs: RTACLogs, rtac_data: RTACData | RTACDatapp)[source]

Bases: AbstractTournamentManager

Tournament manager class for the CPPL implementation.

solve_instance(instance: str, rtac_data: RTACData | RTACDatapp, **kwargs) RTACData[source]

Solving the problem instance according to the CPPL implementation.

Parameters:
  • instance (str) – Path to the problem instance to solve.

  • rtac_data (RTACData | RTACDatapp) – Object containing data and objects necessary throughout the rtac modules.

  • **kwargs – Additional keyword arguments that vary by RTAC method.

Returns:

Updated object containing data and objects necessary throughout the rtac modules.

Return type:

RTACData

rtac.ac_functionalities.tournament_manager.tourn_manager_factory(scenario: Namespace, ta_runner: BaseTARunner, logs: RTACLogs, rtac_data: RTACData | RTACDatapp) TournamentManager | TournamentManagerCPPL[source]

Class factory to return the initialized TournamentManager class appropriate to the RTAC method scenario.ac.

Parameters:
  • scenario (argparse.Namespace) – Namespace containing all settings for the RTAC.

  • ta_runner (BaseTARunner) – Target algorithm runner object.

  • logs (RTACLogs) – Object containing loggers and logging functions.

  • rtac_data (RTACData | RTACDatapp) – Object containing data and objects necessary throughout the RTAC modules.

Returns:

Initialized TournamentManager object matching the RTAC method of the scenario.

Return type:

TournamentManager or TournamentManagerCPPL