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

Classes

class  History
 
class  ISTLCache
 
class  ISTLResult
 
class  ISTLSettings
 
class  RecedingISTL
 
class  RecedingProblem
 

Functions

tuple _pred_key (LinearPredicate pred)
 

Detailed Description

Receding fixed-horizon interval-STL synthesis (NAHS (16)) with Gurobi.

At planning step ``t`` the problem is rooted at a state ``x_0`` (measured, or a cached plan's
nominal state when the solve is delay compensated) and plans ``N`` inputs::

    min   sum_{i=1}^{N_c} gamma0^i || W_x (x_i - x_nom_i) ||_1 + w_u sum_i || u_i - u_nom_i ||_1
    s.t.  x_{i+1} = A x_i + B u_i
          x_i in [x_lo + z(o+i), x_hi - z(o+i)],  u_i in [u_lo + kz(o+i), u_hi - kz(o+i)]
          every enforced window of (history ++ C x_1..C x_N) satisfies psi, where a predicate
            a^T y - b at planned step i holds iff a^T C x_i - b >= delta + |a^T C| z(o+i)
          the last b states lie in one face set Q_f of the verified terminal set

``z`` is the interval hull of the error tube (:mod:`rl_stl.synthesis.tube`), ``o`` the
tube age of the root (0 for a measured root). History samples are constants; each has its
own threshold (0 for measured samples: Boolean satisfaction; ``delta + |a| z(age)`` for samples
of a cached plan that have not been measured yet). This is the interval robustness lower
bound of NAHS Sec. 7.1 with the robustness constraint hard (``xi = 0`` in Theorem 2).

Signal layout (see :mod:`rl_stl.stl.nahs`): ``L = h + N`` samples, local index ``j``;
``j = 0..h-2`` history, ``j = h-1`` the root, ``j = h-1+i`` planned step ``i``. The formula is
``psi`` at window starts ``s = first_window .. N-1``.

Encoding: every (node, sample) gets a continuous "holds" variable ``h in [0, 1]``; ``and``
nodes require ``h <= h_child``, ``or`` nodes ``h <= sum h_child``; predicates at planned
samples are binaries with a big-M row; predicates at history samples are binaries fixed by
bounds. A positive ``h`` forces a satisfied predicate below it, so the feasible set is
exactly the set of plans satisfying the thresholded formula; binaries =
``#predicates x #samples`` independent of the number of windows. The model is built once per
:class:`RecedingProblem` and per ``first_window``; every request only changes bounds, RHS
values, fixed binaries and the objective's reference (:meth:`RecedingISTL.update`).

Interval predicates (``_u`` specs). For an :class:`~rl_stl.stl.interval.IntervalPredicate`
``[a]^T y - [b] >= 0`` at planned step ``i`` the sample is the box ``[y_i] = [c - r, c + r]`` with
``c = C x_i`` and ``r = |C| z(o+i)`` (paper eq. (margin)), and the predicate holds iff its lower endpoint

    lower(c, r) = sum_j min(a_lo_j c_j - |a_lo_j| r_j, a_hi_j c_j - |a_hi_j| r_j) - b_hi >= delta.

(:mod:`rl_stl.stl.interval`: the exact minimum over ``[a] x [y] x [b]``.) ``lower`` is concave in ``c``,
so one continuous ``t_j`` per signal coordinate with ``t_j <= a_lo_j c_j - |a_lo_j| r_j`` and
``t_j <= a_hi_j c_j - |a_hi_j| r_j`` (RHS ``-|a| r`` set per request) and the big-M row
``sum_j t_j - b_hi >= delta - M (1 - z)`` encode ``z = 1 => lower >= delta`` exactly (``t_j`` can be
raised to the minimum when ``z = 1``; any ``t_j`` at or below it works when ``z = 0``). ``t_j`` is bounded
below by ``l_j = min_{a, c corners} a c - max|a| r_max`` over the untightened state box and the widest
tube ``r_max = |C| z_inf``, which every admissible ``t_j`` value (in particular the minimum itself)
satisfies, so ``M = delta + b_hi - sum_j l_j`` makes the row inactive for ``z = 0``. History and root
samples are constants: their binary is fixed to ``lower(y, r_age) >= thr`` (``r = 0``, ``thr = 0`` for
measured samples; ``r = |C| z(age)``, ``thr = delta + numerical_margin / 2`` for cached-plan samples: they
were planned with ``delta + numerical_margin`` and the half margin absorbs the rounding of the recomputed
lower endpoint, so the shifted cached plan stays a feasible point). Exact predicates keep the encoding
above unchanged, including their cached-plan threshold ``delta + numerical_margin``: a cached sample whose
recomputed value rounds just below it gets its binary fixed to 0, which occasionally makes a delay-
compensated request infeasible although its warm start passes the check.

Every returned plan is re-checked by :func:`rl_stl.synthesis.check.check_plan`, an
independent numpy implementation of the same constraints, before it may be used.

Function Documentation

◆ _pred_key()

tuple rl_stl.synthesis.istl._pred_key ( LinearPredicate  pred)
protected