rtac.ac_functionalities.rtac_data

This module contains data structures needed for the RTAC.

Functions

rtacdata_factory(scenario, **kwargs)

Class factory to return the initialized class with data structures appropriate to the RTAC method scenario.ac.

Classes

ACMethod(value)

Enumeration for the RAC methods.

AbstractRTACData(scenario)

Abstract class to handle picklable data structures needed to coordinate and process tournaments.

BinaryParameter(paramtype, default, valtype, ...)

Represents a binary parameter with optional default.

CategoricalParameter(paramtype, flag, ...)

Represents a categorical parameter with optional default.

Configuration(id, conf, features, gen, gen_tourn)

Represents a Configuration.

ContinuousParameter(paramtype, minval, maxval)

Represents a continuous (real) parameter with optional default, sampling behavior, and distributional assumptions.

DiscreteParameter(paramtype, minval, maxval)

Represents a discrete (integer) parameter with optional default, sampling behavior, and distributional assumptions.

Distribution(value)

Enumeration for the distribution types to draw random values from.

GBData(scenario, rtacdata_init, **kwargs)

Class to handle picklable data structures needed to coordinate and process tournaments of the Gray-Box implementation.

Generator(value)

Enumeration for configuration generator type.

InterimMeaning(value)

Enumeration for the meaning of the interim output: Whether increase or decrease signifies progress.

ParamType(value)

Enumeration for the parameter type to be generated.

Parameter(value)

Enumeration for the parameter type to be generated.

RTACData(scenario, **kwargs)

Class to handle picklable data structures needed to coordinate and process tournaments of the ReACTR implementation.

RTACDatapp(scenario, **kwargs)

Class to handle picklable data structures needed to coordinate and process tournaments of the ReACTR++ implementation.

TARun(config_id, config, res, time, status)

Represents a target algorithm run.

TARunStatus(value)

Enumeration for the state of the configuration run.

TournamentStats(id, tourn_nr, configs, ...)

Represents the stats of a tournament.

ValType(value)

Enumeration for the type of values randomly generated.

class rtac.ac_functionalities.rtac_data.ACMethod(value)

Bases: Enum

Enumeration for the RAC methods.

Members

ReACTRint

Represents the ‘ReACTR’ option.

ReACTRppint

Represents the ‘ReACTR++’ option.

CPPLint

Represents the ‘CPPL’ option.

CPPL = 3
ReACTR = 1
ReACTRpp = 2
class rtac.ac_functionalities.rtac_data.AbstractRTACData(scenario: Namespace)

Bases: ABC

Abstract class to handle picklable data structures needed to coordinate and process tournaments.

Parameters:

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

class rtac.ac_functionalities.rtac_data.BinaryParameter(paramtype: str, default: str | int | None, valtype: ~rtac.ac_functionalities.rtac_data.ValType = ValType.int, values: list[str | int] = <factory>)

Bases: object

Represents a binary parameter with optional default.

Parameters:
  • paramtype (str) – A string identifying the type of parameter.

  • default (str | int, optional) – Default value used, if specified.

  • valtype (ValType) – Identifies the value type.

  • values (list[str | int]) – List of the possible values the parameter can assume.

paramtype: str
valtype: ValType = 2
values: list[str | int]
class rtac.ac_functionalities.rtac_data.CategoricalParameter(paramtype: str, flag: bool = False, valtype: ~rtac.ac_functionalities.rtac_data.ValType = ValType.str, default: str | int | None = None, minval: int | None = None, maxval: int | None = None, values: list[str | int] = <factory>)

Bases: object

Represents a categorical parameter with optional default.

Parameters:
  • paramtype (str) – A string identifying the type of parameter.

  • flag (bool) – True if parameter is a flag, False if not.

  • valtype (ValType) – Identifies the value type.

  • default (str | int, optional) – Default value used, if specified.

  • minval (int, optional) – Minimum allowed value for the parameter.

  • maxval (int, optional) – Maximum allowed value for the parameter.

  • values (list[str | int]) – List of the possible values the parameter can assume.

flag: bool = False
maxval: int | None = None
minval: int | None = None
paramtype: str
valtype: ValType = 1
values: list[str | int]
class rtac.ac_functionalities.rtac_data.Configuration(id: UUID, conf: dict, features: list, gen: Generator, gen_tourn: int)

Bases: object

Represents a Configuration.

Parameters:
  • id (UUID) – Unique identifier.

  • conf (dict) – Dictionary with parameter name as key and parameter value as value.

  • features (list) – Features associated with the configuration.

  • gen (Generator) – Configuration generator type used to generate this configuration.

  • gen_tourn (int) – Tournament number in which the configuration was generated.

conf: dict
features: list
gen: Generator
gen_tourn: int
id: UUID
class rtac.ac_functionalities.rtac_data.ContinuousParameter(paramtype: str, minval: float, maxval: float, default: float | None = None, splitbydefault: bool | None = None, distribution: Distribution | None = Distribution.uniform, logonpos: bool | None = False, logonneg: bool | None = False, probabpos: float | None = 0.49, probabneg: float | None = 0.49, includezero: bool | None = False, probabilityzero: float | None = 0.02)

Bases: object

Represents a continuous (real) parameter with optional default, sampling behavior, and distributional assumptions.

Parameters:
  • paramtype (str) – A string identifying the type of parameter.

  • minval (int) – Minimum allowed value for the parameter.

  • maxval (int) – Maximum allowed value for the parameter.

  • default (int, optional) – Default value used, if specified.

  • splitbydefault (bool, optional) – If True, use the default to split the parameter range for logarithmic distribution draws.

  • distribution (Distribution, optional) – Distribution used for sampling (e.g., uniform, triangular). Defaults to uniform.

  • logonpos (bool, optional) – If True, apply logarithmic sampling on the positive part of the parameter range.

  • logonneg (bool, optional) – If True, apply logarithmic sampling on the negative part of the parameter range.

  • probabpos (float, optional) – Probability of sampling from positive part of the range.

  • probabneg (float, optional) – Probability of sampling from negative part of the range.

  • includezero (bool, optional) – If True, include zero as a possible sampled value.

  • probabilityzero (float, optional) – Probability of sampling zero if includezero is True.

distribution: Distribution | None = 1
includezero: bool | None = False
logonneg: bool | None = False
logonpos: bool | None = False
maxval: float
minval: float
paramtype: str
probabilityzero: float | None = 0.02
probabneg: float | None = 0.49
probabpos: float | None = 0.49
splitbydefault: bool | None = None
class rtac.ac_functionalities.rtac_data.DiscreteParameter(paramtype: str, minval: int, maxval: int, default: int | None = None, splitbydefault: bool | None = False, distribution: Distribution | None = Distribution.uniform, logonpos: bool | None = False, logonneg: bool | None = False, probabpos: float | None = 0.49, probabneg: float | None = 0.49, includezero: bool | None = False, probabilityzero: float | None = 0.02)

Bases: object

Represents a discrete (integer) parameter with optional default, sampling behavior, and distributional assumptions.

Parameters:
  • paramtype (str) – A string identifying the type of parameter.

  • minval (int) – Minimum allowed value for the parameter.

  • maxval (int) – Maximum allowed value for the parameter.

  • default (int, optional) – Default value used, if specified.

  • splitbydefault (bool, optional) – If True, use the default to split the parameter range for logarithmic distribution draws.

  • distribution (Distribution, optional) – Distribution used for sampling (e.g., uniform, triangular). Defaults to uniform.

  • logonpos (bool, optional) – If True, apply logarithmic sampling on the positive part of the parameter range.

  • logonneg (bool, optional) – If True, apply logarithmic sampling on the negative part of the parameter range.

  • probabpos (float, optional) – Probability of sampling from positive part of the range.

  • probabneg (float, optional) – Probability of sampling from negative part of the range.

  • includezero (bool, optional) – If True, include zero as a possible sampled value.

  • probabilityzero (float, optional) – Probability of sampling zero if includezero is True.

distribution: Distribution | None = 1
includezero: bool | None = False
logonneg: bool | None = False
logonpos: bool | None = False
maxval: int
minval: int
paramtype: str
probabilityzero: float | None = 0.02
probabneg: float | None = 0.49
probabpos: float | None = 0.49
splitbydefault: bool | None = False
class rtac.ac_functionalities.rtac_data.Distribution(value)

Bases: Enum

Enumeration for the distribution types to draw random values from.

Members

uniformint

Represents the uniform distribution option.

logint

Represents the logarithmic distribution option.

log = 2
uniform = 1
class rtac.ac_functionalities.rtac_data.GBData(scenario: Namespace, rtacdata_init: __init__, **kwargs)

Bases: RTACData

Class to handle picklable data structures needed to coordinate and process tournaments of the Gray-Box implementation.

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

  • rtacdata_init (AbstractRTACData.__init__) – __init__ of the parent class.

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

early_rtac_copy()

Returns a modified copy of self to be used in an early starting tournament after terminations by gray box.

Returns:

A modified copy of itself to be used in an early starting tournament after terminations by gray box.

Return type:

AbstractRTACData

class rtac.ac_functionalities.rtac_data.Generator(value)

Bases: Enum

Enumeration for configuration generator type.

Members

defaultDiscreteParameter

Represents the default configuration generator.

randomContinuousParameter

Represents the random configuration generator.

crossoverCategoricalParameter

Represents the genetic crossover configuration generator.

cpplBinaryParameter

Represents the surrogate-assisted genetic crossover configuration generator in CPPL.

cppl = 3
crossover = 2
random = 1
class rtac.ac_functionalities.rtac_data.InterimMeaning(value)

Bases: Enum

Enumeration for the meaning of the interim output: Whether increase or decrease signifies progress. Only used in ReACTR++.

Members

increaseDiscreteParameter

Represents that increase of the value is progress.

decreaseContinuousParameter

Represents that decrease of the value is progress.

decrease = 2
increase = 1
class rtac.ac_functionalities.rtac_data.ParamType(value)

Bases: Enum

Enumeration for the parameter type to be generated.

Members

discreteint

Represents the string option.

continuousint

Represents the integer option.

categoricalint

Represents the string option.

binaryint

Represents the integer option.

binary = 4
categorical = 3
continuous = 2
discrete = 1
class rtac.ac_functionalities.rtac_data.Parameter(value)

Bases: Enum

Enumeration for the parameter type to be generated.

Members

discreteDiscreteParameter

Represents an string parameter.

continuousContinuousParameter

Represents an integer parameter.

categoricalCategoricalParameter

Represents an string parameter.

binaryBinaryParameter

Represents an integer parameter.

binary = <class 'rtac.ac_functionalities.rtac_data.BinaryParameter'>
categorical = <class 'rtac.ac_functionalities.rtac_data.CategoricalParameter'>
continuous = <class 'rtac.ac_functionalities.rtac_data.ContinuousParameter'>
discrete = <class 'rtac.ac_functionalities.rtac_data.DiscreteParameter'>
class rtac.ac_functionalities.rtac_data.RTACData(scenario: Namespace, **kwargs)

Bases: AbstractRTACData

Class to handle picklable data structures needed to coordinate and process tournaments of the ReACTR implementation.

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

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

class rtac.ac_functionalities.rtac_data.RTACDatapp(scenario: Namespace, **kwargs)

Bases: RTACData

Class to handle picklable data structures needed to coordinate and process tournaments of the ReACTR++ implementation.

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

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

class rtac.ac_functionalities.rtac_data.TARun(config_id: str, config: dict, res: int | float, time: float, status: TARunStatus)

Bases: object

Represents a target algorithm run.

Parameters:
  • config_id (str) – Unique identifier derived from an UUID.

  • config (dict) – Dictionary with parameter name as key and parameter value as value.

  • res (int | float) – Tournament result (objective value) of the target algorithm run.

  • time (float) – Time when the target algorithm run stopped. Set to time limit if the configuration did not solve the problem instance.

  • status (TARunStatus) – State of the configuration.

config: dict
config_id: str
res: int | float
status: TARunStatus
time: float
class rtac.ac_functionalities.rtac_data.TARunStatus(value)

Bases: Enum

Enumeration for the state of the configuration run.

Members

runningDiscreteParameter

Configuration is started and running.

finishedContinuousParameter

Configuration has finished the problem instance.

cappedCategoricalParameter

Configuration run has been terminated due to another configuration being finished.

terminatedBinaryParameter

Configuration has been terminated by gray box.

timeoutBinaryParameter

Configuration has been terminated because the time limit has been reached

awaiting_startBinaryParameter

Configuration has not been started yet in an early starting tournament.

awaiting_start = 6
capped = 3
finished = 2
running = 1
terminated = 4
timeout = 5
class rtac.ac_functionalities.rtac_data.TournamentStats(id: ~uuid.UUID, tourn_nr: int, configs: list[uuid.UUID], winner: str, results: list[int | float], times: list[float], rtac_times: list[float], kills: list[uuid.UUID], TARuns: dict[slice(<class 'str'>, <class 'rtac.ac_functionalities.rtac_data.TARun'>, None)])

Bases: object

Represents the stats of a tournament.

Parameters:
  • id (str) – Unique identifier derived from an UUID.

  • tourn_nr (int) – Number of the tournament since RTAC init.

  • configs (list[UUID]) – List of configuration IDs in the tournament.

  • winner (str) – ID of the tournament winner.

  • results (list[int | float]) – Objective values of the contenders.

  • times (list[float]) – Runtimes of the contenders.

  • rtac_times (list[float]) – Runtimes of the contenders + overhead of the configurator during the tournament.

  • kills (list[UUID]) – IDs of the contenders terminated by the gray box.

  • TARuns (dict[str: TARun]) – List of TARun objects corresponding to ‘configs’.

TARuns: dict[slice(<class 'str'>, <class 'rtac.ac_functionalities.rtac_data.TARun'>, None)]
configs: list[uuid.UUID]
id: UUID
kills: list[uuid.UUID]
results: list[int | float]
rtac_times: list[float]
times: list[float]
tourn_nr: int
winner: str
class rtac.ac_functionalities.rtac_data.ValType(value)

Bases: Enum

Enumeration for the type of values randomly generated.

Members

strint

Represents the string option.

intint

Represents the integer option.

int = 2
str = 1
rtac.ac_functionalities.rtac_data.rtacdata_factory(scenario: Namespace, **kwargs) RTACData | RTACDatapp

Class factory to return the initialized class with data structures appropriate to the RTAC method scenario.ac.

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

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

Returns:

Initialized AbstractRTACData object matching the RTAC method of the scenario.

Return type:

RTACData or RTACDatapp