Papers
Topics
Authors
Recent
Search
2000 character limit reached

Uppaal Coshy: Automated Safety Shield Synthesis

Updated 9 July 2026
  • Uppaal Coshy is a tool that automatically synthesizes safety shields for Euclidean Markov decision processes using partition-based abstraction and simulation-driven approximation.
  • It employs the Caap algorithm to compactly represent per-cell safety strategies as decision trees via greedy expansion and heuristic splitting.
  • The tool integrates with Uppaal models to verify safety through statistical model checking and has demonstrated effectiveness on benchmarks like the bouncing ball and water tank.

Uppaal Coshy is a tool for automatic synthesis of a safety strategy, or shield, for Markov decision processes over continuous state spaces and complex hybrid dynamics. Its general methodology is to partition the state space and then solve a two-player safety game, while approximating hard-to-obtain solutions using simulations. The implementation is fully automatic and supports the expressive formalism of Uppaal models, which encompass stochastic hybrid automata. A central feature is an algorithm called Caap, which computes a compact representation of a shield in the form of a decision tree and yields significant reductions (Brorholt et al., 22 Aug 2025).

1. Problem setting and synthesis objective

The setting is a possibly stochastic hybrid system modeled as a Euclidean Markov decision process (EMDP) whose state space SRkS \subseteq \mathbb{R}^k is conceptually infinite (Brorholt et al., 22 Aug 2025). Given a safety invariant φS\varphi \subseteq S, the goal is to automatically synthesize a nondeterministic shield σ\sigma that maps each state ss to a set of safe control actions, so that under σ\sigma all executions remain in φ\varphi.

The paper defines the target artifact as a nondeterministic “shield” or safety strategy rather than a single prescribed controller. This distinction is technically important: the shield restricts actions to those that are safe, but it does not necessarily determine one unique action in each state. Applications include enforcing safety at run-time while leaving freedom for optimization or learning within the shielded system. This suggests a separation between a safety envelope and whatever optimization or learning mechanism operates inside that envelope.

A common misunderstanding would be to treat the synthesis problem as a purely finite-state task. The paper instead starts from continuous state spaces and complex hybrid dynamics, and only then introduces a finite abstraction through partitioning. Another misconception would be to assume that exact hybrid reachability is computed throughout; the paper explicitly states that exact computation is undecidable or infeasible for general nonlinear or stochastic hybrid dynamics.

2. Formal model: EMDPs, partitions, and the safety game

An EMDP is defined as a tuple M=(S,A,T)\mathcal{M} = (S, A, T), where SRkS \subseteq \mathbb{R}^k is closed and bounded, AA is a finite set of actions, and T ⁣:S×A(SR0)T \colon S \times A \to (S \to \mathbb{R}_{\ge 0}) maps φS\varphi \subseteq S0 to a probability density φS\varphi \subseteq S1 on φS\varphi \subseteq S2 (Brorholt et al., 22 Aug 2025). A run is an infinite sequence

φS\varphi \subseteq S3

with φS\varphi \subseteq S4. A nondeterministic strategy is φS\varphi \subseteq S5; a run is safe if φS\varphi \subseteq S6 and φS\varphi \subseteq S7.

The abstraction step partitions φS\varphi \subseteq S8 into finitely many rectangular cells φS\varphi \subseteq S9. This induces a labeled transition system by

σ\sigma0

The zero-step safe cells are

σ\sigma1

The greatest-fixed-point characterization of the safe region is

σ\sigma2

The corresponding most-permissive shield on cells is

σ\sigma3

By mapping each continuous state σ\sigma4 to its cell σ\sigma5, the construction yields a shield for the original EMDP; the paper attributes this statement to Theorem 2.1. Once σ\sigma6 is computed, the safety game is solved via fixed point (2) in time polynomial in σ\sigma7 and σ\sigma8. The abstraction therefore relocates the main difficulty from game solving to the construction of a sufficiently informative finite transition relation.

3. Partition-based abstraction and simulation-driven approximation

The partition is a regular rectangular grid over σ\sigma9, parameterized by a granularity vector ss0 and an offset ss1. Each cell is

ss2

Finer ss3 yields more cells and, in principle, a more precise abstraction, but at higher computational cost (Brorholt et al., 22 Aug 2025).

The principal algorithmic obstacle is that exact computation of the transition relation in (1) is undecidable or infeasible for general nonlinear or stochastic hybrid dynamics. Uppaal Coshy addresses this by systematic sampling and simulation. Within each cell ss4, it systematically samples ss5 points on an ss6-grid, where ss7 is a user parameter. For each sample ss8 and action ss9, it applies σ\sigma0 and invokes the Uppaal simulator to run until the next controller decision point; this yields a successor sample σ\sigma1, and hence a successor cell σ\sigma2. Each sample–action pair is repeated σ\sigma3 times, where σ\sigma4 is another user parameter, to cover stochastic outcomes.

The union of discovered transitions underapproximates the ideal transition relation. Cells whose samples never violate σ\sigma5 are taken as initial safe cells. Empirically, increasing σ\sigma6 and σ\sigma7 improves precision; final safety can be checked by Uppaal’s statistical model checking. The paper’s general philosophy is therefore not to solve hybrid reachability exactly, but to approximate it through simulator-driven evidence. A plausible implication is that synthesis quality depends materially on the informativeness of the sampling regime and on the model’s stochastic structure.

4. Caap and compact shield representation

A direct shield stores σ\sigma8 for each cell, and the paper notes that this can involve millions of cells (Brorholt et al., 22 Aug 2025). Since many adjacent cells allow the same action set, Uppaal Coshy introduces Caap to compute a coarser, axis-aligned partition and thereby obtain a compact representation.

The compact representation is defined through a decision tree whose internal predicates have the form σ\sigma9, with sorted cut-points φ\varphi0 per dimension φ\varphi1. A region is represented by index bounds φ\varphi2, corresponding to a hyperrectangle in φ\varphi3.

A candidate expansion φ\varphi4 of a region is legal only if three rules hold:

  1. Uniformity: all cells in φ\varphi5 share the same φ\varphi6.
  2. Non-overlap: φ\varphi7 does not intersect already fixed regions.
  3. Non-splitting: for any original region φ\varphi8, φ\varphi9 is either empty or a single rectangle.

The greedy expansion procedure initializes M=(S,A,T)\mathcal{M} = (S, A, T)0 and iteratively tries to increase M=(S,A,T)\mathcal{M} = (S, A, T)1 in each dimension M=(S,A,T)\mathcal{M} = (S, A, T)2. If Rule 1 or 2 fails, the algorithm reverts and marks M=(S,A,T)\mathcal{M} = (S, A, T)3 exhausted. If Rule 3 fails, it attempts a one-dimensional “repair” by more aggressive expansion; if impossible, it reverts and exhausts M=(S,A,T)\mathcal{M} = (S, A, T)4. When all dimensions are exhausted, it records the maximal region and repeats until the whole space is covered.

The resulting regions are then converted back into a much smaller decision tree through a heuristic splitting procedure that balances number of cut regions and region counts while ensuring functional equivalence. Repeated CaapM=(S,A,T)\mathcal{M} = (S, A, T)5tree cycles often yield further minor reductions. The compactness result is thus not merely a storage optimization; it is a structural post-processing step that preserves the shield while changing its representation.

5. Tool workflow and implementation in Uppaal

The workflow begins by modeling the hybrid system in Uppaal using piecewise ODEs, discrete modes, and synchronizations (Brorholt et al., 22 Aug 2025). Shield synthesis is then initiated by a query of the form:

SRkS \subseteq \mathbb{R}^k4

Uppaal Coshy then automatically performs three synthesis stages: it builds the grid M=(S,A,T)\mathcal{M} = (S, A, T)6, samples and simulates to approximate transitions, and solves the finite safety game to compute M=(S,A,T)\mathcal{M} = (S, A, T)7. The raw shield can optionally be saved per cell to JSON. Caap can then be run on the saved shield JSON to obtain a compact decision tree, which can be loaded back in Uppaal. The compact shield can be used in reinforcement-learning or strategy-improvement queries via Uppaal Stratego.

Several implementation details are emphasized. Unbounded state spaces are handled by a special “out-of-bounds” cell; the user can choose to treat it as always safe, always unsafe, or decide automatically by sampling. Dimensions irrelevant to safety, including clocks, cost variables, and always-fixed discrete locations, may be omitted; their values are fixed to the initial state during sampling. The simulator is used both for nondeterministic hybrid flows and stochastic draws, which frees the implementation from re-implementing arbitrary C calls or complex distributions. All steps are fully automated from the Uppaal GUI, with no manual model changes needed except optional state-space transformations.

This implementation profile suggests that the tool is designed to exploit the simulator as a unifying interface for both dynamics and randomness, rather than to encode bespoke symbolic procedures for each model class.

6. Experimental findings, limitations, and extensions

The evaluation uses four benchmarks: the bouncing ball, boost converter, random walk, and water tank (Brorholt et al., 22 Aug 2025). The reported synthesis and Caap metrics are as follows.

Benchmark Configuration and synthesis Caap result
Bouncing Ball M=(S,A,T)\mathcal{M} = (S, A, T)8; synthesis 218 s; raw cells 1 430 000 53 s; 2 972 regions
Boost Converter M=(S,A,T)\mathcal{M} = (S, A, T)9; synthesis 1 430 s; raw cells 136 800 21 s; 571 regions
Random Walk SRkS \subseteq \mathbb{R}^k0; synthesis 82 s; raw cells 40 000 1.5 s; 60 regions
Water Tank SRkS \subseteq \mathbb{R}^k1; synthesis 0.1 s; raw cells 168 0.1 s; 24 regions

All synthesized shields were confirmed via 10 000 SMC runs at 99% confidence to violate safety in fewer than 0.03% of trials, and in practice zero. The paper also states that state-space transformations, for example using mechanical energy for the ball, can reduce raw grid size by orders of magnitude.

The limitations are explicit. Reachability is underapproximated, so corner cases may be missed unless SRkS \subseteq \mathbb{R}^k2 and SRkS \subseteq \mathbb{R}^k3 are large; statistical checking is recommended post-synthesis. Randomness in Uppaal is not systematically sampled, and future work may detect and sample over discrete distributions. Caap is currently a separate post-processing step, and tighter integration into Uppaal would simplify usability. Improved visualizations, including why a state is unsafe, and debug support could aid modelers. Proposed extensions include cost-aware shields through multi-objective synthesis and on-the-fly shield refinement during learning.

Taken together, these results position Uppaal Coshy as a partition-based, simulation-driven framework for automatic safety synthesis in stochastic and hybrid models, with Caap serving as the mechanism that converts large per-cell shields into compact deployable decision trees.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Uppaal Coshy.