Class StrixHelper
- java.lang.Object
-
- solvers.StrixHelper
-
public class StrixHelper extends Object
Bridge to the external Strix reactive-synthesis tool, used by AuRUS to check the realisability of a candidate specification — thestatus(S')component of the fitness function.Every
checkRealizability/executeStrixoverload does the same three things: (1) turn the specification into the plain-text arguments Strix expects, (2) launch Strix as an external process — either the native binary or, whenSettings.USE_DOCKERis set, therun-docker-strix.sh/run-docker-spectra.shwrapper — and (3) parse its stdout for theREALIZABLEverdict, enforcingSettings.STRIX_TIMEOUT. The two input formats supported — TLSF/LTL and Spectra — are dispatched onSettings.USE_SPECTRA.Which path actually runs by default (no Docker, no Spectra). The TLSF specification is not shelled out to
syfcofor translation. Instead,checkRealizability(Tlsf)simplifies the formula in Java (SyntacticSimplifier), renders it to Strix's LTL syntax (SolverUtils.toSolverSyntax), extracts the input/output signal lists, and calls the 3-argumentexecuteStrix(String, String, String), which invokeslib/new_strix/strixdirectly.Pluggable synthesiser (Docker-free alternative). Setting
Settings.SYNTH_TOOL = "ltlsynt"(flag-synth=ltlsynt) makesexecuteStrix(String, String, String)— used by both the TLSF and Spectra realisability checks — dispatch toltlsyntinstead of Strix, a tool installable directly (e.g.brew install spoton macOS, orconda install -c conda-forge spoton Linux/macOS — see spot.lre.epita.fr/install.html for a Debian/Ubuntu package repository), with no Docker and no architecture-specific vendored binary.- Author:
- Matías Brizzio
- See Also:
Settings,AutomataBasedModelCountingSpecificationFitness.compute_status(geneticalgorithm.SpecificationChromosome)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStrixHelper.RealizabilitySolverResultOutcome of a Strix realisability query.
-
Constructor Summary
Constructors Constructor Description StrixHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StrixHelper.RealizabilitySolverResultcheckRealizability(String tlsf)Parses the given TLSF text and checks its realisability.static StrixHelper.RealizabilitySolverResultcheckRealizability(owl.ltl.spectra.Spectra spectra)Checks the realisability of a Spectra specification object directly (as opposed tocheckRealizability(Tlsf)'s TLSF-to-Spectra conversion path): renders its formula to Strix syntax, extracts the input/output signal lists under the same contiguous-run convention described in the class documentation, and dispatches toexecuteStrix(String, String, String).static StrixHelper.RealizabilitySolverResultcheckRealizability(owl.ltl.tlsf.Tlsf tlsf)Checks the realisability of a parsed TLSF specification.static StrixHelper.RealizabilitySolverResultexecuteStrix(String path)Runs the Spectra CLI on an already-written.spectrafile, dispatching onSettings.USE_DOCKER.static StrixHelper.RealizabilitySolverResultexecuteStrix(String formula, String ins, String outs)Runs the configured realisability/synthesis tool (Settings.SYNTH_TOOL, flag-synth) on an LTL formula plus explicit input/output signal lists, and returns its verdict.
-
-
-
Method Detail
-
checkRealizability
public static StrixHelper.RealizabilitySolverResult checkRealizability(String tlsf) throws IOException, InterruptedException
Parses the given TLSF text and checks its realisability.- Parameters:
tlsf- the specification, in TLSF syntax- Returns:
- the realisability verdict
- Throws:
IOException- if launching Strix failsInterruptedException- if the Strix process is interrupted
-
checkRealizability
public static StrixHelper.RealizabilitySolverResult checkRealizability(owl.ltl.tlsf.Tlsf tlsf) throws IOException, InterruptedException
Checks the realisability of a parsed TLSF specification.When
Settings.USE_SPECTRAis set, the specification is first converted to Spectra syntax (TlsfUtils.tlsf2spectra) and written to a.spectrafile underSettings.SPECTRA_PATH, then checked viaexecuteStrix(String). Otherwise the formula is simplified and rendered to Strix's LTL syntax directly in Java, and checked viaexecuteStrix(String, String, String), which internally dispatches onSettings.SYNTH_TOOL(Strix, or the Docker-freeltlsyntalternative) — see that method's documentation.- Parameters:
tlsf- the specification to check- Returns:
- the realisability verdict
- Throws:
IOException- if launching Strix failsInterruptedException- if the Strix process is interrupted
-
executeStrix
public static StrixHelper.RealizabilitySolverResult executeStrix(String path) throws IOException, InterruptedException
Runs the Spectra CLI on an already-written.spectrafile, dispatching onSettings.USE_DOCKER. This method is only ever called from the Spectra branch ofcheckRealizability(Tlsf); TLSF/native realisability checks go throughexecuteStrix(String, String, String)instead.On timeout the process is destroyed and a cleanup script (
run-docker-stop.sh) is launched to stop any leftover Docker container. Otherwise, stdout is scanned line by line for the verdict — a line containing"realizable"but not"unrealizable"— and stderr output, if any, downgrades the result toStrixHelper.RealizabilitySolverResult.ERROR.- Parameters:
path- path to the.spectrafile to check- Returns:
- the realisability verdict
- Throws:
IOException- if launching the process failsInterruptedException- if the process is interrupted while waiting
-
checkRealizability
public static StrixHelper.RealizabilitySolverResult checkRealizability(owl.ltl.spectra.Spectra spectra) throws IOException, InterruptedException
Checks the realisability of a Spectra specification object directly (as opposed tocheckRealizability(Tlsf)'s TLSF-to-Spectra conversion path): renders its formula to Strix syntax, extracts the input/output signal lists under the same contiguous-run convention described in the class documentation, and dispatches toexecuteStrix(String, String, String).- Parameters:
spectra- the Spectra specification to check- Returns:
- the realisability verdict
- Throws:
IOException- if launching Strix failsInterruptedException- if the Strix process is interrupted
-
executeStrix
public static StrixHelper.RealizabilitySolverResult executeStrix(String formula, String ins, String outs) throws IOException, InterruptedException
Runs the configured realisability/synthesis tool (Settings.SYNTH_TOOL, flag-synth) on an LTL formula plus explicit input/output signal lists, and returns its verdict.Only the command line differs per tool; everything else — timeout handling, stdout/stderr scanning, resource cleanup — is shared:
strix(default): the nativelib/new_strix/strixbinary, or./run-docker-strix.shwhenSettings.USE_DOCKERis set. Empty signal lists are passed as the literal""Strix's argument parser expects.ltlsynt(flag-synth=ltlsynt): a Docker-free alternative from the Spot library, installable viabrew install spot(macOS) orconda install -c conda-forge spot— see spot.lre.epita.fr/install.html for Debian/Ubuntu packages. Resolved fromPATHunlessSettings.SYNTH_BINoverrides it. Invoked with--realizability, which suppresses controller synthesis.
Both tools print a bare
REALIZABLE/UNREALIZABLEline as their realisability verdict, so a single stdout scan covers both. A verdict found on stdout takes precedence over incidental stderr output — stderr only downgrades the result toStrixHelper.RealizabilitySolverResult.ERRORwhen no verdict was found on stdout, so a tool that writes harmless notices to stderr on a successful run is not misread as having failed.- Parameters:
formula- the specification's formula, in Strix/Spot LTL syntaxins- comma-separated list of input signal names (empty string if none)outs- comma-separated list of output signal names (empty string if none)- Returns:
- the realisability verdict
- Throws:
IOException- if launching the tool fails (e.g. not installed)InterruptedException- if the process is interrupted while waiting
-
-