rtac.wrapper.abstract_wrapper
The abstract target algorithm runner class is defined in this module.
Classes
Abstract target algorithm wrapper class. |
- class rtac.wrapper.abstract_wrapper.AbstractWrapper[source]
Bases:
ABCAbstract target algorithm wrapper class.
- abstract check_if_solved(ta_output: bytes, nnr: non_block_read, proc: Popen) tuple[int | float, float, int] | None[source]
Bytes output of the subprocess.Popen process running the target algorithm is checked to determine if the problem instance is solved.
- Parameters:
ta_output (bytes) – Output of the target algorithm.
nnr (non_nlock_read) – Non-blocking read function for accessing the subprocess.PIPE output of the target algorithm.
proc (subprocess.Popen) – Target algorithm run via subprocess.Popen process.
- Returns:
result : int | float, Objective value.
time : float, Runtime needed.
event : int, 0 or 1, if solved.
- Return type:
tuple or None
- abstract start(params: Any, timelimit: int, instance: str) tuple[subprocess.Popen, int][source]
Start the target algorithm via subprocess.Popen with stdout to subprocess.PIPE.
- Parameters:
params (Any) – Parameters in a format as needed for target algorithm.
timelimit (int) – Maximum runtime allowed for target algorithm run in seconds.
instance (str) – Path to problem instance.
- Returns:
proc : subbrocess.Process, The process started with the target algorithm
proc_cpu_time : int, CPU time of the subprocess.
- Return type:
tuple
- abstract translate_config(config: Configuration) Any[source]
Convert dictionary representation of the configuration to the format needed by the wrapper to pass to the target algorithm.
- Parameters:
config (Configuration) – Configuration object of parameter values to run problem instance with.
- Returns:
Any form of the configuration that is needed by the target algorithm.
- Return type:
Any