rtac.ac_functionalities.rtac_data
This module contains data structures needed for the RTAC.
Functions
|
Class factory to return the initialized class with data structures appropriate to the RTAC method scenario.ac. |
Classes
|
Enumeration for the RAC methods. |
|
Abstract class to handle picklable data structures needed to coordinate and process tournaments. |
|
Represents a binary parameter with optional default. |
|
Represents a categorical parameter with optional default. |
|
Represents a Configuration. |
|
Represents a continuous (real) parameter with optional default, sampling behavior, and distributional assumptions. |
|
Represents a discrete (integer) parameter with optional default, sampling behavior, and distributional assumptions. |
|
Enumeration for the distribution types to draw random values from. |
|
Class to handle picklable data structures needed to coordinate and process tournaments of the Gray-Box implementation. |
|
Enumeration for configuration generator type. |
|
Enumeration for the meaning of the interim output: Whether increase or decrease signifies progress. |
|
Enumeration for the parameter type to be generated. |
|
Enumeration for the parameter type to be generated. |
|
Class to handle picklable data structures needed to coordinate and process tournaments of the ReACTR implementation. |
|
Class to handle picklable data structures needed to coordinate and process tournaments of the ReACTR++ implementation. |
|
Represents a target algorithm run. |
|
Enumeration for the state of the configuration run. |
|
Represents the stats of a tournament. |
|
Enumeration for the type of values randomly generated. |
- class rtac.ac_functionalities.rtac_data.ACMethod(value)
Bases:
EnumEnumeration 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:
ABCAbstract 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:
objectRepresents 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
- 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:
objectRepresents 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
- values: list[str | int]
- class rtac.ac_functionalities.rtac_data.Configuration(id: UUID, conf: dict, features: list, gen: Generator, gen_tourn: int)
Bases:
objectRepresents 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_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:
objectRepresents 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:
objectRepresents 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:
EnumEnumeration 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:
RTACDataClass 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:
- class rtac.ac_functionalities.rtac_data.Generator(value)
Bases:
EnumEnumeration 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:
EnumEnumeration 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:
EnumEnumeration 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:
EnumEnumeration 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:
AbstractRTACDataClass 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:
RTACDataClass 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:
objectRepresents 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:
EnumEnumeration 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:
objectRepresents 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:
EnumEnumeration 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: