rtac.wrapper.tsp
This module implements the target algorithm wrapper for CaDiCaL 1.2.1.
Classes
|
Python-TSP Wrapper for cost minimization scenario. |
|
Python-TSP Wrapper for cost minimization scenario. |
|
Python-TSP Wrapper for runtime minimization scenario. |
|
Python-TSP Wrapper for runtime minimization scenario. |
- class rtac.wrapper.tsp.TSP_Q[source]
Bases:
TSP_RTPython-TSP Wrapper for cost minimization scenario. Annealing factor is not fixed. If TA is much faster than the time limit but still yields a better solution it is not a problem.
- translate_config(config: Configuration) list[str][source]
Overriding TSP_RT function: Convert dictionary representation of the configuration to a list of parameter name and value alternating.
- Parameters:
config (Configuration) – Configuration object – parameter values to run the problem instance with.
- Returns:
List representation of the configuration with parameter names and values alternating.
- Return type:
list of str
- class rtac.wrapper.tsp.TSP_Qpp[source]
Bases:
TSP_QPython-TSP Wrapper for cost minimization scenario. Annealing factor is not fixed. If TA is much faster than the time limit but still yields a better solution it is not a problem. Additional functions for ReACTR++ implementation.
- check_output(ta_output) list[float] | None[source]
Parse runtime output of the target algorithm.
- Parameters:
ta_output (bytes) – Output of the target algorithm.
- Returns:
List of intermediate output values if provided by the target algorithm.
- Return type:
list of float or None
- interim_info() list[rtac.ac_functionalities.rtac_data.InterimMeaning][source]
Gives information about whether a higher or a lower level of the entry is a sign of higher quality of the configuration regarding the target algorithm run.
- Returns:
Indicates if a higher or lower value is better.
- Return type:
list of InterimMeaning or None
- class rtac.wrapper.tsp.TSP_RT[source]
Bases:
AbstractWrapperPython-TSP Wrapper for runtime minimization scenario. Annealing factor ‘a’ is fixed to have a fair comparison of runtime performance.
- check_if_solved(ta_output: bytes, nnr: non_block_read, proc: Popen) tuple[int | float, float, int] | None[source]
Check the bytes output of the subprocess.Popen process running CaDiCaL 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.
proc (subprocess.Popen) – Target algorithm run via subprocess.Popen process.
- Returns:
Target algorithm result (1 if solved, 0 otherwise), runtime needed, and event (0 or 1, indicating if solved), or None if no result.
- Return type:
tuple of (int or float, float, int) or None
- start(config: Any, timeout: int, instance: str) tuple[subprocess.Popen, int][source]
Start CaDiCaL via subprocess.Popen with stdout set to subprocess.PIPE, using the given configuration on the specified instance with a time limit.
- Parameters:
config (Any) – Parameters in the format required by the target algorithm.
timeout (int) – Maximum runtime allowed for the target algorithm run in seconds.
instance (str) – Path to the problem instance.
- Returns:
Target algorithm subprocess.Popen process and the start time of the process.
- Return type:
tuple of (subprocess.Popen, int)
- translate_config(config: Configuration) list[str][source]
Convert dictionary representation of the configuration to a list of parameter names and values alternating.
- Parameters:
config (Configuration) – Configuration object - parameter values to run problem instance with.
- Returns:
List of strings representation of the configuration.
- Return type:
list of str
- class rtac.wrapper.tsp.TSP_RTpp[source]
Bases:
TSP_RTPython-TSP Wrapper for runtime minimization scenario. Annealing factor ‘a’ is fixed to have a fair comparison of runtime performance. Additional functions for ReACTR++ implementation.
- check_output(ta_output: bytes) list[float] | None[source]
Parse runtime output of the target algorithm.
- Parameters:
ta_output (bytes) – Output of the target algorithm.
- Returns:
List of intermediate output values if provided by the target algorithm.
- Return type:
list of float or None
- interim_info() list[rtac.ac_functionalities.rtac_data.InterimMeaning][source]
Gives information about whether a higher or a lower level of the entry is a sign of higher quality of the configuration regarding the target algorithm run.
- Returns:
Indicates if a higher or lower value is better.
- Return type:
list of InterimMeaning or None