Class ParticleFilter

  • All Implemented Interfaces:
    java.lang.Cloneable, MapConstrained, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
    Direct Known Subclasses:
    ParticleFilterRange

    public class ParticleFilter
    extends AbstractParticleFilter
    A Particle Filter Implementation

    The particle filter runs on a state space model given by

     X_{t+1} = f(X_t, U_t, t)
     Y_{t} = g(X_t, U_t, t)
     X(0) = X0
     
    where X is the state vector, U is the input vector, Y is the observation vector, and t is the model time. To use this actor :
    • For each control input in U, create an input port with an arbitrary name. This actor will automatically create a parameter with the same name as the input port. That parameter will have its value set during execution to match the value of the input.
    • Fill in the stateVariableNames parameter, which is an array of strings, with the names of the state variables in X. These names can be arbitrary, since you will refer them to by name rather than by the symbol X.
    • Specify an update function (part of f above) for each state variable by creating a parameter named name_update, where name is the name of the state variable. The value of this parameter should be an expression giving the rate of change of this state variable as a function of any of the state variables, any input, any other actor parameter, and (possibly), the variable t, representing current time.
    • For each measurement input, create an input port with name measurementName_m, where measurementName is an arbitrary measurement name. Add a parameter to the actor named measurementName, which is an expression describing the measurement's correspondence to the state space. Namely, the measurement equation should be a function of stateVariableNames, U and t.
    • Fill in the measurement covariance parameter, that should be a square double matrix with dimension equal to the number of measurement equations defined. In case the measurements are independent, the matrix should be a scaled identity
    • Fill in the processNoise parameter, which should be a function that samples from the (possibly multivariate) distribution the state transition process noise is distributed according to. The return type should be an array of size equal to the state-space size
    • Specify the prior distribution as a random function from which the particles will be sampled. For instance, use the the random() function to draw uniform random variables in [0,1] or use multivariateGaussian() or gaussian() for Gaussian priors.The return type should be an array of size equal to the state-space size
    • It is important to note how multiple measurement inputs are interpreted by the actor. This implementation interprets multiple measurement inputs to be conditionally independent given the hidden state. This allows the likelihood (weight) of each particle at time step t to be computed as a product of its likelihood with respect to each measurement at that time.
    • For additional parameters that are time varying, add arbitrarily many PortParameters to the actor and refer to the port parameter by port name within measurement and/or update equations.
    The preinitialize() method of this actor is based on the ptolemy.domain.ct.lib.DifferentialSystem actor by Jie Liu.
    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Ilge Akkaya
    Pt.AcceptedRating:
    Red (ilgea)
    Pt.ProposedRating:
    Red (ilgea)
    • Field Detail

      • measurementCovariance

        public Parameter measurementCovariance
        Standard deviation of the measurement noise ( assuming Gaussian measurement noise at the moment).
      • prior

        public Parameter prior
        An expression for the prior distribution from which the samples are drawn.
      • processNoise

        public Parameter processNoise
        The process noise. If the system contains multiple state variables, the process noise should be an expression that returns an ArrayToken. See multivariateGaussian for one such function.
      • stateVariableNames

        public Parameter stateVariableNames
        The names of the state variables, in an array of strings. The default is an ArrayToken of an empty String.
    • Constructor Detail

      • ParticleFilter

        public ParticleFilter​(Workspace workspace)
                       throws IllegalActionException,
                              NameDuplicationException
        Construct a PF in the specified workspace with no container and an empty string as a name. You can then change the name with setName(). If the workspace argument is null, then use the default workspace.
        Parameters:
        workspace - The workspace that will list the actor.
        Throws:
        IllegalActionException - If the name has a period in it, or the director is not compatible with the specified container.
        NameDuplicationException - If the container already contains an entity with the specified name.