Class AbstractParticleFilter

    • Field Detail

      • bootstrap

        public Parameter bootstrap
        A boolean parameter that when set to true, implements the so-called bootstrap particle filter, where particles are resampled at each time step If this parameter is false, particles are resampled only when the effective sample size drops below 50% of the total number of particles.
      • lowVarianceSampler

        public Parameter lowVarianceSampler
        Low-variance resampler.
      • particleCount

        public Parameter particleCount
        Number of internal particles used to estimate the posterior distribution.
      • outputParticleCount

        public Parameter outputParticleCount
        Number of output particles.
      • particleOutput

        public TypedIOPort particleOutput
        The output port that outputs the produced particles at each firing.
      • stateEstimate

        public TypedIOPort stateEstimate
        State estimate output. A record token with one field per state variable
      • t

        public Parameter t
        The value of current time. This parameter is not visible in the expression screen except in expert mode. Its value initially is just 0.0, a double, but upon each firing, it is given a value equal to the current time as reported by the director.
      • resetOnEachRun

        public SharedParameter resetOnEachRun
        Boolean parameter to determine whether seeds are reset on each run.
      • seed

        public SharedParameter seed
        The seed to be used for random token generation, to evaluate probabilistic transitions between states.
      • _upToDate

        protected boolean _upToDate
        Flag indicating whether the contained model is up to date.
      • _stateNames

        protected ArrayToken _stateNames
        Cached State variable names.
      • _inputRelations

        protected IORelation[] _inputRelations
        Array of input Relations.
      • _particleLabels

        protected java.lang.String[] _particleLabels
        Labels of particles, that contains state names and a weight label.
      • _particleTypes

        protected Type[] _particleTypes
        Types of each particle dimension.
      • _stateLabels

        protected java.lang.String[] _stateLabels
        Labels of states.
      • _stateTypes

        protected Type[] _stateTypes
        Types of each state dimension.
      • _Sigma

        protected double[][] _Sigma
        Measurement covariance matrix.
      • STATE_VARIABLE_NAMES

        protected static final java.lang.String STATE_VARIABLE_NAMES
        State Variable names identifier.
        See Also:
        Constant Field Values
      • PROCESS_NOISE

        protected static final java.lang.String PROCESS_NOISE
        Process Noise identifier.
        See Also:
        Constant Field Values
      • MEASUREMENT_NOISE

        protected static final java.lang.String MEASUREMENT_NOISE
        Noise covariance identifier.
        See Also:
        Constant Field Values
      • UPDATE_POSTFIX

        protected static final java.lang.String UPDATE_POSTFIX
        Update variable postfix.
        See Also:
        Constant Field Values
      • MEASUREMENT_POSTFIX

        protected static final java.lang.String MEASUREMENT_POSTFIX
        Measurement variable postfix.
        See Also:
        Constant Field Values
      • PRIOR_NAME

        protected static final java.lang.String PRIOR_NAME
        Prior distribution identifier.
        See Also:
        Constant Field Values
    • Constructor Detail

      • AbstractParticleFilter

        public AbstractParticleFilter​(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.
    • Method Detail

      • attributeChanged

        public void attributeChanged​(Attribute attribute)
                              throws IllegalActionException
        If the argument is any parameter other than stateVariableNames t, or any parameter matching an input port, then request reinitialization.
        Overrides:
        attributeChanged in class TypedCompositeActor
        Parameters:
        attribute - The attribute that changed.
        Throws:
        IllegalActionException - If the numerator and the denominator matrix is not a row vector.
      • fire

        public void fire()
                  throws IllegalActionException
        Override the base class to first set the value of the parameter t to match current time, then to set the local parameters that mirror input values, and then to fire the contained actors.
        Specified by:
        fire in interface Executable
        Overrides:
        fire in class CompositeActor
        Throws:
        IllegalActionException - If there is no director, or if the director's fire() method throws it, or if the actor is not opaque.
      • getInputType

        protected abstract AbstractParticleFilter.InputType getInputType​(java.lang.String inputName)
        Get input type by name reference
        Parameters:
        inputName - The name of the input
        Returns:
        an InputType object indicating the type of input
      • getUserDefinedParameterExpression

        protected java.lang.String getUserDefinedParameterExpression​(java.lang.String parameterName)
                                                              throws IllegalActionException
        Return the expression for a user-defined parameter.
        Parameters:
        parameterName - Name of parameter
        Returns:
        parameter expression
        Throws:
        IllegalActionException
      • getUserDefinedParameter

        protected abstract Parameter getUserDefinedParameter​(java.lang.String parameterName)
                                                      throws IllegalActionException
        Return the Parameter that is part of a state space model.
        Parameters:
        parameterName - Name of parameter
        Returns:
        Parameter object
        Throws:
        IllegalActionException
      • getMeasurementParameterExpression

        protected java.lang.String getMeasurementParameterExpression​(java.lang.String fullName)
                                                              throws IllegalActionException
        Get measurement parameter expression.
        Parameters:
        fullName - Name of the measurement Parameter
        Returns:
        A string expression
        Throws:
        IllegalActionException
      • getMeasurementParameter

        protected abstract Parameter getMeasurementParameter​(java.lang.String fullName)
                                                      throws IllegalActionException
        Returns a parameter value corresponding to a measurement.
        Parameters:
        fullName - Name of measurement parameter
        Returns:
        a Parameter object that by name reference corresponds to a specific measurement.
        Throws:
        IllegalActionException
      • getNoiseParameter

        protected abstract Parameter getNoiseParameter​(java.lang.String inputName)
                                                throws IllegalActionException
        Returns a parameter value corresponding to a noise distribution.
        Parameters:
        inputName - Name of noise parameter
        Returns:
        a Parameter object that by name reference corresponds to a specific noise distribution
        Throws:
        IllegalActionException
      • _constrainParticles

        protected void _constrainParticles()
        Constrain particles within a map region if applicable.