  The \emph{Skorokhod distance} is a natural metric on traces of continuous and
hybrid systems. For two traces, from $[0,T]$ to values in a metric space $O$,
it measures the best match between the traces when allowed continuous bijective
timing distortions. Formally, it computes the infimum, over all timing
distortions, of the maximum of two components: the first component quantifies
the {\em timing discrepancy} of the timing distortion, and the second
quantifies the mismatch (in the metric space $O$) of the values under the
timing distortion. Skorokhod distances appear in various fundamental hybrid
systems analysis concerns: from definitions of hybrid systems semantics and
notions of equivalence, to practical problems such as checking the closeness of
models or the quality of simulations. Despite its popularity and extensive
theoretical use, the \emph{computation} problem for the Skorokhod distance
between two finite sampled-time hybrid traces has remained open.
  We address in this work the problem of computing the Skorokhod distance
between two polygonal traces (these traces arise when sampled-time traces are
completed by linear interpolation between sample points). We provide the first
algorithm to compute the exact Skorokhod distance when trace values are in
$\reals^n$ for the $L_1$, $L_2$, and $L_{\infty}$ norms. Our algorithm, based
on a reduction to Frechet distances, is fully polynomial-time, and incorporates
novel polynomial-time procedures for a set of geometric primitives in
$\reals^n$ over the three norms.
