SparseMax-dSTL: Sound Robustness with Horizon-Independent Gradient Allocation for Temporal Logic Trajectory Optimization
A gradient-based solver that enforces a Signal Temporal Logic (STL) specification uses a smooth approximation of its quantitative semantics, the robustness. In safety-critical trajectory optimization, this approximation must have two properties.
From the abstract. Our summary is in progress.
Full paper
SparseMax-dSTL: Sound Robustness with Horizon-Independent Gradient Allocation for Temporal Logic Trajectory Optimization
Published under CC BY 4.0. Reproduced with attribution; original at arXiv:2610.23837 (PDF).
Abstract
A gradient-based solver that enforces a Signal Temporal Logic (STL) specification uses a smooth approximation of its quantitative semantics, the robustness. In safety-critical trajectory optimization, this approximation must have two properties. First, it must be sound, that is, nonnegative only on trajectories that satisfy the specification. Second, at each temporal operator, the weight of its gradient on the violating samples must stay bounded away from zero, however long the horizon. The approximations in use, including the log-sum-exp, its sound variant, and the generalized-mean robustness, do not have both. We introduce lower approximations of the minimum and the maximum whose gradients are sparsemax projections, and we prove that the robustness built from them has both. It lies below the exact robustness and is therefore sound, and its error has a bound that is independent of the number of samples and known before optimization. The gradient of each approximation is exactly zero on every sample beyond a data-dependent threshold, so the weight on violating samples a gap beyond the others has a positive lower bound at every horizon. On a planar unicycle and on a seven-joint manipulator beside a person in simulation, the log-sum-exp approximation is positive on a violating trajectory. As the horizon of the manipulator’s task grows from 10 to 80 s, the gradient weight of the sound variant on the violating samples falls from 0.22 to 0.04, while that of sparsemax stays at 1. In a constrained trajectory optimization of the unicycle, the constraint on the log-sum-exp robustness returns a violating trajectory, whereas the constraint on the sparsemax robustness returns a trajectory that satisfies the specification with the required margin.
I Introduction
A gradient-based solver that enforces a signal temporal logic (STL) specification as a constraint does not evaluate the specification itself. STL assigns trajectories a scalar robustness, a nesting of minima and maxima over predicates and time samples whose sign determines satisfaction [1, 2]. The nesting is nonsmooth, so the solver differentiates a smooth surrogate of every extremum [3, 4] and accepts a trajectory as feasible when the resulting smoothed robustness is nonnegative. The surrogate therefore determines which trajectories the solver accepts as feasible and how its gradient is allocated among the time samples.
Consider a robot manipulator that hands a part to a person. Its STL specification requires that it stay out of the zone into which the person reaches until it has picked the part, keep a minimum separation from the person, and move slowly near the person. The first requirement is an until operator, whose left operand (stay out of the zone) must hold until its right operand (the pick) holds at some sample of a time window. Each sample of the window is a witness, and the robustness of the operator is a maximum over its witnesses. A trajectory that crosses the zone for a third of a second before the pick violates the specification at fewer than twenty of the hundreds or thousands of samples in the horizon, while the manipulator waits at the zone boundary for the rest. Figure 1(a) sketches such a trajectory with nine samples. A smoothed robustness that constrains such a trajectory must have two properties. First, it must be sound, that is, negative on every violating trajectory. Second, its gradient allocation, the weight that its gradient places on each sample, must not vanish on the violating samples as the waiting time grows. A policy gradient or a gradient-based safety filter that differentiates the robustness needs the same two properties.
-0.02, 0.04 from the zone and -1, 0.8, 0.8 at the pick, \varepsilon=0.07 per node. (b) The prefix minimum on the simplex of the class weights (illustrative, not to scale): the values z push the centre (equal weights) by -z/\gamma, and the nearest point of the simplex gives the sparsemax weights; the LSE weights lie inside, the GMR weights sum to 0.90 (dashed). (c) Values against the exact \rho and (d) weight per class at the prefix minimum of (b); GMR of order (-10,10).The smoothing techniques in use today provide at most the first. The log-sum-exp (LSE) robustness [5] replaces the maximum of m sample values z=(z_{1},\ldots,z_{m}) by \beta^{-1}\log\sum_{i}e^{\beta z_{i}} with a parameter \beta>0. It exceeds the maximum by up to \log m/\beta [6], attained when all values are equal, and it can be nonnegative on a violating trajectory [7]. We call this smoothing the plain LSE. We show that an until operator produces such ties when the deepest violation of its left operand precedes the window, so the plain LSE robustness is positive on a shallow violation. Sound measures remove that defect. The softmax-mean measure under-approximates both extrema [7], and the arithmetic-geometric mean and the generalized-mean robustness (GMR) preserve the sign of the exact robustness [8, 9]. We ask how much weight a temporal operator keeps on its violating samples under each sound measure as the horizon adds samples. Subtracting from the LSE its largest excess, \log m/\beta, gives the sound LSE, which never exceeds the maximum and whose gradient, the softmax of \beta z, gives every sample a positive weight. At a worst-case error \varepsilon per operator, its weight on the violating samples tends to zero as the horizon adds samples whose values lie within \varepsilon of theirs. By eq. (12) of [9], GMR averages the violating samples over all d samples of the operator, so its weight on k of them is of order (k/d)^{1/q} for the exponent q of its power mean.
We replace every extremum by a lower approximation derived from the maximum regularized by a quadratic penalty of weight \gamma>0, whose gradient is the sparsemax projection onto the simplex [10, 11]. Figure 1 shows the construction on these nine samples. The value lies below the exact extremum by at most \gamma/2 for any number of samples, and every sample farther than a data-dependent threshold from the extremum receives a derivative of exactly zero. To our knowledge, the resulting robustness is the first smooth one that is a lower bound of the exact robustness and whose weight on the violating samples, for every gap by which they lie beyond the others, has a lower bound that does not depend on the horizon. Our contributions are the following.
1) Sound robustness from sparsemax lower extrema. We construct lower approximations of both extrema from the regularized maximum of [11] and prove that the robustness built from them, until included, is a lower bound of the exact one with an error known before optimization (Propositions 1 and 1, composed as in [6]). We also bound the excess of the plain LSE at an until operator from below and obtain the depth of violation up to which its robustness is positive (Proposition 2).
2) Horizon-independent gradient allocation. We prove that the sparsemax weight on k violating samples that lie a gap \Delta beyond the N others is at least \min\{1,k\Delta/\gamma\} for every N. At equal worst-case error \varepsilon, the weight of the sound LSE tends to zero as N grows if \Delta<\varepsilon (Theorems 2 and 1).
3) Numerical examples. We show on violating trajectories of a planar unicycle and a manipulator that the plain LSE robustness is positive and that the measured weights follow the closed forms. The optimizations demonstrate the two properties with a first-order solver, where the gradient’s allocation sets the update; the immediate update advantage is claimed for first-order methods only (Section V).
II Related Work
STL robustness reduces Boolean and temporal requirements to nested extrema over predicate values [2]. Differentiable STL computation graphs expose these quantities to gradient-based methods [3], and temporal masking parallelizes their evaluation [4]. We keep such a graph and study the functions placed at its extremum nodes. An LSE maximum in such a graph is an upper bound of the maximum, so the resulting robustness is not a lower bound, and Proposition 2 shows where the excess is attained.
The softmax-mean measure pairs an LSE minimum with a softmax-weighted mean as the maximum, both under-approximations, so a positive value implies satisfaction for every parameter value [7]. Its minimum is the LSE minimum, so Theorem 2 applies to it at minimum nodes, where the prefix of an until is evaluated. Average-based measures replace the extrema by means, first the arithmetic-geometric mean [8] and then power means and generalized functional means [9]. Their purpose is to remove the locality and masking of the extrema, by which the robustness depends on one operand at one time, so that every subformula and every time sample contributes to the value. They obtain soundness by branching on the sign of the operands, so the sign of the measure equals the sign of the exact robustness. Their conjunction lies at or above the minimum, so these measures preserve the sign and not a margin, and their distance from the exact robustness depends on the operands. A generalized-mean measure that is also continuously differentiable follows the same design [12]. A smooth, idempotent, and commutative conjunction has the derivative 1/M with respect to each of M equal nonzero operands [13]. A comparison of four smooth measures composes per-node error bounds through the specification by the recursion we also use and allows different operator parameters at different levels of the specification [6].
Sparsemax is the Euclidean projection onto the probability simplex [10], and regularized maxima with their use in differentiable dynamic programming supply the operator we build on [11]. The binary polynomial smooth minimum in [14, Section 5.2.4] coincides with Q^{-}_{\gamma} of Equation 7 for two entries. Our contribution is the lower-bound construction for both extrema at any number of entries, its composition through STL, and the allocation result at equal error.
Our operators stand between the extrema and the means. Every sample within a threshold of the extremum contributes, so tied or nearly tied violating samples share the derivative as they do under a mean, and every sample beyond the threshold receives none. It is observed in [9] that a measure which considers only the most critical time suits control in safety-critical applications and that the exponents of the power means set how much the other times contribute. The parameter \gamma has that role here, with two guarantees: a lower bound of the exact robustness with an error known before optimization, where a mean preserves the sign alone, and a weight on the violating samples bounded below independently of the number of other samples (Corollary 1). To our knowledge no earlier smooth measure provides both, and none of the works above gives the weight on the violating samples beyond a tie.
III Problem Formulation
III-A Specifications and exact robustness
Let x_{t+1}=f_{h}(x_{t},u_{t}) be a discrete-time robot model with sampling period h>0 and fixed initial state x_{0}. The controls U=(u_{0},\ldots,u_{T-1}) lie in a box \mathcal{U} of actuator bounds and generate the sampled trajectory X(U)=(x_{0},\ldots,x_{T}) over the horizon H=Th. An STL specification in negation normal form is built from the grammar
\phi::=\mu\mid\neg\mu\mid\phi\wedge\psi\mid\phi\vee\psi\mid\mathbf{G}_{I}\phi\mid\mathbf{F}_{I}\phi\mid\phi\,\mathbf{U}_{I}\,\psi,where \mu is a predicate with a continuously differentiable value g_{\mu}(x_{t}) that is nonnegative when the predicate holds, so that \rho^{\mu}_{t}=g_{\mu}(x_{t}) and \rho^{\neg\mu}_{t}=-g_{\mu}(x_{t}), and I=\{a,\ldots,b\} with integers 0\leq a\leq b is a window of sample offsets. The robustness of a specification at sample t is defined recursively from the predicate values by
\displaystyle\rho^{\phi\wedge\psi}_{t} \\ \displaystyle=\min\{\rho^{\phi}_{t},\rho^{\psi}_{t}\},\qquad\rho^{\phi\vee\psi}_{t}=\max\{\rho^{\phi}_{t},\rho^{\psi}_{t}\}, \\ \displaystyle\rho^{\mathbf{G}_{I}\phi}_{t} \\ \displaystyle=\min_{j\in I}\rho^{\phi}_{t+j},\qquad\rho^{\mathbf{F}_{I}\phi}_{t}=\max_{j\in I}\rho^{\phi}_{t+j}, \\ \displaystyle\rho^{\phi\,\mathbf{U}_{I}\,\psi}_{t} \\ \displaystyle=\max_{j\in I}\,\min\Bigl\{\rho^{\psi}_{t+j},\ \min_{0\leq i\leq j}\rho^{\phi}_{t+i}\Bigr\},and we say that the sampled trajectory satisfies \phi when \rho(X)=\rho^{\phi}_{0}\geq 0. We use the until semantics with a closed prefix [15, 9], in which the witness at offset j\in I requires \psi at t+j and \phi at every sample from t through t+j. Unrolling Equation 2 over the samples gives a finite acyclic evaluation graph whose leaves are predicate values and whose internal nodes are minima and maxima. A node is evaluated only where every sample its window reads exists, so the horizon of a specification is at most H. We write \mathrm{ch}(v) for the children of node v and m_{v} for their number. Figure 2 shows the two levels of an until node.
\phi\,\mathbf{U}_{I}\,\psi at sample t for a window of four offsets. The outer maximum ranges over the witnesses j\in I, and the child of witness j is a minimum over \rho^{\psi}_{t+j} and the closed prefix \rho^{\phi}_{t},\ldots,\rho^{\phi}_{t+j}. Each node is labeled with its error band b_{m}(\gamma) of Proposition 1.III-B Constrained trajectory optimization
We seek controls of least effort E(U) that satisfy a specification \phi=\bigwedge_{j=1}^{J}\phi_{j},
\min_{U\in\mathcal{U}}\ E(U)\quad\text{subject to}\quad\rho^{\phi_{j}}_{0}(X(U))\geq 0,\quad j=1,\ldots,J.The conjunction at the top of the specification is imposed exactly as J constraints. Since each \rho^{\phi_{j}}_{0} is nonsmooth in U, a gradient-based solver replaces every extremum node of the graph by a smooth function of its children and solves
\min_{U\in\mathcal{U}}E(U)\ \ \text{subject to}\ \ \widetilde{\rho}_{j}(X(U))\geq c,\ \ j=1,\ldots,J,with a margin c\geq 0. The smoothing thus sets the feasible set of Equation 4 and the search direction of the solver.
III-C Two requirements on the smoothing
The first requirement concerns the feasible set.
Definition 1.
A smoothed robustness \widetilde{\rho} is sound if \widetilde{\rho}(X)\geq 0 implies \rho(X)\geq 0 for every trajectory X. It is a lower bound with budget B\geq 0 if \rho(X)-B\leq\widetilde{\rho}(X)\leq\rho(X) for every X.
A lower bound is sound, and a margin on it is a margin on the exact robustness, since \widetilde{\rho}\geq c implies \rho\geq c. With lower bounds \widetilde{\rho}_{j} the feasible set of Equation 4 lies inside that of Equation 3, every feasible trajectory satisfies the specification, and the solver may return the first one it reaches. If \widetilde{\rho}_{j}\geq c can hold where \rho^{\phi_{j}}_{0}<0, the feasible set contains violating trajectories, which a solver that minimizes the effort can return.
The second requirement concerns the search direction. By the chain rule, the gradient of a smoothed robustness with respect to the controls is a weighted sum \sum_{\ell}\pi_{\ell}\nabla_{U}g_{\ell}(X(U)) over the predicate leaves \ell. The leaf weight \pi_{\ell} is the sum over root-to-leaf paths of the products of the derivatives of the smooth extrema along the path. At one extremum node with child values z\in\mathbb{R}^{m}, exact extremum A and smooth replacement \widetilde{A}, we call \sum_{i\in C}\partial\widetilde{A}(z)/\partial z_{i} the weight on the children C. On a violating trajectory the children that attain the minimum of a temporal operator over predicates are violating samples, and the number of its other children grows with the horizon.
Problem 1.
Find smooth replacements of the minimum and the maximum such that, for every specification of Equation 1,
- the smoothed robustness is a lower bound whose budget depends only on the evaluation graph and the smoothing parameters, and
- at a node whose
kextreme children are separated from itsNother children by a gap\Delta>0, the weight on thekchildren stays bounded away from zero asNgrows.
Every smooth extremum tends to the exact one as its worst-case error \sup_{z}|\widetilde{A}(z)-A(z)| tends to zero, and its gradient then changes more abruptly with the trajectory. We therefore pose (R2) at a fixed worst-case error \varepsilon per node and compare two smoothings at equal \varepsilon.
IV Sparsemax Lower Extrema
IV-A The operators
For z\in\mathbb{R}^{m} and \gamma>0, the quadratically regularized maximum over the simplex \mathcal{S}_{m}=\{p\in\mathbb{R}^{m}:p\geq 0,\ \mathbf{1}^{\top}p=1\} and its maximizer are
M_{\gamma}(z)=\max_{p\in\mathcal{S}_{m}}\Bigl(p^{\top}z-\tfrac{\gamma}{2}\|p\|_{2}^{2}\Bigr),\quad p_{\gamma}(z)=\Pi_{\mathcal{S}_{m}}(z/\gamma).The objective is strictly concave, completing the square gives the Euclidean projection \Pi_{\mathcal{S}_{m}}, which is the sparsemax map [10], and the envelope theorem gives \nabla M_{\gamma}(z)=p_{\gamma}(z). The optimality conditions of the projection are
p_{\gamma,i}(z)=\frac{(z_{i}-\theta)_{+}}{\gamma},\qquad\sum_{i=1}^{m}(z_{i}-\theta)_{+}=\gamma,so every entry at or below the threshold \theta receives a derivative of exactly zero (Figure 1(b)). The maximum of the penalty over the simplex is \gamma/2 and its minimum is \gamma/(2m), so M_{\gamma}(z) lies between \max_{i}z_{i}-\gamma/2 and \max_{i}z_{i}-\gamma/(2m) [11, Lemma 1]. Shifting by these two constants gives lower approximations of both extrema,
Q^{+}_{\gamma}(z)=M_{\gamma}(z)+\frac{\gamma}{2m},\qquad Q^{-}_{\gamma}(z)=-M_{\gamma}(-z)-\frac{\gamma}{2}.Proposition 1 (Error bands).
Let b_{m}(\gamma)=\frac{\gamma}{2}(1-1/m). For every z\in\mathbb{R}^{m},
\displaystyle 0 \\ \displaystyle\leq\max_{i}z_{i}-Q^{+}_{\gamma}(z)\leq b_{m}(\gamma), \\ \displaystyle 0 \\ \displaystyle\leq\min_{i}z_{i}-Q^{-}_{\gamma}(z)\leq b_{m}(\gamma).Both operators are continuously differentiable and nondecreasing in every entry, with gradients p_{\gamma}(z) and p_{\gamma}(-z) in the simplex.
Proof.
A vertex that attains \max_{i}z_{i} gives M_{\gamma}(z)\geq\max_{i}z_{i}-\gamma/2. Every p\in\mathcal{S}_{m} satisfies p^{\top}z\leq\max_{i}z_{i} and \|p\|_{2}^{2}\geq 1/m, so M_{\gamma}(z)\leq\max_{i}z_{i}-\gamma/(2m). Applying both bounds to z and to -z gives Equation 8. The gradients follow from the chain rule, and a gradient in the simplex has nonnegative entries. ∎
The band does not depend on z and is at most \gamma/2 for every m, at minimum and maximum nodes alike. Figure 3(a) shows Q^{-}_{\gamma} inside its band.
k=10 entries at the minimum and N entries a gap \Delta above it, at equal worst-case error \varepsilon=0.2; N=400 in (a) and (b). (a) Both values lie in the band [\min z-\varepsilon,\min z]. (b) Weight on one minimal entry (solid) and on one other entry (dashed), exactly zero for sparsemax once \Delta\geq\gamma/k. (c) Weight on the k entries against N (Theorem 2): W_{Q}=1 at every ratio \Delta/\varepsilon shown, since k\Delta\geq\gamma there, and each W_{L} curve is labeled by its ratio.IV-B A lower bound on the evaluation graph
Replace the extremum at every internal node v by the operator of Equation 7 with the number m_{v} of its children and its parameter \gamma_{v}, and let \widetilde{\rho}_{v} and \rho_{v} be the smoothed and exact values of the node. A predicate leaf may itself be evaluated by a smooth function that lies at most e_{v}\geq 0 below the exact predicate and never above it. Define the budget
B_{v}=\begin{cases}e_{v},&\text{leaf},\\
b_{m_{v}}(\gamma_{v})+\max_{u\in\mathrm{ch}(v)}B_{u},&\text{otherwise},\end{cases}which is the recursion that composes per-node bands of LSE and softmax operators in [6]. Every node is evaluated as one operator over all of its children, as Figure 2 draws the two levels of an until; the operators are not associative, so splitting a node into nested ones changes the function and adds a band to its path.
Theorem 1 (Lower bound).
On a finite acyclic evaluation graph of minima and maxima whose leaves satisfy 0\leq\rho_{v}-\widetilde{\rho}_{v}\leq e_{v}, every node satisfies
0\leq\rho_{v}-\widetilde{\rho}_{v}\leq B_{v}.At the root, B_{v} is the largest sum, along a root-to-leaf path, of the bands of its nodes and the error of its leaf.
Proof.
The claim holds at the leaves by assumption. Suppose it holds at every child of a node, and let a and \widetilde{a} collect the exact and smoothed child values, A the node’s exact extremum, and Q its operator of Equation 7. Monotonicity of A and Proposition 1 give A(a)\geq A(\widetilde{a})\geq Q(\widetilde{a}). Since A is nonexpansive in the infinity norm, A(a)-A(\widetilde{a})\leq\max_{u}B_{u}, and A(\widetilde{a})-Q(\widetilde{a})\leq b_{m_{v}}(\gamma_{v}) by Proposition 1. Adding the two gives Equation 10, and unrolling Equation 9 gives the path sum. ∎
The smoothed robustness is therefore a lower bound in the sense of Definition 1, which is (R1). The budget is fixed by the graph and the parameters before any trajectory is evaluated. An until node is one maximum over |I| witnesses whose child for witness j is a minimum over j+2 values, so it adds two bands to a path for any window length,
B_{\mathbf{U}}=b_{|I|}(\gamma_{\mathrm{out}})+\max_{j\in I}\bigl[b_{j+2}(\gamma_{j})+\max\{B_{\phi},B_{\psi}\}\bigr].The statements concern the sampled semantics in exact arithmetic. They do not cover the behavior between samples.
IV-C The log-sum-exp at an until node
The LSE maximum \overline{L}_{\beta}(z)=\beta^{-1}\log\sum_{i=1}^{m}e^{\beta z_{i}} lies above the maximum, and when n entries attain the maximum,
\frac{\log n}{\beta}\leq\overline{L}_{\beta}(z)-\max_{i}z_{i}\leq\frac{\log m}{\beta}.The LSE minimum -\overline{L}_{\beta}(-z) lies below the minimum. We call a graph with these two operators the plain LSE. Its excess at a maximum grows with the number of tied entries, and an until operator produces such ties.
Proposition 2 (Sign flip at until).
Let the exact value of an until node with window I be -\delta<0, attained by n of its witnesses. Replace the maximum over witnesses by \overline{L}_{\beta} and every inner minimum by a lower approximation whose error on the attaining witnesses is at most e. Then the smoothed value \widehat{\rho} of the node satisfies
\widehat{\rho}\geq-\delta-e+\frac{\log n}{\beta}.Suppose that \rho^{\phi} attains its minimum over the samples t,\ldots,t+\max I before the window opens (a\geq 1), that this minimum is -\delta<0, and that \rho^{\psi}_{t+j}\geq-\delta for at least one j\in I. Then the exact value of the node is -\delta, and the attaining witnesses are exactly those j.
Proof.
The smoothed inner values of the n attaining witnesses are at least -\delta-e. Since \overline{L}_{\beta} is nondecreasing in every entry and its other entries contribute positive terms, \widehat{\rho} is at least \overline{L}_{\beta} of n entries equal to -\delta-e, which is Equation 13. For the second statement, the prefix of every witness contains the minimizing sample, so its inner minimum is \min\{\rho^{\psi}_{t+j},-\delta\}, which equals -\delta when \rho^{\psi}_{t+j}\geq-\delta and is smaller otherwise. ∎
With \beta=\log|I|/\varepsilon, the plain LSE value of the violated node is positive whenever \delta+e<\varepsilon\log n/\log|I|. A trajectory whose deepest violation of \phi up to the end of the window occurs before the window opens, and which satisfies \psi throughout the window, ties all |I| witnesses. The plain LSE value is then positive for every violation \delta<\varepsilon-e, so the constraint of an until conjunct in Equation 4 holds with c=0 on a violating trajectory. By Theorem 1, the operators of Equation 7 give it a negative value.
IV-D Gradient allocation at equal error
Soundness alone is available from the LSE as well. Subtracting its worst-case excess gives the lower maximum
L_{\beta}(z)=\overline{L}_{\beta}(z)-\frac{\log m}{\beta},which by Equation 12 lies at most \log m/\beta below the maximum and never above it. It is the generalized mean with generating function e^{\beta x} [9, Section IV-C]. The LSE minimum has the same band below the minimum [7]. A graph with L_{\beta} at maximum nodes and the LSE minimum at minimum nodes is therefore a lower bound by the argument of Theorem 1. This graph is the sound LSE. Its gradient is the softmax of \beta z, which is positive on every entry. To compare the two families at one node of m>1 entries, we give them the same worst-case error \varepsilon,
\beta=\frac{\log m}{\varepsilon},\qquad\gamma=\frac{2\varepsilon}{1-1/m}.Theorem 2 (Gradient allocation).
Let a maximum node have k\geq 1 children equal to 0 and N\geq 1 children equal to -\Delta, with \Delta>0 and m=k+N. The weights of L_{\beta} and of Q^{+}_{\gamma} on the k children are
W_{L}=\frac{k}{k+Ne^{-\beta\Delta}},\quad W_{Q}=\min\Bigl\{1,\frac{k}{m}+\frac{kN\Delta}{m\gamma}\Bigr\},and W_{Q}=1 if and only if \Delta\geq\gamma/k. Under Equation 15, with k, \varepsilon, and \Delta fixed and N\to\infty,
W_{Q}\to\min\bigl\{1,\tfrac{k\Delta}{2\varepsilon}\bigr\},\ \ W_{L}\to\begin{cases}0,&\Delta<\varepsilon,\\
k/(k+1),&\Delta=\varepsilon,\\
1,&\Delta>\varepsilon.\end{cases}The same statements hold at a minimum node after negating the children.
Proof.
W_{L} is the sum of the softmax weights of the k children. For Q^{+}_{\gamma}, if the N children are above the threshold, symmetry and Equation 6 give \theta=-(N\Delta+\gamma)/m, so each of the k children has weight (N\Delta+\gamma)/(m\gamma), and \theta<-\Delta holds precisely when k\Delta<\gamma. Otherwise the N children receive zero and the k children 1/k each, which proves Equation 16. Under Equation 15, \gamma\to 2\varepsilon and N/m\to 1, which gives the limit of W_{Q}, and Ne^{-\beta\Delta}=(N/m)\,m^{1-\Delta/\varepsilon} diverges, tends to one, or vanishes as \Delta is below, at, or above \varepsilon. ∎
Corollary 1 (Weight under a gap).
Let the k largest children of a maximum node exceed each of its N other children by at least \Delta>0. Then, for every N and all values of the children, W_{Q}\geq\min\{1,k\Delta/\gamma\} and W_{L}\geq k/(k+Ne^{-\beta\Delta}). The configuration of Theorem 2 attains the bound on W_{L} for every N.
Proof.
Let c be the smallest of the k children and \theta the threshold of Equation 6. If c-\theta\leq\Delta, every other child lies at or below \theta and W_{Q}=1. Otherwise each of the k children has weight at least (c-\theta)/\gamma>\Delta/\gamma. The bound on W_{L} holds because the softmax weight of the k children increases with their values and decreases with those of the others. ∎
Remark 1 (Unequal children).
The k children need not be equal. Let them take values -\delta_{i}\leq 0 with \min_{i}\delta_{i}=0, above the N others at -\Delta. The softmax sum gives W_{L}=k_{\mathrm{eff}}/(k_{\mathrm{eff}}+Ne^{-\beta\Delta}) with the effective count k_{\mathrm{eff}}=\sum_{i}e^{-\beta\delta_{i}}\leq k, where Ne^{-\beta\Delta} becomes \sum_{j}e^{-\beta\Delta_{j}} if the others lie at -\Delta_{j}, and Equation 6 gives W_{Q}=1 if and only if \sum_{i}(\Delta-\delta_{i})\geq\gamma. Both statements reduce to Equation 16 for equal children.
2 and 1 answer (R2): the sparsemax weight on the k children is bounded below independently of N and of the values of the other children, is the whole weight once \Delta\geq\gamma/k, and, since \gamma\leq 4\varepsilon under Equation 15 for every m\geq 2, is at least \min\{1,k\Delta/(4\varepsilon)\} at every N. For \Delta<\varepsilon the sound LSE has no such bound, since its weight in the configuration of Theorem 2 is the smallest possible and decays as N^{-(1-\Delta/\varepsilon)} (Figure 3(b,c)). For \Delta>\varepsilon the weight of the sound LSE on the k children also tends to 1, so choosing \varepsilon below the gap restores its weight. The gap is a property of the trajectory, however, and is not known when \varepsilon is chosen. Sparsemax keeps the whole weight for every \varepsilon\leq k\Delta(1-1/m)/2, at every N. This range exceeds the range \varepsilon<\Delta of the sound LSE by the factor k(1-1/m)/2, which is above one for k\geq 3. A smaller \gamma widens that range of gaps, but the gradient of the lower extrema is Lipschitz in the Euclidean norm with constant 1/\gamma, so the constraint becomes less smooth, and as \gamma\to 0 the operator tends to the exact extremum; at equal \varepsilon this constant, (1-1/m)/(2\varepsilon), is below the LSE gradient’s \log m/(2\varepsilon) for every m\geq 2. The matching Equation 15 equalizes the worst-case error and not the realized error. At a tie of k entries of a minimum node whose other entries lie far above the tie, the error of Q^{-}_{\gamma} is \varepsilon(1-1/k)/(1-1/m) and that of the LSE minimum tends to \varepsilon\log k/\log m, which is smaller for 1<k<m, so sparsemax gives the smaller value at equal \varepsilon.
The inner minimum of an until node runs over every sample of the prefix, so a trajectory that violates \phi at k samples and then keeps \rho^{\phi} a gap \Delta above the violation for N samples gives the node the structure of Theorem 2, with N growing by one per sampling period of the wait. Through the chain rule the controls receive \sum_{i}p_{\gamma,i}\nabla_{U}z_{i}, so the N samples contribute nothing under sparsemax once \Delta\geq\gamma/k and almost everything under the sound LSE once W_{L} is small. Whether this weight moves the trajectory out of the violation depends on the dynamics (Section V).
V Numerical Examples
V-A Planar unicycle
A unicycle with position (x,y) and heading \theta follows x^{+}=x+hv\cos\theta, y^{+}=y+hv\sin\theta, \theta^{+}=\theta+h\omega with h=0.1 s, speed |v|\leq 1 m/s, and turn rate |\omega|\leq\pi/2 rad/s. Four disks lie in a square workspace of side 10 m (Figure 4(a)), and the predicate of a disk is the signed distance to its boundary in metres. The unicycle must stay out of Red until it is in Green within a window of 2 s, then reach Blue and stay there for 2 s, never enter the Obstacle, and stay in the workspace,
\displaystyle\phi={} \\ \displaystyle(\neg\mathrm{Red}\ \mathbf{U}_{I_{1}}\ \mathrm{Green})\ \wedge\ \mathbf{F}_{I_{2}}\mathbf{G}_{[0,2]}\mathrm{Blue} \\ \displaystyle\wedge\ \mathbf{G}\,\neg\mathrm{Obstacle}\ \wedge\ \mathbf{G}\,\mathrm{Boundary}.Two fixed trajectories round Red on the way to Green. S_{1} cuts into Red on an arc concentric with it, so k=21 samples lie inside Red at a depth of at most \delta=0.015 m, and then waits 0.023 m outside Red until the window I_{1} opens. We lengthen the wait from 3 to 130 s, which keeps N=31 to 1301 samples a gap \Delta=0.038 m above the violation. S_{2} passes Red at a clearance of 0.3 m at one point and satisfies \phi with exact robustness 0.3, which the until conjunct sets.
We compare five robustness measures. The plain LSE, the sound LSE, and sparsemax have the same worst-case error \varepsilon=0.1 m per node under Equation 15, so \delta=0.15\varepsilon and \Delta=0.38\varepsilon. The generalized-mean robustness (GMR) [9] replaces a conjunction of d operands by the power mean (\frac{1}{d}\sum_{i}x_{i}^{p})^{1/p}, the geometric mean at p=0, when every operand is positive and by -(\frac{1}{d}\sum_{i}|\min\{x_{i},0\}|^{q})^{1/q} otherwise. It evaluates each witness of until as a two-operand conjunction of the right operand with the conjunction over the prefix. It is sound for all p and q [9, Theorem 2], since its sign is that of the exact robustness, and it preserves the sign and not a margin (Section II). We use the orders (p,q)=(0,1), a setting used in [9], and (-10,10), whose power means lie closer to the extrema. As p\to-\infty and q\to\infty GMR tends to the exact robustness [9, Sections IV-B and IV-C], as the LSE and sparsemax do for \varepsilon\to 0, so its order sets how much the other samples contribute against its closeness to the exact robustness, as \varepsilon does.
- exact
- -0.015
- 0.300
- plain LSE
- +0.024
- 0.357
- 0.68
- 0.19
- -0.058
- 0.146
- sound LSE
- -0.076
- 0.258
- 0.68
- 0.19
- 0.045
- 0.218
- GMR (0,1)
- -0.0001
- 1.69
- 0.043
- 0.007
- <0.001
- <0.001
- GMR (-10,10)
- -0.009
- 0.49
- 0.71
- 0.60
- <0.001
- 0.141
- sparsemax
- -0.110
- 0.214
- 1.000
- 1.000
- 0.087
- 0.248
S_{1} cuts into Red and waits beside it, S_{2} passes Red at a clearance of 0.3 m. (b) Distance from Red of the trajectories returned at c=0 under the plain LSE (solid) and the sound LSE (dashed), GMR of order (-10,10), and sparsemax, from the initial trajectory S_{1} (dotted).On S_{1} the unicycle is in Green through the whole window, so all 21 witnesses tie and the plain LSE is positive (Table I) on a trajectory 0.015 m inside Red, within 0.006\varepsilon of the bound of Proposition 2 with an inner-minimum error of 0.62\varepsilon; the error of sparsemax, 0.95\varepsilon, arises at the inner minimum over the tied samples (Proposition 1), and both orders of GMR have the correct sign. On S_{2}, at a clearance of 0.3 m, the plain LSE and GMR exceed it, whereas the sound LSE and sparsemax give margins that Theorem 1 certifies. The weight of sparsemax on the samples inside Red stays 1, that of both LSE variants falls as Theorem 2 predicts for \Delta<\varepsilon, and that of GMR scales, by eqs. (12) and (15) of [9], as (k/(2d))^{1/q} with the d samples of the prefix.
We then minimize the effort E=\frac{1}{T}\sum_{t}\|u_{t}/u_{\max}\|_{2}^{2} subject to Equation 4, from S_{1}, with a first-order augmented Lagrangian method under single shooting over the box-bounded controls: 400 updates, each a step along the normalized gradient of the augmented Lagrangian under an Armijo backtracking, with the multiplier and penalty of each conjunct revised every ten updates. Every smoothed constraint then holds within 0.0003 m, and the exact robustness values that follow are measured on the returned trajectories. With c=0 every constraint of the plain LSE holds on a trajectory that cuts 0.058 m into Red (Figure 4(b)). The constraint of GMR at zero is the exact constraint, and the trajectory of order (-10,10) touches Red. The sound LSE and sparsemax keep the unicycle 0.045 and 0.087 m outside. With c=0.2 m only these two lower bounds return a trajectory whose exact robustness is at least c, at efforts 1% and 4% above that of the plain LSE. From S_{2} the plain LSE returns a violating trajectory with c=0, and the two lower bounds meet c=0.2 m. The authors of GMR instead maximize it in the cost under a margin constraint [9].
V-B Manipulator beside a person
H=10 s, exact robustness -0.05). Top: manipulator, person and zone (green) at five times. Bottom left: exact predicate values; the end effector is inside the zone for 0.3 s and then waits at the pick pose. Bottom right: weight on the samples inside the zone at \varepsilon=0.2, medians over the four trajectories (markers), with the curves of Remark 1 for the LSE and sparsemax and straight lines for GMR.A simulated seven-joint Franka Panda manipulator under torque control shares a table with a person. It picks a part outside a zone, a ball of radius 0.2 m centred 0.5 m in front of its base and reserved for the person’s reach, and hands it over inside the zone (Figure 5). Each predicate is a distance or speed margin divided by its threshold. The length is a smooth norm, \sqrt{\|x\|^{2}+\eta^{2}} in a margin of the form threshold minus length and \sqrt{\|x\|^{2}+\eta^{2}}-\eta in one of the form length minus threshold, with \eta one percent of the smallest threshold, so every leaf lies at most e_{v}=0.01 below its exact value and never above it. With times in seconds, a horizon H, a pick window [w,w+1], and a handover window I_{\mathrm{h}} after it, the specification is
\displaystyle\phi={} \\ \displaystyle\mathbf{G}_{[0,H]}\bigwedge_{\ell,s}\mathrm{sep}_{\ell s}\wedge\mathbf{G}_{[0,H]}\bigwedge_{\ell}\Bigl(\bigwedge_{s}\mathrm{slow}_{\ell s}\vee\mathrm{speed}_{\ell}\Bigr) \\ \displaystyle\wedge\bigl(\mathrm{clear}\ \mathbf{U}_{[w,w+1]}\ \mathrm{pick}\bigr)\wedge\mathbf{F}_{I_{\mathrm{h}}}\mathbf{G}_{[0,0.8]}\mathrm{hand},where \mathrm{sep} and \mathrm{slow} bound the separation of the manipulator’s spheres \ell from the person’s spheres s, \mathrm{speed} bounds their speed, \mathrm{clear} is the distance of the end effector from the zone, and \mathrm{pick} and \mathrm{hand} are tolerances about two poses. The thresholds are a separation of 0.10 m for \mathrm{sep}, 0.30 m and 0.25 m/s for \mathrm{slow} and \mathrm{speed}, and 0.05 m about the pick and handover targets; the pick window opens at w=H-2.78 s and the handover window I_{\mathrm{h}} follows it and its dwell ends at H. We sample at h=0.02 s, simulate with the Warp implementation of MuJoCo [16], and differentiate it in reverse mode.
On four initial trajectories, which differ in one intermediate configuration, the end effector overshoots into the zone on its way to the pick pose, and the manipulator then waits at that pose until the pick window closes at H-1.78 s. In units of the worst-case error \varepsilon=0.2 per node, the overshoot is 0.25\varepsilon deep and the pick pose lies a gap \Delta=0.375\varepsilon above it. The end effector is inside the zone at k=18 or 19 samples, and the wait contains N=287, 787, 1787, and 3787 samples at horizons of 10, 20, 40, and 80 s. Each trajectory violates the until conjunct with exact robustness -0.05 and satisfies the other three conjuncts.
- exact
- -0.050
- plain LSE
- +0.023
- 0.216
- 0.036
- 3.62
- 0.67
- sound LSE
- -0.177
- 0.216
- 0.036
- 3.62
- 0.67
- GMR (0,1)
- -0.0006
- 0.024
- 0.0024
- 0.40
- 0.039
- GMR (-10,10)
- -0.029
- 0.588
- 0.467
- 10.1
- 8.0
- sparsemax
- -0.220
- 1.000
- 1.000
- 16.82
- 16.82
The manipulator waits at the pick pose through the whole pick window, so all 51 witnesses tie and the plain LSE is positive on the violated conjunct (Table II), as Proposition 2 predicts. The sound LSE and sparsemax give values below the exact one and within the budget B_{\mathbf{U}}=2\varepsilon+e_{v}=0.41 of Equation 11. The weight of sparsemax on the samples inside the zone is 1.000 at every horizon, because every sample of the wait lies beyond the threshold \theta of Equation 6. The weight of the LSE falls from 0.216 to 0.036 and stays within 5% of the expression of Remark 1 (Figure 5). By eqs. (12) and (15) of [9], the weight of GMR scales as (k/(2d))^{1/q}. The chain rule carries these weights to the torques. The part of the gradient with respect to the normalized torques u_{t}/u_{\max} that passes through the samples inside the zone, in the Euclidean norm over all samples, is the same at 10 and 80 s under sparsemax and falls by a factor of 5.4 under the LSE and of 10 under GMR of order (0,1).
We repeat the optimization on the torques with c=0 from initial trajectories with exact robustness -0.05 and -0.10, overshoots of 1.0 and 2.0 cm, at 16 pick and handover locations and horizons of 10, 20, and 40 s with the solver of the unicycle example, whose normalized step removes the gradient’s size from the update. In the median over the 16 locations, the first exactly satisfying trajectory comes at update 1 or 2 under sparsemax and GMR of order (-10,10) at every horizon and from 4.5 to 19.5 updates, growing with the horizon, under the sound LSE (Table III). Under the solver’s own constraint the medians are 10 to 20 updates for sparsemax and 12.5 to 29 for the sound LSE, and 3 of 32 sparsemax trajectories at 40 s never meet it, since its realized error is larger (Table II). After 100 updates at 40 s the median exact robustness is near zero under the plain LSE, whose constraints hold at the violating initial trajectory so its first updates reduce the effort alone, and under GMR, which preserves the sign and not a margin, while the two lower bounds keep their realized errors as margins.
- plain LSE
- -0.05
- 6
- 6
- 6 [5,7]
- 0.001 (-0.006)
- 0.61
- No data
- -0.10
- 7^{1}
- 7^{2}
- 7 [7,23]
- -0.0005 (-0.15)
- 0.50
- sound LSE
- -0.05
- 4.5
- 10
- 17 [14,22]
- 0.097 (0.06)
- 0.94
- No data
- -0.10
- 6
- 11
- 19.5 [13,25]
- 0.083 (0.04)
- 0.94
- GMR (0,1)
- -0.05
- 3
- 5^{1}
- 5^{1} [5,6]
- 0.003 (-0.02)
- 0.33
- No data
- -0.10
- 6^{1}
- 11^{3}
- 7^{4} [5,15]
- 0.005 (-0.03)
- 0.33
- GMR (-10,10)
- -0.05
- 1
- 1
- 1 [1,2]
- 0.014 (-0.003)
- 0.65
- No data
- -0.10
- 2
- 2
- 2 [2,3]
- 0.009 (-0.005)
- 0.67
- sparsemax
- -0.05
- 1
- 1
- 1 [1,2]
- 0.172 (0.16)
- 0.97
- No data
- -0.10
- 2
- 2
- 2 [2,4]
- 0.166 (0.15)
- 0.98
VI Conclusion
The sparsemax lower extrema are lower bounds with an error per node of at most \gamma/2 for any number of samples, and their weight on k samples a gap \Delta beyond all others is at least \min\{1,k\Delta/\gamma\} for every horizon. At equal worst-case error \varepsilon this weight is at least \min\{1,k\Delta/(4\varepsilon)\}, while the weight of the sound LSE tends to zero as the number of other samples grows when \Delta<\varepsilon (Theorems 2 and 1).
Sparsemax has costs. Its minimum’s band is attained at a tie, so at equal worst-case error sparsemax gives the smaller value (Section IV-D) and rejects every trajectory whose exact margin lies below its realized error, 0.17 against 0.13 for the sound LSE in Table II, which can leave no feasible plan where feasibility is tight. A sample beyond the threshold receives no derivative, so nothing warns the solver of one about to become critical, and in a nested specification a zero at an inner node hides that sample from the nodes above it. The operators are once continuously differentiable, and the update advantage we measured is a first-order one. GMR preserves the sign of the exact robustness and not a margin, so under an effort cost with a threshold of zero its trajectories end at an exact robustness near zero, where a lower bound keeps its realized error as a margin. For future work, we seek to exploit the sparse Hessian of sparsemax when the sampled states are decision variables, through sparse automatic differentiation for second-order solvers.
Acknowledgment
The authors acknowledge the use of Claude LLMs [17] for code development, visualizations, and manuscript review.