public abstract class AbstractParticleFilter extends TypedCompositeActor implements MapConstrained
ParticleFilter
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractParticleFilter.InputType
Type of user-added input
|
CompositeEntity.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
protected IORelation[] |
_inputRelations
Array of input Relations.
|
protected java.lang.String[] |
_particleLabels
Labels of particles, that contains state names and a weight label.
|
protected Type[] |
_particleTypes
Types of each particle dimension.
|
protected double[][] |
_Sigma
Measurement covariance matrix.
|
protected java.lang.String[] |
_stateLabels
Labels of states.
|
protected ArrayToken |
_stateNames
Cached State variable names.
|
protected Type[] |
_stateTypes
Types of each state dimension.
|
protected boolean |
_upToDate
Flag indicating whether the contained model is up to date.
|
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.
|
Parameter |
lowVarianceSampler
Low-variance resampler.
|
protected static java.lang.String |
MEASUREMENT_NOISE
Noise covariance identifier.
|
protected static java.lang.String |
MEASUREMENT_POSTFIX
Measurement variable postfix.
|
Parameter |
outputParticleCount
Number of output particles.
|
Parameter |
particleCount
Number of internal particles used to estimate the posterior distribution.
|
TypedIOPort |
particleOutput
The output port that outputs the produced particles at each firing.
|
protected static java.lang.String |
PRIOR_NAME
Prior distribution identifier.
|
protected static java.lang.String |
PROCESS_NOISE
Process Noise identifier.
|
SharedParameter |
resetOnEachRun
Boolean parameter to determine whether seeds are reset on each run.
|
SharedParameter |
seed
The seed to be used for random token generation, to evaluate
probabilistic transitions between states.
|
protected static java.lang.String |
STATE_VARIABLE_NAMES
State Variable names identifier.
|
TypedIOPort |
stateEstimate
State estimate output.
|
Parameter |
t
The value of current time.
|
protected static java.lang.String |
UPDATE_POSTFIX
Update variable postfix.
|
_actorFiringListeners, _causalityInterface, _derivedPiggybacks, _initializables, _notifyingActorFiring, _piggybacks, _publishedPorts, _publisherRelations, _stopRequested, _subscribedPorts
_levelCrossingLinks
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
COMPLETED, NOT_READY, STOP_ITERATING
Constructor and Description |
---|
AbstractParticleFilter(CompositeEntity container,
java.lang.String name)
Construct the composite actor with a name and a container.
|
AbstractParticleFilter(Workspace workspace)
Construct a PF in the specified
workspace with no container and an empty string as a name.
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
_checkParameters()
Check the dimensions of all parameters and ports.
|
protected void |
_constrainParticles()
Constrain particles within a map region if applicable.
|
void |
attributeChanged(Attribute attribute)
If the argument is any parameter other than stateVariableNames
t, or any parameter matching an input port,
then request reinitialization.
|
void |
fire()
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.
|
protected abstract AbstractParticleFilter.InputType |
getInputType(java.lang.String inputName)
Get input type by name reference
|
protected abstract Parameter |
getMeasurementParameter(java.lang.String fullName)
Returns a parameter value corresponding to a measurement.
|
protected java.lang.String |
getMeasurementParameterExpression(java.lang.String fullName)
Get measurement parameter expression.
|
protected abstract Parameter |
getNoiseParameter(java.lang.String inputName)
Returns a parameter value corresponding to a noise distribution.
|
protected abstract Parameter |
getUserDefinedParameter(java.lang.String parameterName)
Return the Parameter that is part of a state space model.
|
protected java.lang.String |
getUserDefinedParameterExpression(java.lang.String parameterName)
Return the expression for a user-defined parameter.
|
void |
preinitialize()
Create the model inside from the parameter values.
|
void |
wrapup()
If this actor is opaque, then invoke the wrapup() method of the local
director.
|
_addEntity, _addPort, _addRelation, _checkTypesFromTo, _destinationTypeConstraints, attributeTypeChanged, isBackwardTypeInferenceEnabled, newPort, newRelation, resolveTypes, typeConstraintList, typeConstraints
_actorFiring, _actorFiring, _finishedAddEntity, _setDirector, _transferPortParameterInputs, addActorFiringListener, addInitializable, addPiggyback, clone, connectionsChanged, createReceivers, createSchedule, getCausalityInterface, getDirector, getExecutiveDirector, getManager, getPublishedPort, getPublishedPortChannel, getPublishedPorts, getSubscribedPortChannel, inferringWidths, inferWidths, initialize, inputPortList, isFireFunctional, isOpaque, isPublishedPort, isStrict, iterate, linkToPublishedPort, linkToPublishedPort, linkToPublishedPort, linkToPublishedPort, needsWidthInference, newInsideReceiver, newReceiver, notifyConnectivityChange, outputPortList, postfire, prefire, recordFiring, registerPublisherPort, registerPublisherPort, removeActorFiringListener, removeInitializable, removePiggyback, requestChange, setContainer, setDirector, setManager, stop, stopFire, terminate, unlinkToPublishedPort, unlinkToPublishedPort, unlinkToPublishedPort, unlinkToPublishedPort, unregisterPublisherPort, unregisterPublisherPort
_adjustDeferrals, _containedDecorators, _deepOpaqueEntityList, _description, _exportMoMLContents, _removeEntity, _removeRelation, _validateSettables, allAtomicEntityList, allowLevelCrossingConnect, classDefinitionList, connect, connect, containedObjectsIterator, deepCompositeEntityList, deepEntityList, deepGetEntities, deepNamedObjList, deepOpaqueEntityList, deepRelationSet, entityList, entityList, exportLinks, exportMoML, getAttribute, getEntities, getEntity, getPort, getRelation, getRelations, isAtomic, lazyAllAtomicEntityList, lazyAllCompositeEntityList, lazyAllCompositeTransparentAndOpaqueEntityList, lazyClassDefinitionList, lazyDeepEntityList, lazyEntityList, lazyRelationList, numberOfEntities, numberOfRelations, numEntities, numRelations, relationList, removeAllEntities, removeAllRelations, setClassDefinition, statistics, uniqueName
_checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
_removePort, connectedPortList, connectedPorts, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts
_setParent, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, clone, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
satisfiesMapConstraints
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
isFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminate
addInitializable, initialize, removeInitializable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
getDerivedLevel, getDerivedList, propagateValue
public Parameter bootstrap
public Parameter lowVarianceSampler
public Parameter particleCount
public Parameter outputParticleCount
public TypedIOPort particleOutput
public TypedIOPort stateEstimate
public Parameter t
public SharedParameter resetOnEachRun
public SharedParameter seed
protected boolean _upToDate
protected ArrayToken _stateNames
protected IORelation[] _inputRelations
protected java.lang.String[] _particleLabels
protected Type[] _particleTypes
protected java.lang.String[] _stateLabels
protected Type[] _stateTypes
protected double[][] _Sigma
protected static final java.lang.String STATE_VARIABLE_NAMES
protected static final java.lang.String PROCESS_NOISE
protected static final java.lang.String MEASUREMENT_NOISE
protected static final java.lang.String UPDATE_POSTFIX
protected static final java.lang.String MEASUREMENT_POSTFIX
protected static final java.lang.String PRIOR_NAME
public AbstractParticleFilter(CompositeEntity container, java.lang.String name) throws NameDuplicationException, IllegalActionException
container
- The container.name
- The name.NameDuplicationException
- If another entity already had
this name.IllegalActionException
- If there was an internal problem.public AbstractParticleFilter(Workspace workspace) throws IllegalActionException, NameDuplicationException
workspace
- The workspace that will list the actor.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.public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged
in class TypedCompositeActor
attribute
- The attribute that changed.IllegalActionException
- If the numerator and the
denominator matrix is not a row vector.public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class CompositeActor
IllegalActionException
- If there is no director, or if
the director's fire() method throws it, or if the actor is not
opaque.public void preinitialize() throws IllegalActionException
preinitialize
in interface Initializable
preinitialize
in class CompositeActor
IllegalActionException
- If there is no director,
or if any contained actors throws it in its preinitialize() method.protected abstract AbstractParticleFilter.InputType getInputType(java.lang.String inputName)
inputName
- The name of the inputpublic void wrapup() throws IllegalActionException
CompositeActor
wrapup
in interface Initializable
wrapup
in class CompositeActor
IllegalActionException
- If there is no director,
or if the director's wrapup() method throws it, or if this
actor is not opaque.protected abstract void _checkParameters() throws IllegalActionException
IllegalActionException
- If the dimensions are illegal.protected java.lang.String getUserDefinedParameterExpression(java.lang.String parameterName) throws IllegalActionException
parameterName
- Name of parameterIllegalActionException
protected abstract Parameter getUserDefinedParameter(java.lang.String parameterName) throws IllegalActionException
parameterName
- Name of parameterIllegalActionException
protected java.lang.String getMeasurementParameterExpression(java.lang.String fullName) throws IllegalActionException
fullName
- Name of the measurement ParameterIllegalActionException
protected abstract Parameter getMeasurementParameter(java.lang.String fullName) throws IllegalActionException
fullName
- Name of measurement parameterIllegalActionException
protected abstract Parameter getNoiseParameter(java.lang.String inputName) throws IllegalActionException
inputName
- Name of noise parameterIllegalActionException
protected void _constrainParticles()