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- aPointtype.R- aReadingLocatedtype.L- aRobustRadioSourceEstimatorListenertype.
- 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
FieldsModifier and TypeFieldDescriptionprotected doubleAmount of confidence expressed as a value between 0.0 and 1.0 (which is equivalent to 100%).protected com.irurueta.algebra.MatrixCovariance of estimated position, power and/or path-loss exponent.static final doubleConstant defining default confidence of the estimated result, which is 99%.static final booleanIndicates that covariance is kept by default after refining result.static final intDefault maximum allowed number of iterations.static final floatDefault amount of progress variation before notifying a change in estimation progress.static final booleanIndicates that result is refined by default using all found inliers.static final com.irurueta.numerical.robust.RobustEstimatorMethodDefault robust estimator method when none is provided.protected PEstimated position.protected com.irurueta.algebra.MatrixCovariance of estimated position.protected com.irurueta.numerical.robust.InliersDataData related to inliers found after estimation.protected booleanIndicates whether covariance must be kept after refining result.protected LListener to be notified of events such as when estimation starts, ends or its progress significantly changes.protected booleanIndicates if this instance is locked because estimation is being executed.static final doubleMaximum allowed confidence value.static final floatMaximum allowed value for progress delta.protected intMaximum allowed number of iterations.static final doubleMinimum allowed confidence value.static final intMinimum allowed number of iterations.static final floatMinimum allowed value for progress delta.protected intSize of subsets to be checked during robust estimation.protected floatAmount of progress variation before notifying a progress change during estimation.Signal readings belonging to the same radio source to be estimated.protected booleanIndicates whether result must be refined using found inliers. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructor.protectedRobustRadioSourceEstimator(List<? extends R> readings) Constructor.protectedRobustRadioSourceEstimator(List<? extends R> readings, L listener) Constructor.protectedRobustRadioSourceEstimator(L listener) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanareValidReadings(List<? extends R> readings) Indicates whether readings are valid or not.abstract voidestimate()Robustly estimates position, transmitted power and path-loss exponent for a radio source.doubleReturns amount of confidence expressed as a value between 0.0 and 1.0 (which is equivalent to 100%).com.irurueta.algebra.MatrixGets covariance for estimated position, power and path-loss.Gets estimated position.com.irurueta.algebra.MatrixGets estimated position covariance.abstract <S extends RadioSourceLocated<P>>
SGets estimated located radio source.com.irurueta.numerical.robust.InliersDataGets data related to inliers found after estimation.Gets listener in charge of attending events raised by this instance.intReturns maximum allowed number of iterations.abstract intGets minimum required number of readings to estimate power, position and path-loss exponent.abstract intGets number of dimensions of position points.intGets size of subsets to be checked during robust estimation.floatReturns 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 voidinternalSetReadings(List<? extends R> readings) Internally sets signal readings belonging to the same radio source.booleanIndicates whether covariance must be kept after refining result.booleanisLocked()Indicates whether estimator is locked during estimation.abstract booleanisReady()Indicates whether this instance is ready to start the estimation.booleanIndicates whether result must be refined using a non-linear solver over found inliers.voidsetConfidence(double confidence) Sets amount of confidence expressed as a value between 0.0 and 1.0 (which is equivalent to 100%).voidsetCovarianceKept(boolean keepCovariance) Specifies whether covariance must be kept after refining result.voidsetListener(L listener) Sets listener in charge of attending events raised by this instance.voidsetMaxIterations(int maxIterations) Sets maximum allowed number of iterations.voidsetPreliminarySubsetSize(int preliminarySubsetSize) Sets size of subsets to be checked during estimation.voidsetProgressDelta(float progressDelta) Sets amount of progress variation before notifying a progress change during estimation.voidsetQualityScores(double[] qualityScores) Sets quality scores corresponding to each pair of positions and distances (i.e. sample).voidsetReadings(List<? extends R> readings) Sets signal readings belonging to the same radio source.voidsetResultRefined(boolean refineResult) Specifies whether result must be refined using a non-linear solver over found inliers.
-
Field Details
-
DEFAULT_ROBUST_METHOD
public static final com.irurueta.numerical.robust.RobustEstimatorMethod DEFAULT_ROBUST_METHODDefault robust estimator method when none is provided. -
DEFAULT_REFINE_RESULT
public static final boolean DEFAULT_REFINE_RESULTIndicates that result is refined by default using all found inliers.- See Also:
-
DEFAULT_KEEP_COVARIANCE
public static final boolean DEFAULT_KEEP_COVARIANCEIndicates that covariance is kept by default after refining result.- See Also:
-
DEFAULT_PROGRESS_DELTA
public static final float DEFAULT_PROGRESS_DELTADefault 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_DELTAMinimum allowed value for progress delta.- See Also:
-
MAX_PROGRESS_DELTA
public static final float MAX_PROGRESS_DELTAMaximum allowed value for progress delta.- See Also:
-
DEFAULT_CONFIDENCE
public static final double DEFAULT_CONFIDENCEConstant 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_ITERATIONSDefault maximum allowed number of iterations.- See Also:
-
MIN_CONFIDENCE
public static final double MIN_CONFIDENCEMinimum allowed confidence value.- See Also:
-
MAX_CONFIDENCE
public static final double MAX_CONFIDENCEMaximum allowed confidence value.- See Also:
-
MIN_ITERATIONS
public static final int MIN_ITERATIONSMinimum allowed number of iterations.- See Also:
-
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
Estimated position. -
locked
protected boolean lockedIndicates if this instance is locked because estimation is being executed. -
progressDelta
protected float progressDeltaAmount of progress variation before notifying a progress change during estimation. -
confidence
protected double confidenceAmount 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 maxIterationsMaximum 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 inliersDataData related to inliers found after estimation. -
refineResult
protected boolean refineResultIndicates 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 keepCovarianceIndicates 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 covarianceCovariance 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 estimatedPositionCovarianceCovariance 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 preliminarySubsetSizeSize of subsets to be checked during robust estimation.
-
-
Constructor Details
-
RobustRadioSourceEstimator
protected RobustRadioSourceEstimator()Constructor. -
RobustRadioSourceEstimator
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
Constructor.- Parameters:
listener- listener in charge of attending events raised by this instance.
-
RobustRadioSourceEstimator
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
Gets signal readings belonging to the same radio source.- Returns:
- signal readings belonging to the same radio source.
-
setReadings
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
Gets listener in charge of attending events raised by this instance.- Returns:
- listener in charge of attending events raised by this instance.
-
setListener
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 leastgetMinReadings()- 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 leastgetMinReadings().- 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 thangetMinReadings().
-
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
Gets estimated position.- Returns:
- estimated position.
-
areValidReadings
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.RobustEstimatorExceptionRobustly 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
Gets estimated located radio source.- Type Parameters:
S- type of located radio source.- Returns:
- estimated located radio source.
-
internalSetReadings
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.
-