This PR has introduced the optional property constraint_func to ParticleUpdater and MCMCRegulariser. If defined, this is intended to enforce that particle states should not exceed certain values by modifying the associated weights, increasing the likelihood of resampling. Here the constraint function should accept a ParticleState type and return a logical index of particles that exceed the defined constraints. An example of this can be seen here:
https://github.com/timothy-glover/Stone-Soup/blob/7ae343e147176107a35fafa81c00c2a7d879561e/stonesoup/regulariser/tests/test_particle.py#L16-L18
This PR has introduced the optional property
constraint_func
toParticleUpdater
andMCMCRegulariser
. If defined, this is intended to enforce that particle states should not exceed certain values by modifying the associated weights, increasing the likelihood of resampling. Here the constraint function should accept aParticleState
type and return a logical index of particles that exceed the defined constraints. An example of this can be seen here: https://github.com/timothy-glover/Stone-Soup/blob/7ae343e147176107a35fafa81c00c2a7d879561e/stonesoup/regulariser/tests/test_particle.py#L16-L18A bug was also spotted in the test for the
ParticleUpdater
. The original line, seen below, was passing regardless of what the weights are. This has been replaced with a check to ensure the sum of the weights is correct. https://github.com/dstl/Stone-Soup/blob/f24090cc919b3b590b84f965a3884ed1293d181d/stonesoup/updater/tests/test_particle.py#L74