LIRRA  1.0.0
Loading...
Searching...
No Matches
rl_stl.synthesis.check Namespace Reference

Classes

class  CheckResult
 
class  CompiledWindows
 

Functions

float interval_robustness (RecedingProblem problem, np.ndarray X, History history, int|None root_age, int first_window)
 
CompiledWindows compiled_windows (RecedingProblem problem, int first_window)
 
CheckResult check_plan (RecedingProblem problem, np.ndarray x0, np.ndarray X, np.ndarray U, History history, int|None root_age=None, int first_window=0, float tol=1e-6)
 

Detailed Description

Independent check of a candidate plan against the receding I-STL constraints.

Used for two purposes with one definition:

* validation of every solver plan before it is installed (recompute robustness
  independently of the solver), and
* the runtime check of a learned proposal: a proposal passes iff it is a feasible point of
  the same synthesis problem, so accepting it keeps the recursive-feasibility argument
  intact without solving.

Written separately from :mod:`rl_stl.synthesis.istl` (plain recursion over the ``stlpy``
tree, no Gurobi). ``rho_lower`` is the interval lower robustness of the enforced windows
with the semantics of the MILP: a planned predicate contributes
``a^T y_i - b - |a^T C| z(o+i)``; a constant history/root sample contributes ``+inf`` if it
meets its threshold and ``-inf`` otherwise. ``rho_lower >= delta`` (and bounds, dynamics and
the terminal block) is the acceptance condition.

An interval predicate ``[a]^T y - [b]`` (:class:`~rl_stl.stl.interval.IntervalPredicate`) contributes
the lower endpoint of its value over ``[a] x [b]`` and the sample box ``[C x_i - |C| z(o+i),
C x_i + |C| z(o+i)]`` (the I-STL lower bound, paper eq. (margin)); a constant sample is Boolean on the
lower endpoint with box radius 0 (measured, threshold 0) or ``|C| z(age)`` (cached plan, threshold
``delta``), as in the MILP.

:class:`CompiledWindows` evaluates the same semantics with numpy gathers compiled once per
``(problem, first_window)`` (a table of predicate values per sample, then one gather and one
min/max per tree level, as in :mod:`rl_stl.stl.jax_robustness`); :func:`interval_robustness`
is the plain recursion kept as the reference implementation (tests check they agree).

Function Documentation

◆ check_plan()

CheckResult rl_stl.synthesis.check.check_plan ( RecedingProblem  problem,
np.ndarray  x0,
np.ndarray  X,
np.ndarray  U,
History  history,
int | None   root_age = None,
int   first_window = 0,
float   tol = 1e-6 
)
Feasibility of ``(X, U)`` for the request ``(x0, history, root_age, first_window)``.

◆ compiled_windows()

CompiledWindows rl_stl.synthesis.check.compiled_windows ( RecedingProblem  problem,
int  first_window 
)

◆ interval_robustness()

float rl_stl.synthesis.check.interval_robustness ( RecedingProblem  problem,
np.ndarray  X,
History  history,
int | None  root_age,
int  first_window 
)
``rho_lower`` of the enforced windows (see module docstring).