Class NonLinearFingerprintPositionEstimator<P extends com.irurueta.geometry.Point<?>>

Type Parameters:
P - a Point type.
Direct Known Subclasses:
NonLinearFingerprintPositionEstimator2D, NonLinearFingerprintPositionEstimator3D

public abstract class NonLinearFingerprintPositionEstimator<P extends com.irurueta.geometry.Point<?>> extends FingerprintPositionEstimator<P>
Base class for position estimators based on located fingerprints containing only RSSI readings and having as well prior knowledge of the location of radio sources associated to those readings. This implementation uses a Taylor approximation over provided located fingerprints to determine an approximate position for a non-located fingerprint using a non-linear solving algorithm. An initial position can be provided as a starting point to solve the position, otherwise the average point of selected nearest fingerprints is used as a starting point.
  • Field Details

    • FALLBACK_RSSI_STANDARD_DEVIATION

      public static final double FALLBACK_RSSI_STANDARD_DEVIATION
      Default RSSI standard deviation assumed for provided fingerprints as a fallback when none can be determined.
      See Also:
    • DEFAULT_PROPAGATE_FINGERPRINT_RSSI_STANDARD_DEVIATION

      public static final boolean DEFAULT_PROPAGATE_FINGERPRINT_RSSI_STANDARD_DEVIATION
      Indicates that by default measured RSSI standard deviation of closest fingerprint must be propagated into measured RSSI reading variance at unknown location.
      See Also:
    • DEFAULT_PROPAGATE_PATHLOSS_EXPONENT_STANDARD_DEVIATION

      public static final boolean DEFAULT_PROPAGATE_PATHLOSS_EXPONENT_STANDARD_DEVIATION
      Indicates that by default path-loss exponent standard deviation of radio source must be propagated into measured RSSI reading variance at unknown location.
      See Also:
    • DEFAULT_PROPAGATE_FINGERPRINT_POSITION_COVARIANCE

      public static final boolean DEFAULT_PROPAGATE_FINGERPRINT_POSITION_COVARIANCE
      Indicates that by default covariance of closest fingerprint position must be propagated into measured RSSI reading variance at unknown location.
      See Also:
    • DEFAULT_PROPAGATE_RADIO_SOURCE_POSITION_COVARIANCE

      public static final boolean DEFAULT_PROPAGATE_RADIO_SOURCE_POSITION_COVARIANCE
      Indicates that by default covariance of radio source position must be propagated into measured RSSI reading variance at unknown location.
      See Also:
    • DEFAULT_TYPE

      public static final NonLinearFingerprintPositionEstimatorType DEFAULT_TYPE
      Default type to be used when none is provided.
    • TINY_RSSI_STD

      public static final double TINY_RSSI_STD
      Small value to be used as the minimum allowed RSSI standard deviations. A value larger than this must be provided to allow convergence to a solution
      See Also:
    • mInitialPosition

      private P extends com.irurueta.geometry.Point<?> mInitialPosition
      Initial position to start the solving algorithm. This should be a value close to the expected solution. If no value is provided, the average position among all selected nearest located fingerprints will be used.
    • mFallbackRssiStandardDeviation

      private double mFallbackRssiStandardDeviation
      RSSI standard deviation fallback value to use when none can be determined from provided readings. This fallback value is only used if no variance is propagated or the resulting value is too small to allow convergence to a solution.
    • mPropagateFingerprintRssiStandardDeviation

      private boolean mPropagateFingerprintRssiStandardDeviation
      Indicates whether measured RSSI standard deviation of closest fingerprint must be propagated into measured RSSI reading variance at unknown location.
    • mPropagatePathlossExponentStandardDeviation

      private boolean mPropagatePathlossExponentStandardDeviation
      Indicates whether path-loss exponent standard deviation of radio source must be propagated into measured RSSI reading variance at unknown location.
    • mPropagateFingerprintPositionCovariance

      private boolean mPropagateFingerprintPositionCovariance
      Indicates whether covariance of closest fingerprint position must be propagated into measured RSSI reading variance at unknown location.
    • mPropagateRadioSourcePositionCovariance

      private boolean mPropagateRadioSourcePositionCovariance
      Indicates whether covariance of radio source position must be propagated into measured RSSI reading variance at unknown location.
    • mFitter

      private final com.irurueta.numerical.fitting.LevenbergMarquardtMultiDimensionFitter mFitter
      Levenberg-Marquardt fitter to find a non-linear solution.
    • mCovariance

      private com.irurueta.algebra.Matrix mCovariance
      Estimated covariance matrix for estimated position.
    • mChiSq

      private double mChiSq
      Estimated chi square value.
  • Constructor Details

    • NonLinearFingerprintPositionEstimator

      protected NonLinearFingerprintPositionEstimator()
      Constructor.
    • NonLinearFingerprintPositionEstimator

      protected NonLinearFingerprintPositionEstimator(FingerprintPositionEstimatorListener<P> listener)
      Constructor.
      Parameters:
      listener - listener in charge of handling events.
    • NonLinearFingerprintPositionEstimator

      protected NonLinearFingerprintPositionEstimator(List<? extends RssiFingerprintLocated<? extends RadioSource,? extends RssiReading<? extends RadioSource>,P>> locatedFingerprints, RssiFingerprint<? extends RadioSource,? extends RssiReading<? extends RadioSource>> fingerprint, List<? extends RadioSourceLocated<P>> sources)
      Constructor.
      Parameters:
      locatedFingerprints - located fingerprints containing RSSI readings.
      fingerprint - fingerprint containing readings at an unknown location for provided located fingerprints.
      sources - located radio sources.
      Throws:
      IllegalArgumentException - if provided non located fingerprint is null, located fingerprints value is null or there are not enough fingerprints or readings within provided fingerprints (for 2D position estimation at least 2 located total readings are required among all fingerprints, for example 2 readings are required in a single fingerprint, or at least 2 fingerprints at different locations containing a single reading are required. For 3D position estimation 3 located total readings are required among all fingerprints).
    • NonLinearFingerprintPositionEstimator

      protected NonLinearFingerprintPositionEstimator(List<? extends RssiFingerprintLocated<? extends RadioSource,? extends RssiReading<? extends RadioSource>,P>> locatedFingerprints, RssiFingerprint<? extends RadioSource,? extends RssiReading<? extends RadioSource>> fingerprint, List<? extends RadioSourceLocated<P>> sources, FingerprintPositionEstimatorListener<P> listener)
      Constructor.
      Parameters:
      locatedFingerprints - located fingerprints containing RSSI readings.
      fingerprint - fingerprint containing readings at an unknown location for provided located fingerprints.
      sources - located radio sources.
      listener - listener in charge of handling events.
      Throws:
      IllegalArgumentException - if provided non located fingerprint is null, located fingerprints value is null or there are not enough fingerprints or readings within provided fingerprints (for 2D position estimation at least 2 located total readings are required among all fingerprints, for example 2 readings are required in a single fingerprint, or at least 2 fingerprints at different locations containing a single reading are required. For 3D position estimation 3 located total readings are required among all fingerprints).
    • NonLinearFingerprintPositionEstimator

      protected NonLinearFingerprintPositionEstimator(List<? extends RssiFingerprintLocated<? extends RadioSource,? extends RssiReading<? extends RadioSource>,P>> locatedFingerprints, RssiFingerprint<? extends RadioSource,? extends RssiReading<? extends RadioSource>> fingerprint, List<? extends RadioSourceLocated<P>> sources, P initialPosition)
      Constructor.
      Parameters:
      locatedFingerprints - located fingerprints containing RSSI readings.
      fingerprint - fingerprint containing readings at an unknown location for provided located fingerprints.
      sources - located radio sources.
      initialPosition - initial position to start the solving algorithm or null.
      Throws:
      IllegalArgumentException - if provided non located fingerprint is null, located fingerprints value is null or there are not enough fingerprints or readings within provided fingerprints (for 2D position estimation at least 2 located total readings are required among all fingerprints, for example 2 readings are required in a single fingerprint, or at least 2 fingerprints at different locations containing a single reading are required. For 3D position estimation 3 located total readings are required among all fingerprints).
    • NonLinearFingerprintPositionEstimator

      protected NonLinearFingerprintPositionEstimator(List<? extends RssiFingerprintLocated<? extends RadioSource,? extends RssiReading<? extends RadioSource>,P>> locatedFingerprints, RssiFingerprint<? extends RadioSource,? extends RssiReading<? extends RadioSource>> fingerprint, List<? extends RadioSourceLocated<P>> sources, P initialPosition, FingerprintPositionEstimatorListener<P> listener)
      Constructor.
      Parameters:
      locatedFingerprints - located fingerprints containing RSSI readings.
      fingerprint - fingerprint containing readings at an unknown location for provided located fingerprints.
      sources - located radio sources.
      initialPosition - initial position to start the solving algorithm or null.
      listener - listener in charge of handling events.
      Throws:
      IllegalArgumentException - if provided non located fingerprint is null, located fingerprints value is null or there are not enough fingerprints or readings within provided fingerprints (for 2D position estimation at least 2 located total readings are required among all fingerprints, for example 2 readings are required in a single fingerprint, or at least 2 fingerprints at different locations containing a single reading are required. For 3D position estimation 3 located total readings are required among all fingerprints).
  • Method Details

    • getInitialPosition

      public P getInitialPosition()
      Gets initial position to start the solving algorithm. This should be a value close to the expected solution. If no value is provided, the average position among all selected nearest located fingerprints will be used.
      Returns:
      initial position to start the solving algorithm or null.
    • setInitialPosition

      public void setInitialPosition(P initialPosition) throws com.irurueta.navigation.LockedException
      Sets initial position to start the solving algorithm. This should be a value close to the expected solution. If no value is provided, the average position among all selected nearest located fingerprints will be used.
      Parameters:
      initialPosition - initial position to start the solving algorithm or null.
      Throws:
      com.irurueta.navigation.LockedException - if estimator is locked.
    • getFallbackRssiStandardDeviation

      public double getFallbackRssiStandardDeviation()
      Gets RSSI standard deviation fallback value to use when none can be determined from provided readings.
      Returns:
      RSSI standard deviation fallback.
    • setFallbackRssiStandardDeviation

      public void setFallbackRssiStandardDeviation(double fallbackRssiStandardDeviation) throws com.irurueta.navigation.LockedException
      Sets RSSI standard deviation fallback value to use when none can be determined from provided readings.
      Parameters:
      fallbackRssiStandardDeviation - RSSI standard deviation fallback
      Throws:
      com.irurueta.navigation.LockedException - if estimator is locked.
      IllegalArgumentException - if provided value is smaller than TINY_RSSI_STD.
    • isFingerprintRssiStandardDeviationPropagated

      public boolean isFingerprintRssiStandardDeviationPropagated()
      Indicates whether measured RSSI standard deviation of closest fingerprint must be propagated into measured RSSI reading variance at unknown location.
      Returns:
      true to propagate RSSI standard deviation of closest fingerprint, false otherwise.
    • setFingerprintRssiStandardDeviationPropagated

      public void setFingerprintRssiStandardDeviationPropagated(boolean propagateFingerprintRssiStandardDeviation) throws com.irurueta.navigation.LockedException
      Specifies whether measured RSSI standard deviation of closest fingerprint must be propagated into measured RSSI reading variance at unknown location.
      Parameters:
      propagateFingerprintRssiStandardDeviation - true to propagate RSSI standard deviation of closest fingerprint, false otherwise.
      Throws:
      com.irurueta.navigation.LockedException - if estimator is locked.
    • isPathlossExponentStandardDeviationPropagated

      public boolean isPathlossExponentStandardDeviationPropagated()
      Indicates whether path-loss exponent standard deviation of radio source must be propagated into measured RSSI reading variance at unknown location.
      Returns:
      true to propagate path-loss exponent standard deviation of radio source, false otherwise.
    • setPathlossExponentStandardDeviationPropagated

      public void setPathlossExponentStandardDeviationPropagated(boolean propagatePathlossExponentStandardDeviation) throws com.irurueta.navigation.LockedException
      Specifies whether path-loss exponent standard deviation of radio source must be propagated into measured RSSI reading variance at unknown location.
      Parameters:
      propagatePathlossExponentStandardDeviation - true to propagate path-loss exponent standard deviation of radio source, false otherwise.
      Throws:
      com.irurueta.navigation.LockedException - if estimator is locked.
    • isFingerprintPositionCovariancePropagated

      public boolean isFingerprintPositionCovariancePropagated()
      Indicates whether covariance of closest fingerprint position must be propagated into measured RSSI reading variance at unknown location.
      Returns:
      true to propagate fingerprint position covariance, false otherwise.
    • setFingerprintPositionCovariancePropagated

      public void setFingerprintPositionCovariancePropagated(boolean propagateFingerprintPositionCovariance) throws com.irurueta.navigation.LockedException
      Specifies whether covariance of closest fingerprint position must be propagated into measured RSSI reading variance at unknown location.
      Parameters:
      propagateFingerprintPositionCovariance - true to propagate fingerprint position covariance, false otherwise.
      Throws:
      com.irurueta.navigation.LockedException - if estimator is locked.
    • isRadioSourcePositionCovariancePropagated

      public boolean isRadioSourcePositionCovariancePropagated()
      Indicates whether covariance of radio source position must be propagated into measured RSSI reading variance at unknown location.
      Returns:
      true to propagate radio source position covariance, false otherwise.
    • setRadioSourcePositionCovariancePropagated

      public void setRadioSourcePositionCovariancePropagated(boolean propagateRadioSourcePositionCovariance) throws com.irurueta.navigation.LockedException
      Specifies whether covariance of radio source position must be propagated into measured RSSI reading variance at unknown location.
      Parameters:
      propagateRadioSourcePositionCovariance - true to propagate radio source position covariance, false otherwise.
      Throws:
      com.irurueta.navigation.LockedException - if estimator is locked.
    • getCovariance

      public com.irurueta.algebra.Matrix getCovariance()
      Gets estimated covariance matrix for estimated position.
      Returns:
      estimated covariance matrix for estimated position.
    • getChiSq

      public double getChiSq()
      Gets estimated chi square value.
      Returns:
      estimated chi square value.
    • estimate

      public void estimate() throws com.irurueta.navigation.LockedException, com.irurueta.navigation.NotReadyException, FingerprintEstimationException
      Estimates position based on provided located radio sources and readings of such radio sources at an unknown location.
      Specified by:
      estimate in class BaseFingerprintPositionEstimator<P extends com.irurueta.geometry.Point<?>,FingerprintPositionEstimatorListener<P extends com.irurueta.geometry.Point<?>>>
      Throws:
      com.irurueta.navigation.LockedException - if estimator is locked.
      com.irurueta.navigation.NotReadyException - if estimator is not ready.
      FingerprintEstimationException - if estimation fails for some other reason.
    • getType

      public abstract NonLinearFingerprintPositionEstimatorType getType()
      Gets type of position estimator.
      Returns:
      type of position estimator.
    • evaluate

      protected abstract double evaluate(int i, double[] point, double[] params, double[] derivatives)
      Evaluates a non-linear multi dimension function at provided point using provided parameters and returns its evaluation and derivatives of the function respect the function parameters.
      Parameters:
      i - number of sample being evaluated.
      point - point where function will be evaluated.
      params - initial parameters estimation to be tried. These will change as the Levenberg-Marquardt algorithm iterates to the best solution. These are used as input parameters along with point to evaluate function.
      derivatives - partial derivatives of the function respect to each provided parameter.
      Returns:
      function evaluation at provided point.
    • propagateVariances

      protected abstract Double propagateVariances(double fingerprintRssi, double pathlossExponent, P fingerprintPosition, P radioSourcePosition, P estimatedPosition, Double fingerprintRssiVariance, Double pathlossExponentVariance, com.irurueta.algebra.Matrix fingerprintPositionCovariance, com.irurueta.algebra.Matrix radioSourcePositionCovariance)
      Propagates provided variances into RSSI variance of non-located fingerprint reading.
      Parameters:
      fingerprintRssi - closest located fingerprint reading RSSI expressed in dBm's.
      pathlossExponent - path-loss exponent.
      fingerprintPosition - position of closest located fingerprint.
      radioSourcePosition - radio source position associated to fingerprint reading.
      estimatedPosition - position to be estimated. Usually this is equal to the initial position used by a non-linear algorithm.
      fingerprintRssiVariance - variance of fingerprint RSSI or null if unknown.
      pathlossExponentVariance - variance of path-loss exponent or null if unknown.
      fingerprintPositionCovariance - covariance of fingerprint position or null if unknown.
      radioSourcePositionCovariance - covariance of radio source position or null if unknown.
      Returns:
      variance of RSSI measured at non located fingerprint reading.
    • buildData

      private void buildData(List<Double> allReceivedPower, List<Double> allFingerprintPower, List<P> allFingerprintPositions, List<P> allSourcesPositions, List<Double> allPathLossExponents, List<Double> allStandardDeviations)
      Builds data required to solve the problem.
      Parameters:
      allReceivedPower - list of received powers for readings at unknown positions.
      allFingerprintPower - list of power readings at fingerprint positions.
      allFingerprintPositions - list of fingerprint positions.
      allSourcesPositions - list of radio sources positions.
      allPathLossExponents - list of path loss exponents.
      allStandardDeviations - list of standard deviations for readings being used.
    • setupFitter

      private void setupFitter() throws com.irurueta.numerical.fitting.FittingException
      Setups fitter to solve position.
      Throws:
      com.irurueta.numerical.fitting.FittingException - if Levenberg-Marquardt fitting fails.