Class RobustRadioSourceEstimator<P extends com.irurueta.geometry.Point<?>,R extends ReadingLocated<P>,L extends RobustRadioSourceEstimatorListener<? extends RobustRadioSourceEstimator<?,?,?>>>

java.lang.Object
com.irurueta.navigation.indoor.radiosource.RobustRadioSourceEstimator<P,R,L>
Type Parameters:
P - a Point type.
R - a ReadingLocated type.
L - a RobustRadioSourceEstimatorListener type.
Direct Known Subclasses:
RobustRangingAndRssiRadioSourceEstimator, RobustRangingRadioSourceEstimator, RobustRssiRadioSourceEstimator

public abstract class RobustRadioSourceEstimator<P extends com.irurueta.geometry.Point<?>,R extends ReadingLocated<P>,L extends RobustRadioSourceEstimatorListener<? extends RobustRadioSourceEstimator<?,?,?>>> extends Object
Robustly estimates a radio source. Usually this implies at least the estimation of the radio source location, however, implementations of this class might estimate additional parameters.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected double
    Amount of confidence expressed as a value between 0.0 and 1.0 (which is equivalent to 100%).
    protected com.irurueta.algebra.Matrix
    Covariance of estimated position, power and/or path-loss exponent.
    static final double
    Constant defining default confidence of the estimated result, which is 99%.
    static final boolean
    Indicates that covariance is kept by default after refining result.
    static final int
    Default maximum allowed number of iterations.
    static final float
    Default amount of progress variation before notifying a change in estimation progress.
    static final boolean
    Indicates that result is refined by default using all found inliers.
    static final com.irurueta.numerical.robust.RobustEstimatorMethod
    Default robust estimator method when none is provided.
    protected P
    Estimated position.
    protected com.irurueta.algebra.Matrix
    Covariance of estimated position.
    protected com.irurueta.numerical.robust.InliersData
    Data related to inliers found after estimation.
    protected boolean
    Indicates whether covariance must be kept after refining result.
    protected L
    Listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
    protected boolean
    Indicates if this instance is locked because estimation is being executed.
    static final double
    Maximum allowed confidence value.
    static final float
    Maximum allowed value for progress delta.
    protected int
    Maximum allowed number of iterations.
    static final double
    Minimum allowed confidence value.
    static final int
    Minimum allowed number of iterations.
    static final float
    Minimum allowed value for progress delta.
    protected int
    Size of subsets to be checked during robust estimation.
    protected float
    Amount of progress variation before notifying a progress change during estimation.
    protected List<? extends R>
    Signal readings belonging to the same radio source to be estimated.
    protected boolean
    Indicates whether result must be refined using found inliers.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Constructor.
    protected
    RobustRadioSourceEstimator(List<? extends R> readings)
    Constructor.
    protected
    RobustRadioSourceEstimator(List<? extends R> readings, L listener)
    Constructor.
    protected
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    areValidReadings(List<? extends R> readings)
    Indicates whether readings are valid or not.
    abstract void
    Robustly estimates position, transmitted power and path-loss exponent for a radio source.
    double
    Returns amount of confidence expressed as a value between 0.0 and 1.0 (which is equivalent to 100%).
    com.irurueta.algebra.Matrix
    Gets covariance for estimated position, power and path-loss.
    Gets estimated position.
    com.irurueta.algebra.Matrix
    Gets estimated position covariance.
    abstract <S extends RadioSourceLocated<P>>
    S
    Gets estimated located radio source.
    com.irurueta.numerical.robust.InliersData
    Gets data related to inliers found after estimation.
    Gets listener in charge of attending events raised by this instance.
    int
    Returns maximum allowed number of iterations.
    abstract int
    Gets minimum required number of readings to estimate power, position and path-loss exponent.
    abstract int
    Gets number of dimensions of position points.
    int
    Gets size of subsets to be checked during robust estimation.
    float
    Returns amount of progress variation before notifying a progress change during estimation.
    double[]
    Returns quality scores corresponding to each pair of positions and distances (i.e. sample).
    Gets signal readings belonging to the same radio source.
    protected void
    internalSetReadings(List<? extends R> readings)
    Internally sets signal readings belonging to the same radio source.
    boolean
    Indicates whether covariance must be kept after refining result.
    boolean
    Indicates whether estimator is locked during estimation.
    abstract boolean
    Indicates whether this instance is ready to start the estimation.
    boolean
    Indicates whether result must be refined using a non-linear solver over found inliers.
    void
    setConfidence(double confidence)
    Sets amount of confidence expressed as a value between 0.0 and 1.0 (which is equivalent to 100%).
    void
    setCovarianceKept(boolean keepCovariance)
    Specifies whether covariance must be kept after refining result.
    void
    setListener(L listener)
    Sets listener in charge of attending events raised by this instance.
    void
    setMaxIterations(int maxIterations)
    Sets maximum allowed number of iterations.
    void
    setPreliminarySubsetSize(int preliminarySubsetSize)
    Sets size of subsets to be checked during estimation.
    void
    setProgressDelta(float progressDelta)
    Sets amount of progress variation before notifying a progress change during estimation.
    void
    setQualityScores(double[] qualityScores)
    Sets quality scores corresponding to each pair of positions and distances (i.e. sample).
    void
    setReadings(List<? extends R> readings)
    Sets signal readings belonging to the same radio source.
    void
    setResultRefined(boolean refineResult)
    Specifies whether result must be refined using a non-linear solver over found inliers.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_ROBUST_METHOD

      public static final com.irurueta.numerical.robust.RobustEstimatorMethod DEFAULT_ROBUST_METHOD
      Default robust estimator method when none is provided.
    • DEFAULT_REFINE_RESULT

      public static final boolean DEFAULT_REFINE_RESULT
      Indicates that result is refined by default using all found inliers.
      See Also:
    • DEFAULT_KEEP_COVARIANCE

      public static final boolean DEFAULT_KEEP_COVARIANCE
      Indicates that covariance is kept by default after refining result.
      See Also:
    • DEFAULT_PROGRESS_DELTA

      public static final float DEFAULT_PROGRESS_DELTA
      Default amount of progress variation before notifying a change in estimation progress. By default, this is set to 5%.
      See Also:
    • MIN_PROGRESS_DELTA

      public static final float MIN_PROGRESS_DELTA
      Minimum allowed value for progress delta.
      See Also:
    • MAX_PROGRESS_DELTA

      public static final float MAX_PROGRESS_DELTA
      Maximum allowed value for progress delta.
      See Also:
    • DEFAULT_CONFIDENCE

      public static final double DEFAULT_CONFIDENCE
      Constant defining default confidence of the estimated result, which is 99%. This means that with a probability of 99% estimation will be accurate because chosen sub-samples will be inliers.
      See Also:
    • DEFAULT_MAX_ITERATIONS

      public static final int DEFAULT_MAX_ITERATIONS
      Default maximum allowed number of iterations.
      See Also:
    • MIN_CONFIDENCE

      public static final double MIN_CONFIDENCE
      Minimum allowed confidence value.
      See Also:
    • MAX_CONFIDENCE

      public static final double MAX_CONFIDENCE
      Maximum allowed confidence value.
      See Also:
    • MIN_ITERATIONS

      public static final int MIN_ITERATIONS
      Minimum allowed number of iterations.
      See Also:
    • readings

      protected List<? extends R extends ReadingLocated<P>> readings
      Signal readings belonging to the same radio source to be estimated.
    • listener

      protected L extends RobustRadioSourceEstimatorListener<? extends RobustRadioSourceEstimator<?,?,?>> listener
      Listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
    • estimatedPosition

      protected P extends com.irurueta.geometry.Point<?> estimatedPosition
      Estimated position.
    • locked

      protected boolean locked
      Indicates if this instance is locked because estimation is being executed.
    • progressDelta

      protected float progressDelta
      Amount of progress variation before notifying a progress change during estimation.
    • confidence

      protected double confidence
      Amount of confidence expressed as a value between 0.0 and 1.0 (which is equivalent to 100%). The amount of confidence indicates the probability that the estimated result is correct. Usually this value will be close to 1.0, but not exactly 1.0.
    • maxIterations

      protected int maxIterations
      Maximum allowed number of iterations. When the maximum number of iterations is exceeded, result will not be available, however an approximate result will be available for retrieval.
    • inliersData

      protected com.irurueta.numerical.robust.InliersData inliersData
      Data related to inliers found after estimation.
    • refineResult

      protected boolean refineResult
      Indicates whether result must be refined using found inliers. If true, inliers will be computed and kept in any implementation regardless of the settings.
    • keepCovariance

      protected boolean keepCovariance
      Indicates whether covariance must be kept after refining result. This setting is only taken into account if result is refined.
    • covariance

      protected com.irurueta.algebra.Matrix covariance
      Covariance of estimated position, power and/or path-loss exponent. This is only available when result has been refined and covariance is kept.
    • estimatedPositionCovariance

      protected com.irurueta.algebra.Matrix estimatedPositionCovariance
      Covariance of estimated position. Size of this matrix will depend on the number of dimensions of estimated position (either 2 or 3). This value will only be available when position estimation is enabled.
    • preliminarySubsetSize

      protected int preliminarySubsetSize
      Size of subsets to be checked during robust estimation.
  • Constructor Details

    • RobustRadioSourceEstimator

      protected RobustRadioSourceEstimator()
      Constructor.
    • RobustRadioSourceEstimator

      protected RobustRadioSourceEstimator(List<? extends R> readings)
      Constructor. Sets located radio signal readings belonging to the same radio source.
      Parameters:
      readings - radio signal readings belonging to the same radio source.
      Throws:
      IllegalArgumentException - if readings are not valid.
    • RobustRadioSourceEstimator

      protected RobustRadioSourceEstimator(L listener)
      Constructor.
      Parameters:
      listener - listener in charge of attending events raised by this instance.
    • RobustRadioSourceEstimator

      protected RobustRadioSourceEstimator(List<? extends R> readings, L listener)
      Constructor. Sets located radio signal readings belonging to the same radio source.
      Parameters:
      readings - radio signal readings belonging to the same radio source.
      listener - listener in charge of attending events raised by this instance.
      Throws:
      IllegalArgumentException - if readings are not valid.
  • Method Details

    • isLocked

      public boolean isLocked()
      Indicates whether estimator is locked during estimation.
      Returns:
      true if estimator is locked, false otherwise.
    • getProgressDelta

      public float getProgressDelta()
      Returns amount of progress variation before notifying a progress change during estimation.
      Returns:
      amount of progress variation before notifying a progress change during estimation.
    • setProgressDelta

      public void setProgressDelta(float progressDelta) throws com.irurueta.navigation.LockedException
      Sets amount of progress variation before notifying a progress change during estimation.
      Parameters:
      progressDelta - amount of progress variation before notifying a progress change during estimation.
      Throws:
      IllegalArgumentException - if progress delta is less than zero or greater than 1.
      com.irurueta.navigation.LockedException - if this estimator is locked.
    • getConfidence

      public double getConfidence()
      Returns amount of confidence expressed as a value between 0.0 and 1.0 (which is equivalent to 100%). The amount of confidence indicates the probability that the estimated result is correct. Usually this value will be close to 1.0, but not exactly 1.0.
      Returns:
      amount of confidence as a value between 0.0 and 1.0.
    • setConfidence

      public void setConfidence(double confidence) throws com.irurueta.navigation.LockedException
      Sets amount of confidence expressed as a value between 0.0 and 1.0 (which is equivalent to 100%). The amount of confidence indicates the probability that the estimated result is correct. Usually this value will be close to 1.0, but not exactly 1.0.
      Parameters:
      confidence - confidence to be set as a value between 0.0 and 1.0.
      Throws:
      IllegalArgumentException - if provided value is not between 0.0 and 1.0.
      com.irurueta.navigation.LockedException - if estimator is locked.
    • getMaxIterations

      public int getMaxIterations()
      Returns maximum allowed number of iterations. If maximum allowed number of iterations is achieved without converging to a result when calling estimate(), a RobustEstimatorException will be raised.
      Returns:
      maximum allowed number of iterations.
    • setMaxIterations

      public void setMaxIterations(int maxIterations) throws com.irurueta.navigation.LockedException
      Sets maximum allowed number of iterations. When the maximum number of iterations is exceeded, result will not be available, however an approximate result will be available for retrieval.
      Parameters:
      maxIterations - maximum allowed number of iterations to be set.
      Throws:
      IllegalArgumentException - if provided value is less than 1.
      com.irurueta.navigation.LockedException - if this estimator is locked.
    • getInliersData

      public com.irurueta.numerical.robust.InliersData getInliersData()
      Gets data related to inliers found after estimation.
      Returns:
      data related to inliers found after estimation.
    • isResultRefined

      public boolean isResultRefined()
      Indicates whether result must be refined using a non-linear solver over found inliers.
      Returns:
      true to refine result, false to simply use result found by robust estimator without further refining.
    • setResultRefined

      public void setResultRefined(boolean refineResult) throws com.irurueta.navigation.LockedException
      Specifies whether result must be refined using a non-linear solver over found inliers.
      Parameters:
      refineResult - true to refine result, false to simply use result found by robust estimator without further refining.
      Throws:
      com.irurueta.navigation.LockedException - if estimator is locked.
    • isCovarianceKept

      public boolean isCovarianceKept()
      Indicates whether covariance must be kept after refining result. This setting is only taken into account if result is refined.
      Returns:
      true if covariance must be kept after refining result, false otherwise.
    • setCovarianceKept

      public void setCovarianceKept(boolean keepCovariance) throws com.irurueta.navigation.LockedException
      Specifies whether covariance must be kept after refining result. This setting is only taken into account if result is refined.
      Parameters:
      keepCovariance - true if covariance must be kept after refining result, false otherwise.
      Throws:
      com.irurueta.navigation.LockedException - if estimator is locked.
    • getReadings

      public List<R> getReadings()
      Gets signal readings belonging to the same radio source.
      Returns:
      signal readings belonging to the same radio source.
    • setReadings

      public void setReadings(List<? extends R> readings) throws com.irurueta.navigation.LockedException
      Sets signal readings belonging to the same radio source.
      Parameters:
      readings - signal readings belonging to the same radio source.
      Throws:
      com.irurueta.navigation.LockedException - if estimator is locked.
      IllegalArgumentException - if readings are not valid.
    • getListener

      public L getListener()
      Gets listener in charge of attending events raised by this instance.
      Returns:
      listener in charge of attending events raised by this instance.
    • setListener

      public void setListener(L listener) throws com.irurueta.navigation.LockedException
      Sets listener in charge of attending events raised by this instance.
      Parameters:
      listener - listener in charge of attending events raised by this instance.
      Throws:
      com.irurueta.navigation.LockedException - if estimator is locked.
    • getQualityScores

      public double[] getQualityScores()
      Returns quality scores corresponding to each pair of positions and distances (i.e. sample). The larger the score value the better the quality of the sample. This implementation always returns null. Subclasses using quality scores must implement proper behavior.
      Returns:
      quality scores corresponding to each sample.
    • setQualityScores

      public void setQualityScores(double[] qualityScores) throws com.irurueta.navigation.LockedException
      Sets quality scores corresponding to each pair of positions and distances (i.e. sample). The larger the score value the better the quality of the sample. This implementation makes no action. Subclasses using quality scores must implement proper behaviour.
      Parameters:
      qualityScores - quality scores corresponding to each pair of matched points.
      Throws:
      IllegalArgumentException - if provided quality scores length is smaller than minimum required samples.
      com.irurueta.navigation.LockedException - if robust solver is locked because an estimation is already in progress.
    • getPreliminarySubsetSize

      public int getPreliminarySubsetSize()
      Gets size of subsets to be checked during robust estimation. This has to be at least getMinReadings()
      Returns:
      size of subsets to be checked during robust estimation.
    • setPreliminarySubsetSize

      public void setPreliminarySubsetSize(int preliminarySubsetSize) throws com.irurueta.navigation.LockedException
      Sets size of subsets to be checked during estimation. This has to be at least getMinReadings().
      Parameters:
      preliminarySubsetSize - size of subsets to be checked during robust estimation.
      Throws:
      com.irurueta.navigation.LockedException - if instance is busy solving the lateration problem.
      IllegalArgumentException - if provided value is less than getMinReadings().
    • getCovariance

      public com.irurueta.algebra.Matrix getCovariance()
      Gets covariance for estimated position, power and path-loss. Matrix contains information in the following order: Top-left sub-matrix contains covariance of position, then follows transmitted power variance, and finally the last element contains path-loss exponent variance. This is only available when result has been refined and covariance is kept.
      Returns:
      covariance for estimated position and power.
    • getEstimatedPositionCovariance

      public com.irurueta.algebra.Matrix getEstimatedPositionCovariance()
      Gets estimated position covariance. Size of this matrix will depend on the number of dimensions of estimated position (either 2 or 3). This is only available when result has been refined and covariance is kept.
      Returns:
      estimated position covariance.
    • getEstimatedPosition

      public P getEstimatedPosition()
      Gets estimated position.
      Returns:
      estimated position.
    • areValidReadings

      public boolean areValidReadings(List<? extends R> readings)
      Indicates whether readings are valid or not. Readings are considered valid when there are enough readings.
      Parameters:
      readings - readings to be validated.
      Returns:
      true if readings are valid, false otherwise.
    • isReady

      public abstract boolean isReady()
      Indicates whether this instance is ready to start the estimation.
      Returns:
      true if this instance is ready, false otherwise.
    • getMinReadings

      public abstract int getMinReadings()
      Gets minimum required number of readings to estimate power, position and path-loss exponent. This value depends on the number of parameters to be estimated, but for position only, this is 3 readings for 2D, and 4 readings for 3D.
      Returns:
      minimum required number of readings.
    • getNumberOfDimensions

      public abstract int getNumberOfDimensions()
      Gets number of dimensions of position points.
      Returns:
      number of dimensions of position points.
    • estimate

      public abstract void estimate() throws com.irurueta.navigation.LockedException, com.irurueta.navigation.NotReadyException, com.irurueta.numerical.robust.RobustEstimatorException
      Robustly estimates position, transmitted power and path-loss exponent for a radio source.
      Throws:
      com.irurueta.navigation.LockedException - if instance is busy during estimation.
      com.irurueta.navigation.NotReadyException - if estimator is not ready.
      com.irurueta.numerical.robust.RobustEstimatorException - if estimation fails for any reason (i.e. numerical instability, no solution available, etc).
    • getEstimatedRadioSource

      public abstract <S extends RadioSourceLocated<P>> S getEstimatedRadioSource()
      Gets estimated located radio source.
      Type Parameters:
      S - type of located radio source.
      Returns:
      estimated located radio source.
    • internalSetReadings

      protected void internalSetReadings(List<? extends R> readings)
      Internally sets signal readings belonging to the same radio source.
      Parameters:
      readings - signal readings belonging to the same radio source.
      Throws:
      IllegalArgumentException - if readings are null, not enough readings are available, or readings do not belong to the same access point.