# jpdaEvents

Feasible joint events for trackerJPDA

## Description

`[`

generates the `FJE`

,`FJEProbs`

] = jpdaEvents(`likelihoodMatrix`

,`k`

)`k`

-best feasible joint event matrices,
`FJE`

, corresponding to the posterior likelihood matrix,
`likelihoodMatrix`

. `likelihoodMatrix`

defines the
posterior likelihood of associating detections with tracks.

returns the feasible joint events, `FJE`

= jpdaEvents(`validationMatrix`

)`FJE`

, based on the validation matrix.
A validation matrix describes the possible associations between detections and tracks,
whereas a feasible joint event for multi-object tracking is one realization of the
associations between detections and tracks.

## Examples

### Obtain Feasible Joint Events from Likelihood Matrix

Create a likelihood matrix assuming four detections and two tracks.

likeMatrix = [0.1 0.1 0.1; 0.1 0.3 0.2; 0.1 0.4 0.1; 0.1 0.6 0.1; 0.1 0.5 0.3];

Generate three most probable events and obtain their normalized probabilities.

[FJE,FJEProbs] = jpdaEvents(likeMatrix,3)

`FJE = `*4x3x3 logical array*
FJE(:,:,1) =
1 0 0
1 0 0
0 1 0
0 0 1
FJE(:,:,2) =
0 0 1
1 0 0
0 1 0
1 0 0
FJE(:,:,3) =
1 0 0
0 1 0
1 0 0
0 0 1

`FJEProbs = `*3×1*
0.4286
0.2857
0.2857

### Generate Feasible Joint Events

Define an arbitrary validation matrix for five measurements and six tracks.

M = [1 1 1 1 1 0 1 1 0 1 1 0 0 0 1 0 0 0 1 1 0 1 1 1 1 0 0 0 1 1 1 1 1 1 1];

Generate all feasible joint events and count the total number.

FJE = jpdaEvents(M); nFJE = size(FJE,3);

Display a few of the feasible joint events.

` disp([num2str(nFJE) ' feasible joint event matrices were generated.'])`

574 feasible joint event matrices were generated.

toSee = [1:round(nFJE/5):nFJE, nFJE]; for ii = toSee disp("Feasible joint event matrix #" + ii + ":") disp(FJE(:,:,ii)) end

Feasible joint event matrix #1:

1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0

Feasible joint event matrix #116:

0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0

Feasible joint event matrix #231:

0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1

Feasible joint event matrix #346:

0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0

Feasible joint event matrix #461:

1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1

Feasible joint event matrix #574:

1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1

## Input Arguments

`likelihoodMatrix`

— Likelihood matrix

(*m*+1)-by-(*n*+1) matrix

Likelihood matrix, specified as an
(*m*+1)-by-(*n*+1) matrix, where *m*
is the number of detections within the cluster of a sensor scan, and
*n* is the number of tracks maintained in the tracker. The likelihood
matrix uses the first column to account for the possibility that each detection is
clutter or false alarm, which is commonly referred to as "Track 0" or
*T*_{0}. The matrix uses the first row to account
for the possibility that each track is not assigned to any detection, which can be
referred to as "Detection 0" or *D*_{0}. The
(*j*+1,*i*+1) element of the matrix represents the
likelihood to assign track
*T*_{i} to detection
*D*_{j}.

**Data Types: **`logical`

`k`

— Number of joint probabilistic events

positive integer

Number of joint probabilistic events, specified as a positive integer.

**Data Types: **`logical`

`validationMatrix`

— Validation matrix

*m*-by-(*n*+1) matrix

Validation matrix, specified as an *m*-by-(*n*+1)
matrix, where *m* is the number of detections within the cluster of a
sensor scan, and *n* is the number of tracks maintained in the tracker.
The validation matrix uses the first column to account for the possibility that each
detection is clutter or false alarm, which is commonly referred to as "Track 0" or
*T*_{0}. The validation matrix is a binary matrix
listing all possible detections-to-track associations. If it is possible to assign track
*T*_{i} to detection
*D*_{j}, then the
(*j*, *i*+1) entry of the validation matrix is 1.
Otherwise, the entry is 0.

**Data Types: **`logical`

## Output Arguments

`FJE`

— Feasible joint events

*m*-by-(*n*+1)-by-*p*
array

Feasible joint events, specified as an
*m*-by-(*n*+1)-by-*p* array, where
*m* is the number of detections within the cluster of a sensor scan,
*n* is the number of tracks maintained in the tracker, and
*p* is the total number of feasible joint events. Each page (an
*m*-by-(*n*+1) matrix) of `FJE`

corresponds to one possible association between all the tracks and detections. The
feasible joint event matrix on each page satisfies:

The matrix has exactly one "1" value per row.

Except for the first column, which maps to clutter, there can be at most one "1" per column.

For more details on feasible joint events, see Feasible Joint Events.

**Data Types: **`logical`

`FJEProbs`

— Probabilities of feasible joint events

*p*-by-1 vector of nonnegative scalars

Probabilities of feasible joint events, returned as a *p*-by-1
vector of nonnegative scalars. The summation of these scalars is equal to 1. The
*k*-th element represents the probability of the k-th joint events
(specified in the `FJE`

output argument) normalized over the
*p* feasible joint events.

**Data Types: **`logical`

## More About

### Feasible Joint Events

In the typical workflow for a tracking system, the tracker needs to determine
if a detection can be associated with any of the existing tracks. If the tracker only
maintains one track, the assignment can be done by evaluating the validation gate around the
predicted measurement and deciding if the measurement falls within the *validation
gate*. In the measurement space, the validation gate is a spatial boundary,
such as a 2-D ellipse or a 3-D ellipsoid, centered at the predicted measurement. The
validation gate is defined using the probability information (state estimation and
covariance, for example) of the existing track, such that the correct or ideal detections
have high likelihood (97% probability, for example) of falling within this validation gate.

However, if a tracker maintains multiple tracks, the data association process becomes more
complicated, because one detection can fall within the validation gates of multiple tracks.
For example, in the following figure, tracks *T*_{1}
and *T*_{2} are actively maintained in the tracker, and
each of them has its own validation gate. Since the detection
*D*_{2} is in the intersection of the validation
gates of both *T*_{1} and
*T*_{2}, the two tracks
(*T*_{1} and
*T*_{2}) are connected and form a
*cluster*. A cluster is a set of connected tracks and their
associated detections.

To represent the association relationship in a cluster, the validation matrix is commonly
used. Each row of the validation matrix corresponds to a detection while each column
corresponds to a track. To account for the eventuality of each detection being clutter, a
first column is added and usually referred to as "Track 0" or
*T*_{0}. If detection
*D*_{i} is inside the
validation gate of track *T*_{j},
then the (*i*, *j*+1) entry of the validation matrix is 1.
Otherwise, it is zero. For the cluster shown in the figure, the validation matrix Ω
is

$$\Omega =\left[\begin{array}{ccc}1& 1& 0\\ 1& 1& 1\\ 1& 0& 1\end{array}\right]$$

Note that all the elements in the first column of Ω are 1, because any detection can be clutter or false alarm. One important step in the logic of joint probabilistic data association (JPDA) is to obtain all the feasible independent joint events in a cluster. Two assumptions for the feasible joint events are:

A detection cannot be emitted by more than one track.

A track cannot be detected more than once by the sensor during a single scan.

Based on these two assumptions, feasible joint events (FJEs) can be formulated. Each FJE is
mapped to an FJE matrix Ω_{p} from the initial
validation matrix Ω. For example, with the validation matrix Ω, eight FJE matrices can be
obtained:

$$\begin{array}{l}{\Omega}_{1}=\left[\begin{array}{ccc}1& 0& 0\\ 1& 0& 0\\ 1& 0& 0\end{array}\right],\text{\hspace{0.17em}}\text{\hspace{0.05em}}\text{\hspace{0.17em}}{\Omega}_{2}=\left[\begin{array}{ccc}0& 1& 0\\ 1& 0& 0\\ 1& 0& 0\end{array}\right],\text{\hspace{0.17em}}\text{\hspace{0.17em}}{\Omega}_{3}=\left[\begin{array}{ccc}1& 0& 0\\ 0& 1& 0\\ 1& 0& 0\end{array}\right],\text{\hspace{0.17em}}\text{\hspace{0.17em}}{\Omega}_{4}=\left[\begin{array}{ccc}1& 0& 0\\ 0& 0& 1\\ 1& 0& 0\end{array}\right]\\ {\Omega}_{5}=\left[\begin{array}{ccc}0& 1& 0\\ 0& 0& 1\\ 1& 0& 0\end{array}\right],\text{\hspace{0.17em}}\text{\hspace{0.17em}}{\Omega}_{6}=\left[\begin{array}{ccc}1& 0& 0\\ 1& 0& 0\\ 0& 0& 1\end{array}\right],\text{\hspace{0.17em}}\text{\hspace{0.17em}}{\Omega}_{7}=\left[\begin{array}{ccc}0& 1& 0\\ 1& 0& 0\\ 0& 0& 1\end{array}\right],\text{\hspace{0.17em}}\text{\hspace{0.17em}}{\Omega}_{8}=\left[\begin{array}{ccc}1& 0& 0\\ 0& 1& 0\\ 0& 0& 1\end{array}\right]\end{array}$$

As a direct consequence of the two assumptions, the Ω_{p} matrices have
exactly one "1" value per row. Also, except for the first column which maps to clutter,
there can be at most one "1" per column. When the number of connected tracks grows in a
cluster, the number of FJE increases rapidly. The `jpdaEvents`

function
uses an efficient depth-first search algorithm to generate all the feasible joint event
matrices.

## References

[1] Zhou, Bin, and N. K. Bose.
"*Multitarget tracking in clutter: Fast algorithms for data
association.*" IEEE Transactions on aerospace and electronic systems 29, no. 2
(1993): 352-363.

[2] Fisher, James L., and David P.
Casasent. "*Fast JPDA multitarget tracking algorithm.*" Applied optics
28, no. 2 (1989): 371-376.

## Extended Capabilities

### C/C++ Code Generation

Generate C and C++ code using MATLAB® Coder™.

Usage notes and limitations:

When dynamic memory allocation is disabled in the generated code, the order of events with the same probability can be different from the results in MATLAB.

## Version History

**Introduced in R2019a**

## See Also

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)