1 /*
2 * Copyright (C) 2018 Alberto Irurueta Carro (alberto@irurueta.com)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package com.irurueta.navigation.indoor.radiosource;
17
18 import com.irurueta.geometry.Point3D;
19 import com.irurueta.navigation.NavigationException;
20 import com.irurueta.navigation.indoor.Beacon;
21 import com.irurueta.navigation.indoor.BeaconWithPowerAndLocated3D;
22 import com.irurueta.navigation.indoor.RadioSource;
23 import com.irurueta.navigation.indoor.RadioSourceWithPowerAndLocated;
24 import com.irurueta.navigation.indoor.RssiReadingLocated;
25 import com.irurueta.navigation.indoor.WifiAccessPoint;
26 import com.irurueta.navigation.indoor.WifiAccessPointWithPowerAndLocated3D;
27 import com.irurueta.numerical.robust.RobustEstimatorMethod;
28
29 import java.util.ArrayList;
30 import java.util.List;
31
32 /**
33 * This is an abstract class to robustly estimate 3D position, transmitted power and
34 * path-loss exponent of a radio source (e.g. Wi-Fi access point or bluetooth beacon),
35 * by discarding outliers and assuming that the radio source emits isotropically
36 * following the expression below:
37 * Pr = Pt*Gt*Gr*lambda^2 / (4*pi*d)^2,
38 * where Pr is the received power (expressed in mW),
39 * Gt is the Gain of the transmission antenna
40 * Gr is the Gain of the receiver antenna
41 * d is the distance between emitter and receiver
42 * and lambda is the wavelength and is equal to: lambda = c / f,
43 * where c is the speed of light
44 * and f is the carrier frequency of the radio signal.
45 * Because usually information about the antenna of the radio source cannot be
46 * retrieved (because many measurements are made on unknown access points where
47 * physical access is not possible), this implementation will estimate the
48 * equivalent transmitted power as: Pte = Pt * Gt * Gr.
49 * If RssiReadings contain RSSI standard deviations, those values will be used,
50 * otherwise it will be assumed an RSSI standard deviation of 1 dB.
51 * Implementations of this class should be able to detect and discard outliers in
52 * order to find the best solution.
53 * <p>
54 * IMPORTANT: Implementations of this class can choose to estimate a
55 * combination of radio source position, transmitted power and path loss
56 * exponent. However enabling all three estimations usually achieves
57 * inaccurate results. When using this class, estimation must be of at least
58 * one parameter (position, transmitted power or path loss exponent) when
59 * initial values are provided for the other two, and at most it should consist
60 * of two parameters (either position and transmitted power, position and
61 * path loss exponent or transmitted power and path loss exponent), providing an
62 * initial value for the remaining parameter.
63 *
64 * @param <S> a {@link RadioSource} type.
65 */
66 @SuppressWarnings("Duplicates")
67 public abstract class RobustRssiRadioSourceEstimator3D<S extends RadioSource> extends
68 RobustRssiRadioSourceEstimator<S, Point3D> {
69
70 /**
71 * Power and 3D position estimator used internally.
72 */
73 protected final RssiRadioSourceEstimator3D<S> innerEstimator = new RssiRadioSourceEstimator3D<>();
74
75 /**
76 * Subset of readings used by inner estimator.
77 */
78 private final List<RssiReadingLocated<S, Point3D>> innerReadings = new ArrayList<>();
79
80 /**
81 * Constructor.
82 */
83 protected RobustRssiRadioSourceEstimator3D() {
84 super();
85 preliminarySubsetSize = getMinReadings();
86 }
87
88 /**
89 * Constructor.
90 * Sets signal readings belonging to the same radio source.
91 *
92 * @param readings signal readings belonging to the same radio source.
93 * @throws IllegalArgumentException if readings are not valid.
94 */
95 protected RobustRssiRadioSourceEstimator3D(final List<? extends RssiReadingLocated<S, Point3D>> readings) {
96 super(readings);
97 preliminarySubsetSize = getMinReadings();
98 }
99
100 /**
101 * Constructor.
102 *
103 * @param listener listener in charge of attending events raised by this instance.
104 */
105 protected RobustRssiRadioSourceEstimator3D(final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
106 super(listener);
107 preliminarySubsetSize = getMinReadings();
108 }
109
110 /**
111 * Constructor.
112 * Sets signal readings belonging to the same radio source.
113 *
114 * @param readings signal readings belonging to the same radio source.
115 * @param listener listener in charge of attending events raised by this instance.
116 * @throws IllegalArgumentException if fingerprints are not valid.
117 */
118 protected RobustRssiRadioSourceEstimator3D(
119 final List<? extends RssiReadingLocated<S, Point3D>> readings,
120 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
121 super(readings, listener);
122 preliminarySubsetSize = getMinReadings();
123 }
124
125 /**
126 * Constructor.
127 * Sets signal readings belonging to the same radio source.
128 *
129 * @param readings signal readings belonging to the same radio source.
130 * @param initialPosition initial position to start the estimation of radio
131 * source position.
132 * @throws IllegalArgumentException if fingerprints are not valid.
133 */
134 protected RobustRssiRadioSourceEstimator3D(
135 final List<? extends RssiReadingLocated<S, Point3D>> readings, final Point3D initialPosition) {
136 super(readings, initialPosition);
137 preliminarySubsetSize = getMinReadings();
138 }
139
140 /**
141 * Constructor.
142 *
143 * @param initialPosition initial position to start the estimation of radio
144 * source position.
145 */
146 protected RobustRssiRadioSourceEstimator3D(final Point3D initialPosition) {
147 super(initialPosition);
148 preliminarySubsetSize = getMinReadings();
149 }
150
151 /**
152 * Constructor.
153 *
154 * @param initialPosition initial position to start the estimation of radio
155 * source position.
156 * @param listener listener in charge of attending events raised by this instance.
157 */
158 protected RobustRssiRadioSourceEstimator3D(
159 final Point3D initialPosition, final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
160 super(initialPosition, listener);
161 preliminarySubsetSize = getMinReadings();
162 }
163
164 /**
165 * Constructor.
166 * Sets signal readings belonging to the same radio source.
167 *
168 * @param readings signal readings belonging to the same radio source.
169 * @param initialPosition initial position to start the estimation of radio
170 * source position.
171 * @param listener listener in charge of attending events raised by this instance.
172 * @throws IllegalArgumentException if fingerprints are not valid.
173 */
174 protected RobustRssiRadioSourceEstimator3D(
175 final List<? extends RssiReadingLocated<S, Point3D>> readings, final Point3D initialPosition,
176 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
177 super(readings, initialPosition, listener);
178 preliminarySubsetSize = getMinReadings();
179 }
180
181 /**
182 * Constructor.
183 *
184 * @param initialTransmittedPowerdBm initial transmitted power to start the
185 * estimation of radio source transmitted power
186 * (expressed in dBm's)
187 */
188 protected RobustRssiRadioSourceEstimator3D(final Double initialTransmittedPowerdBm) {
189 super(initialTransmittedPowerdBm);
190 preliminarySubsetSize = getMinReadings();
191 }
192
193 /**
194 * Constructor.
195 * Sets signal readings belonging to the same radio source.
196 *
197 * @param readings signal readings belonging to the same radio source.
198 * @param initialTransmittedPowerdBm initial transmitted power to start the
199 * estimation of radio source transmitted power
200 * (expressed in dBm's)
201 * @throws IllegalArgumentException if readings are not valid.
202 */
203 protected RobustRssiRadioSourceEstimator3D(
204 final List<? extends RssiReadingLocated<S, Point3D>> readings, final Double initialTransmittedPowerdBm) {
205 super(readings, initialTransmittedPowerdBm);
206 preliminarySubsetSize = getMinReadings();
207 }
208
209 /**
210 * Constructor.
211 *
212 * @param initialTransmittedPowerdBm initial transmitted power to start the
213 * estimation of radio source transmitted power
214 * (expressed in dBm's)
215 * @param listener listener in charge of attending events raised by this instance.
216 */
217 protected RobustRssiRadioSourceEstimator3D(
218 final Double initialTransmittedPowerdBm,
219 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
220 super(initialTransmittedPowerdBm, listener);
221 preliminarySubsetSize = getMinReadings();
222 }
223
224 /**
225 * Constructor.
226 * Sets signal readings belonging to the same radio source.
227 *
228 * @param readings signal readings belonging to the same radio source.
229 * @param initialTransmittedPowerdBm initial transmitted power to start the
230 * estimation of radio source transmitted power
231 * (expressed in dBm's)
232 * @param listener listener in charge of attending events raised by this instance.
233 * @throws IllegalArgumentException if readings are not valid.
234 */
235 protected RobustRssiRadioSourceEstimator3D(
236 final List<? extends RssiReadingLocated<S, Point3D>> readings, final Double initialTransmittedPowerdBm,
237 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
238 super(readings, initialTransmittedPowerdBm, listener);
239 preliminarySubsetSize = getMinReadings();
240 }
241
242 /**
243 * Constructor.
244 * Sets signal readings belonging to the same radio source.
245 *
246 * @param readings signal readings belonging to the same radio source.
247 * @param initialPosition initial position to start the estimation of radio
248 * source position.
249 * @param initialTransmittedPowerdBm initial transmitted power to start the
250 * estimation of radio source transmitted power
251 * (expressed in dBm's).
252 * @throws IllegalArgumentException if readings are not valid.
253 */
254 protected RobustRssiRadioSourceEstimator3D(
255 final List<? extends RssiReadingLocated<S, Point3D>> readings, final Point3D initialPosition,
256 final Double initialTransmittedPowerdBm) {
257 super(readings, initialPosition, initialTransmittedPowerdBm);
258 preliminarySubsetSize = getMinReadings();
259 }
260
261 /**
262 * Constructor.
263 *
264 * @param initialPosition initial position to start the estimation of radio
265 * source position.
266 * @param initialTransmittedPowerdBm initial transmitted power to start the
267 * estimation of radio source transmitted power
268 * (expressed in dBm's).
269 */
270 protected RobustRssiRadioSourceEstimator3D(final Point3D initialPosition, final Double initialTransmittedPowerdBm) {
271 super(initialPosition, initialTransmittedPowerdBm);
272 preliminarySubsetSize = getMinReadings();
273 }
274
275 /**
276 * Constructor.
277 *
278 * @param initialPosition initial position to start the estimation of radio
279 * source position.
280 * @param initialTransmittedPowerdBm initial transmitted power to start the
281 * estimation of radio source transmitted power
282 * (expressed in dBm's).
283 * @param listener in charge of attending events raised by this instance.
284 */
285 protected RobustRssiRadioSourceEstimator3D(
286 final Point3D initialPosition, final Double initialTransmittedPowerdBm,
287 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
288 super(initialPosition, initialTransmittedPowerdBm, listener);
289 preliminarySubsetSize = getMinReadings();
290 }
291
292 /**
293 * Constructor.
294 * Sets signal readings belonging to the same radio source.
295 *
296 * @param readings signal readings belonging to the same radio source.
297 * @param initialPosition initial position to start the estimation of radio
298 * source position.
299 * @param initialTransmittedPowerdBm initial transmitted power to start the
300 * estimation of radio source transmitted power
301 * (expressed in dBm's).
302 * @param listener listener in charge of attending events raised by this instance.
303 * @throws IllegalArgumentException if readings are not valid.
304 */
305 protected RobustRssiRadioSourceEstimator3D(
306 final List<? extends RssiReadingLocated<S, Point3D>> readings, final Point3D initialPosition,
307 final Double initialTransmittedPowerdBm,
308 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
309 super(readings, initialPosition, initialTransmittedPowerdBm, listener);
310 preliminarySubsetSize = getMinReadings();
311 }
312
313 /**
314 * Constructor.
315 * Sets signal readings belonging to the same radio source.
316 *
317 * @param readings signal readings belonging to the same radio source.
318 * @param initialPosition initial position to start the estimation of radio
319 * source position.
320 * @param initialTransmittedPowerdBm initial transmitted power to start the
321 * estimation of radio source transmitted power
322 * (expressed in dBm's).
323 * @param initialPathLossExponent initial path loss exponent. A typical value is 2.0.
324 * @throws IllegalArgumentException if readings are not valid.
325 */
326 protected RobustRssiRadioSourceEstimator3D(
327 final List<? extends RssiReadingLocated<S, Point3D>> readings, final Point3D initialPosition,
328 final Double initialTransmittedPowerdBm, final double initialPathLossExponent) {
329 super(readings, initialPosition, initialTransmittedPowerdBm, initialPathLossExponent);
330 preliminarySubsetSize = getMinReadings();
331 }
332
333 /**
334 * Constructor.
335 *
336 * @param initialPosition initial position to start the estimation of radio
337 * source position.
338 * @param initialTransmittedPowerdBm initial transmitted power to start the
339 * estimation of radio source transmitted power
340 * (expressed in dBm's).
341 * @param initialPathLossExponent initial path loss exponent. A typical value is 2.0.
342 */
343 protected RobustRssiRadioSourceEstimator3D(
344 final Point3D initialPosition, final Double initialTransmittedPowerdBm,
345 final double initialPathLossExponent) {
346 super(initialPosition, initialTransmittedPowerdBm, initialPathLossExponent);
347 preliminarySubsetSize = getMinReadings();
348 }
349
350 /**
351 * Constructor.
352 *
353 * @param initialPosition initial position to start the estimation of radio
354 * source position.
355 * @param initialTransmittedPowerdBm initial transmitted power to start the
356 * estimation of radio source transmitted power
357 * (expressed in dBm's).
358 * @param initialPathLossExponent initial path loss exponent. A typical value is 2.0.
359 * @param listener listener in charge of attending events raised by this instance.
360 */
361 protected RobustRssiRadioSourceEstimator3D(
362 final Point3D initialPosition, final Double initialTransmittedPowerdBm,
363 final double initialPathLossExponent, final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
364 super(initialPosition, initialTransmittedPowerdBm, initialPathLossExponent, listener);
365 preliminarySubsetSize = getMinReadings();
366 }
367
368 /**
369 * Constructor.
370 * Sets signal readings belonging to the same radio source.
371 *
372 * @param readings signal readings belonging to the same radio source.
373 * @param initialPosition initial position to start the estimation of radio
374 * source position.
375 * @param initialTransmittedPowerdBm initial transmitted power to start the
376 * estimation of radio source transmitted power
377 * (expressed in dBm's).
378 * @param initialPathLossExponent initial path loss exponent. A typical value is 2.0.
379 * @param listener listener in charge of attending events raised by this instance.
380 * @throws IllegalArgumentException if readings are not valid.
381 */
382 protected RobustRssiRadioSourceEstimator3D(
383 final List<? extends RssiReadingLocated<S, Point3D>> readings, final Point3D initialPosition,
384 final Double initialTransmittedPowerdBm, final double initialPathLossExponent,
385 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
386 super(readings, initialPosition, initialTransmittedPowerdBm, initialPathLossExponent, listener);
387 preliminarySubsetSize = getMinReadings();
388 }
389
390 /**
391 * Creates a robust 3D position radio source estimator.
392 *
393 * @param method robust estimator method.
394 * @param <S> a {@link RadioSource} type.
395 * @return a new robust 3D position radio source estimator.
396 */
397 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
398 final RobustEstimatorMethod method) {
399 return switch (method) {
400 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>();
401 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>();
402 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>();
403 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>();
404 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>();
405 };
406 }
407
408 /**
409 * Creates a robust 3D position radio source estimator.
410 *
411 * @param readings signal readings belonging to the same radio source.
412 * @param method robust estimator method.
413 * @param <S> a {@link RadioSource} type.
414 * @return a new robust 3D position radio source estimator.
415 * @throws IllegalArgumentException if readings are not valid.
416 */
417 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
418 final List<? extends RssiReadingLocated<S, Point3D>> readings, final RobustEstimatorMethod method) {
419 return switch (method) {
420 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(readings);
421 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(readings);
422 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(readings);
423 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(readings);
424 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(readings);
425 };
426 }
427
428 /**
429 * Creates a robust 3D position radio source estimator.
430 *
431 * @param listener listener in charge of attending events raised by this instance.
432 * @param method robust estimator method.
433 * @param <S> a {@link RadioSource} type.
434 * @return a new robust 3D position radio source estimator.
435 */
436 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
437 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener, final RobustEstimatorMethod method) {
438 return switch (method) {
439 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(listener);
440 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(listener);
441 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(listener);
442 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(listener);
443 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(listener);
444 };
445 }
446
447 /**
448 * Creates a robust 3D position radio source estimator.
449 *
450 * @param readings signal readings belonging to the same radio source.
451 * @param listener listener in charge of attending events raised by this instance.
452 * @param method robust estimator method.
453 * @param <S> a {@link RadioSource} type.
454 * @return a new robust 3D position radio source estimator.
455 * @throws IllegalArgumentException if readings are not valid.
456 */
457 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
458 final List<? extends RssiReadingLocated<S, Point3D>> readings,
459 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener, final RobustEstimatorMethod method) {
460 return switch (method) {
461 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(readings, listener);
462 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(readings, listener);
463 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(readings, listener);
464 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(readings, listener);
465 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(readings, listener);
466 };
467 }
468
469 /**
470 * Creates a robust 3D position radio source estimator.
471 *
472 * @param readings signal readings belonging to the same radio source.
473 * @param initialPosition initial position to start the estimation of radio
474 * source position.
475 * @param method robust estimator method.
476 * @param <S> a {@link RadioSource} type.
477 * @return a new robust 3D position radio source estimator.
478 * @throws IllegalArgumentException if readings are not valid.
479 */
480 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
481 final List<? extends RssiReadingLocated<S, Point3D>> readings, final Point3D initialPosition,
482 final RobustEstimatorMethod method) {
483 return switch (method) {
484 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition);
485 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(readings, initialPosition);
486 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition);
487 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition);
488 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(readings, initialPosition);
489 };
490 }
491
492 /**
493 * Creates a robust 3D position radio source estimator.
494 *
495 * @param initialPosition initial position to start the estimation of radio
496 * source position.
497 * @param method robust estimator method.
498 * @param <S> a {@link RadioSource} type.
499 * @return a new robust 3D position radio source estimator.
500 */
501 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
502 final Point3D initialPosition, final RobustEstimatorMethod method) {
503 return switch (method) {
504 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(initialPosition);
505 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(initialPosition);
506 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(initialPosition);
507 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(initialPosition);
508 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(initialPosition);
509 };
510 }
511
512 /**
513 * Creates a robust 3D position radio source estimator.
514 *
515 * @param initialPosition initial position to start the estimation of radio
516 * source position.
517 * @param listener listener in charge of attending events raised by this instance.
518 * @param method robust estimator method.
519 * @param <S> a {@link RadioSource} type.
520 * @return a new robust 3D position radio source estimator.
521 */
522 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
523 final Point3D initialPosition, final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener,
524 final RobustEstimatorMethod method) {
525 return switch (method) {
526 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(initialPosition, listener);
527 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(initialPosition, listener);
528 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(initialPosition, listener);
529 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(initialPosition, listener);
530 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(initialPosition, listener);
531 };
532 }
533
534 /**
535 * Creates a robust 3D position radio source estimator.
536 *
537 * @param readings signal readings belonging to the same radio source.
538 * @param initialPosition initial position to start the estimation of radio
539 * source position.
540 * @param listener listener in charge of attending events raised by this instance
541 * @param method robust estimator method.
542 * @param <S> a {@link RadioSource} type.
543 * @return a new robust 3D position radio source estimator.
544 * @throws IllegalArgumentException if readings are not valid.
545 */
546 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
547 final List<? extends RssiReadingLocated<S, Point3D>> readings, final Point3D initialPosition,
548 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener, final RobustEstimatorMethod method) {
549 return switch (method) {
550 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition, listener);
551 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(readings, initialPosition, listener);
552 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition, listener);
553 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition, listener);
554 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(readings, initialPosition, listener);
555 };
556 }
557
558 /**
559 * Creates a robust 3D position radio source estimator.
560 *
561 * @param initialTransmittedPowerdBm initial transmitted power to start the
562 * estimation of radio source transmitted power
563 * (expressed in dBm's).
564 * @param method robust estimator method.
565 * @param <S> a {@link RadioSource} type.
566 * @return a new robust 3D position radio source estimator.
567 */
568 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
569 final Double initialTransmittedPowerdBm, final RobustEstimatorMethod method) {
570 return switch (method) {
571 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(initialTransmittedPowerdBm);
572 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(initialTransmittedPowerdBm);
573 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(initialTransmittedPowerdBm);
574 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(initialTransmittedPowerdBm);
575 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(initialTransmittedPowerdBm);
576 };
577 }
578
579 /**
580 * Creates a robust 3D position radio source estimator.
581 *
582 * @param readings signal readings belonging to the same radio source.
583 * @param initialTransmittedPowerdBm initial transmitted power to start the
584 * estimation of radio source transmitted power
585 * (expressed in dBm's).
586 * @param method robust estimator method.
587 * @param <S> a {@link RadioSource} type.
588 * @return a new robust 3D position radio source estimator.
589 * @throws IllegalArgumentException if readings are not valid.
590 */
591 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
592 final List<? extends RssiReadingLocated<S, Point3D>> readings, final Double initialTransmittedPowerdBm,
593 final RobustEstimatorMethod method) {
594 return switch (method) {
595 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(readings, initialTransmittedPowerdBm);
596 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(readings, initialTransmittedPowerdBm);
597 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(readings, initialTransmittedPowerdBm);
598 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(readings, initialTransmittedPowerdBm);
599 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(readings, initialTransmittedPowerdBm);
600 };
601 }
602
603 /**
604 * Creates a robust 3D position radio source estimator.
605 *
606 * @param initialTransmittedPowerdBm initial transmitted power to start the
607 * estimation of radio source transmitted power
608 * (expressed in dBm's)
609 * @param listener listener in charge of attending events raised by this instance.
610 * @param method robust estimator method.
611 * @param <S> a {@link RadioSource} type.
612 * @return a new robust 3D position radio source estimator.
613 */
614 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
615 final Double initialTransmittedPowerdBm, final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener,
616 final RobustEstimatorMethod method) {
617 return switch (method) {
618 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(initialTransmittedPowerdBm, listener);
619 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(initialTransmittedPowerdBm, listener);
620 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(initialTransmittedPowerdBm, listener);
621 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(initialTransmittedPowerdBm, listener);
622 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(initialTransmittedPowerdBm, listener);
623 };
624 }
625
626 /**
627 * Creates a robust 3D position radio source estimator.
628 *
629 * @param readings signal readings belonging to the same radio source.
630 * @param initialTransmittedPowerdBm initial transmitted power to start the
631 * estimation of radio source transmitted power
632 * (expressed in dBm's)
633 * @param listener listener in charge of attending events raised by this instance.
634 * @param method robust estimator method.
635 * @param <S> a {@link RadioSource} type.
636 * @return a new robust 3D position radio source estimator.
637 * @throws IllegalArgumentException if readings are not valid.
638 */
639 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
640 final List<? extends RssiReadingLocated<S, Point3D>> readings, final Double initialTransmittedPowerdBm,
641 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener, final RobustEstimatorMethod method) {
642 return switch (method) {
643 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(readings, initialTransmittedPowerdBm, listener);
644 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(readings, initialTransmittedPowerdBm, listener);
645 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(readings, initialTransmittedPowerdBm, listener);
646 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(readings, initialTransmittedPowerdBm, listener);
647 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(readings, initialTransmittedPowerdBm, listener);
648 };
649 }
650
651 /**
652 * Creates a robust 3D position radio source estimator.
653 *
654 * @param readings signal readings belonging to the same radio source.
655 * @param initialPosition initial position to start the estimation of radio
656 * source position.
657 * @param initialTransmittedPowerdBm initial transmitted power to start the
658 * estimation of radio source transmitted power
659 * (expressed in dBm's).
660 * @param method robust estimator method.
661 * @param <S> a {@link RadioSource} type.
662 * @return a new robust 3D position radio source estimator.
663 * @throws IllegalArgumentException if readings are not valid.
664 */
665 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
666 final List<? extends RssiReadingLocated<S, Point3D>> readings, final Point3D initialPosition,
667 final Double initialTransmittedPowerdBm, final RobustEstimatorMethod method) {
668 return switch (method) {
669 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
670 initialTransmittedPowerdBm);
671 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
672 initialTransmittedPowerdBm);
673 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
674 initialTransmittedPowerdBm);
675 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
676 initialTransmittedPowerdBm);
677 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
678 initialTransmittedPowerdBm);
679 };
680 }
681
682 /**
683 * Creates a robust 3D position radio source estimator.
684 *
685 * @param initialPosition initial position to start the estimation of radio
686 * source position.
687 * @param initialTransmittedPowerdBm initial transmitted power to start the
688 * estimation of radio source transmitted power
689 * (expressed in dBm's).
690 * @param method robust estimator method.
691 * @param <S> a {@link RadioSource} type.
692 * @return a new robust 3D position radio source estimator.
693 */
694 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
695 final Point3D initialPosition, final Double initialTransmittedPowerdBm,
696 final RobustEstimatorMethod method) {
697 return switch (method) {
698 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm);
699 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm);
700 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm);
701 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm);
702 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm);
703 };
704 }
705
706 /**
707 * Creates a robust 3D position radio source estimator.
708 *
709 * @param initialPosition initial position to start the estimation of radio
710 * source position.
711 * @param initialTransmittedPowerdBm initial transmitted power to start the
712 * estimation of radio source transmitted power
713 * (expressed in dBm's).
714 * @param listener listener in charge of attending events raised by this instance.
715 * @param method robust estimator method.
716 * @param <S> a {@link RadioSource} type.
717 * @return a new robust 3D position radio source estimator.
718 */
719 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
720 final Point3D initialPosition, final Double initialTransmittedPowerdBm,
721 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener, final RobustEstimatorMethod method) {
722 return switch (method) {
723 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm,
724 listener);
725 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm,
726 listener);
727 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm,
728 listener);
729 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm,
730 listener);
731 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm,
732 listener);
733 };
734 }
735
736 /**
737 * Creates a robust 3D position radio source estimator.
738 *
739 * @param readings signal readings belonging to the same radio source.
740 * @param initialPosition initial position to start the estimation of radio
741 * source position.
742 * @param initialTransmittedPowerdBm initial transmitted power to start the
743 * estimation of radio source transmitted power
744 * (expressed in dBm's).
745 * @param listener listener in charge of attending events raised by this instance.
746 * @param method robust estimator method.
747 * @param <S> a {@link RadioSource} type.
748 * @return a new robust 3D position radio source estimator.
749 * @throws IllegalArgumentException if readings are not valid.
750 */
751 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
752 final List<? extends RssiReadingLocated<S, Point3D>> readings, final Point3D initialPosition,
753 final Double initialTransmittedPowerdBm, final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener,
754 final RobustEstimatorMethod method) {
755 return switch (method) {
756 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
757 initialTransmittedPowerdBm, listener);
758 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
759 initialTransmittedPowerdBm, listener);
760 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
761 initialTransmittedPowerdBm, listener);
762 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
763 initialTransmittedPowerdBm, listener);
764 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
765 initialTransmittedPowerdBm, listener);
766 };
767 }
768
769 /**
770 * Creates a robust 3D position radio source estimator.
771 *
772 * @param readings signal readings belonging to the same radio source.
773 * @param initialPosition initial position to start the estimation of radio
774 * source position.
775 * @param initialTransmittedPowerdBm initial transmitted power to start the
776 * estimation of radio source transmitted power
777 * (expressed in dBm's).
778 * @param initialPathLossExponent initial path loss exponent. A typical value is 2.0.
779 * @param method robust estimator method.
780 * @param <S> a {@link RadioSource} type.
781 * @return a new robust 3D position radio source estimator.
782 * @throws IllegalArgumentException if readings are not valid.
783 */
784 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
785 final List<? extends RssiReadingLocated<S, Point3D>> readings, final Point3D initialPosition,
786 final Double initialTransmittedPowerdBm, final double initialPathLossExponent,
787 final RobustEstimatorMethod method) {
788 return switch (method) {
789 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
790 initialTransmittedPowerdBm, initialPathLossExponent);
791 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
792 initialTransmittedPowerdBm, initialPathLossExponent);
793 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
794 initialTransmittedPowerdBm, initialPathLossExponent);
795 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
796 initialTransmittedPowerdBm, initialPathLossExponent);
797 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
798 initialTransmittedPowerdBm, initialPathLossExponent);
799 };
800 }
801
802 /**
803 * Creates a robust 3D position radio source estimator.
804 *
805 * @param initialPosition initial position to start the estimation of radio
806 * source position.
807 * @param initialTransmittedPowerdBm initial transmitted power to start the
808 * estimation of radio source transmitted power
809 * (expressed in dBm's).
810 * @param initialPathLossExponent initial path loss exponent. A typical value is 2.0.
811 * @param method robust estimator method.
812 * @param <S> a {@link RadioSource} type.
813 * @return a new robust 3D position radio source estimator.
814 */
815 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
816 final Point3D initialPosition, final Double initialTransmittedPowerdBm,
817 final double initialPathLossExponent, final RobustEstimatorMethod method) {
818 return switch (method) {
819 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm,
820 initialPathLossExponent);
821 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm,
822 initialPathLossExponent);
823 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm,
824 initialPathLossExponent);
825 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm,
826 initialPathLossExponent);
827 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm,
828 initialPathLossExponent);
829 };
830 }
831
832 /**
833 * Creates a robust 3D position radio source estimator.
834 *
835 * @param initialPosition initial position to start the estimation of radio
836 * source position.
837 * @param initialTransmittedPowerdBm initial transmitted power to start the
838 * estimation of radio source transmitted power
839 * (expressed in dBm's).
840 * @param initialPathLossExponent initial path loss exponent. A typical value is 2.0.
841 * @param listener listener in charge of attending events raised by this instance.
842 * @param method robust estimator method.
843 * @param <S> a {@link RadioSource} type.
844 * @return a new robust 3D position radio source estimator.
845 */
846 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
847 final Point3D initialPosition, final Double initialTransmittedPowerdBm,
848 final double initialPathLossExponent, final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener,
849 final RobustEstimatorMethod method) {
850 return switch (method) {
851 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm,
852 initialPathLossExponent, listener);
853 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm,
854 initialPathLossExponent, listener);
855 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm,
856 initialPathLossExponent, listener);
857 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm,
858 initialPathLossExponent, listener);
859 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm,
860 initialPathLossExponent, listener);
861 };
862 }
863
864 /**
865 * Creates a robust 3D position radio source estimator.
866 *
867 * @param readings signal readings belonging to the same radio source.
868 * @param initialPosition initial position to start the estimation of radio
869 * source position.
870 * @param initialTransmittedPowerdBm initial transmitted power to start the
871 * estimation of radio source transmitted power
872 * (expressed in dBm's).
873 * @param initialPathLossExponent initial path loss exponent. A typical value is 2.0.
874 * @param listener listener in charge of attending events raised by this instance.
875 * @param method robust estimator method.
876 * @param <S> a {@link RadioSource} type.
877 * @return a new robust 3D position radio source estimator.
878 * @throws IllegalArgumentException if readings are not valid.
879 */
880 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
881 final List<? extends RssiReadingLocated<S, Point3D>> readings, final Point3D initialPosition,
882 final Double initialTransmittedPowerdBm, final double initialPathLossExponent,
883 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener, final RobustEstimatorMethod method) {
884 return switch (method) {
885 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
886 initialTransmittedPowerdBm, initialPathLossExponent, listener);
887 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
888 initialTransmittedPowerdBm, initialPathLossExponent, listener);
889 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
890 initialTransmittedPowerdBm, initialPathLossExponent, listener);
891 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
892 initialTransmittedPowerdBm, initialPathLossExponent, listener);
893 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
894 initialTransmittedPowerdBm, initialPathLossExponent, listener);
895 };
896 }
897
898 /**
899 * Creates a robust 3D position radio source estimator.
900 *
901 * @param qualityScores quality scores corresponding to each provided
902 * sample. The larger the score value the better
903 * the quality of the sample.
904 * @param method robust estimator method.
905 * @param <S> a {@link RadioSource} type.
906 * @return a new robust 3D position radio source estimator.
907 */
908 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
909 final double[] qualityScores, final RobustEstimatorMethod method) {
910 return switch (method) {
911 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>();
912 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>();
913 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>();
914 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(qualityScores);
915 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(qualityScores);
916 };
917 }
918
919 /**
920 * Creates a robust 3D position radio source estimator.
921 *
922 * @param qualityScores quality scores corresponding to each provided
923 * sample. The larger the score value the better
924 * the quality of the sample.
925 * @param readings signal readings belonging to the same radio source.
926 * @param method robust estimator method.
927 * @param <S> a {@link RadioSource} type.
928 * @return a new robust 3D position radio source estimator.
929 * @throws IllegalArgumentException if readings are not valid.
930 */
931 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
932 final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point3D>> readings,
933 final RobustEstimatorMethod method) {
934 return switch (method) {
935 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(readings);
936 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(readings);
937 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(readings);
938 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(qualityScores, readings);
939 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(qualityScores, readings);
940 };
941 }
942
943 /**
944 * Creates a robust 3D position radio source estimator.
945 *
946 * @param qualityScores quality scores corresponding to each provided
947 * sample. The larger the score value the better
948 * the quality of the sample.
949 * @param listener listener in charge of attending events raised by this instance.
950 * @param method robust estimator method.
951 * @param <S> a {@link RadioSource} type.
952 * @return a new robust 3D position radio source estimator.
953 */
954 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
955 final double[] qualityScores, final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener,
956 final RobustEstimatorMethod method) {
957 return switch (method) {
958 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(listener);
959 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(listener);
960 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(listener);
961 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(qualityScores, listener);
962 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(qualityScores, listener);
963 };
964 }
965
966 /**
967 * Creates a robust 3D position radio source estimator.
968 *
969 * @param qualityScores quality scores corresponding to each provided
970 * sample. The larger the score value the better
971 * the quality of the sample.
972 * @param readings signal readings belonging to the same radio source.
973 * @param listener listener in charge of attending events raised by this instance.
974 * @param method robust estimator method.
975 * @param <S> a {@link RadioSource} type.
976 * @return a new robust 3D position radio source estimator.
977 * @throws IllegalArgumentException if readings are not valid.
978 */
979 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
980 final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point3D>> readings,
981 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener, final RobustEstimatorMethod method) {
982 return switch (method) {
983 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(readings, listener);
984 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(readings, listener);
985 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(readings, listener);
986 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(qualityScores, readings, listener);
987 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(qualityScores, readings, listener);
988 };
989 }
990
991 /**
992 * Creates a robust 3D position radio source estimator.
993 *
994 * @param qualityScores quality scores corresponding to each provided
995 * sample. The larger the score value the better
996 * the quality of the sample.
997 * @param readings signal readings belonging to the same radio source.
998 * @param initialPosition initial position to start the estimation of radio
999 * source position.
1000 * @param method robust estimator method.
1001 * @param <S> a {@link RadioSource} type.
1002 * @return a new robust 3D position radio source estimator.
1003 * @throws IllegalArgumentException if readings are not valid.
1004 */
1005 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1006 final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point3D>> readings,
1007 final Point3D initialPosition, final RobustEstimatorMethod method) {
1008 return switch (method) {
1009 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition);
1010 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(readings, initialPosition);
1011 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition);
1012 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(qualityScores, readings, initialPosition);
1013 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(qualityScores, readings, initialPosition);
1014 };
1015 }
1016
1017 /**
1018 * Creates a robust 3D position radio source estimator.
1019 *
1020 * @param qualityScores quality scores corresponding to each provided
1021 * sample. The larger the score value the better
1022 * the quality of the sample.
1023 * @param initialPosition initial position to start the estimation of radio
1024 * source position.
1025 * @param method robust estimator method.
1026 * @param <S> a {@link RadioSource} type.
1027 * @return a new robust 3D position radio source estimator.
1028 */
1029 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1030 final double[] qualityScores, final Point3D initialPosition, final RobustEstimatorMethod method) {
1031 return switch (method) {
1032 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(initialPosition);
1033 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(initialPosition);
1034 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(initialPosition);
1035 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(qualityScores, initialPosition);
1036 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(qualityScores, initialPosition);
1037 };
1038 }
1039
1040 /**
1041 * Creates a robust 3D position radio source estimator.
1042 *
1043 * @param qualityScores quality scores corresponding to each provided
1044 * sample. The larger the score value the better
1045 * the quality of the sample.
1046 * @param initialPosition initial position to start the estimation of radio
1047 * source position.
1048 * @param listener listener in charge of attending events raised by this instance.
1049 * @param method robust estimator method.
1050 * @param <S> a {@link RadioSource} type.
1051 * @return a new robust 3D position radio source estimator.
1052 */
1053 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1054 final double[] qualityScores, final Point3D initialPosition,
1055 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener, final RobustEstimatorMethod method) {
1056 return switch (method) {
1057 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(initialPosition, listener);
1058 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(initialPosition, listener);
1059 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(initialPosition, listener);
1060 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(qualityScores, initialPosition, listener);
1061 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(qualityScores, initialPosition, listener);
1062 };
1063 }
1064
1065 /**
1066 * Creates a robust 3D position radio source estimator.
1067 *
1068 * @param qualityScores quality scores corresponding to each provided
1069 * sample. The larger the score value the better
1070 * the quality of the sample.
1071 * @param readings signal readings belonging to the same radio source.
1072 * @param initialPosition initial position to start the estimation of radio
1073 * source position.
1074 * @param listener listener in charge of attending events raised by this instance
1075 * @param method robust estimator method.
1076 * @param <S> a {@link RadioSource} type.
1077 * @return a new robust 3D position radio source estimator.
1078 * @throws IllegalArgumentException if readings are not valid.
1079 */
1080 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1081 final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point3D>> readings,
1082 final Point3D initialPosition, final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener,
1083 final RobustEstimatorMethod method) {
1084 return switch (method) {
1085 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition, listener);
1086 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(readings, initialPosition, listener);
1087 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition, listener);
1088 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(qualityScores, readings, initialPosition,
1089 listener);
1090 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(qualityScores, readings, initialPosition,
1091 listener);
1092 };
1093 }
1094
1095 /**
1096 * Creates a robust 3D position radio source estimator.
1097 *
1098 * @param qualityScores quality scores corresponding to each provided
1099 * sample. The larger the score value the better
1100 * the quality of the sample.
1101 * @param initialTransmittedPowerdBm initial transmitted power to start the
1102 * estimation of radio source transmitted power
1103 * (expressed in dBm's).
1104 * @param method robust estimator method.
1105 * @param <S> a {@link RadioSource} type.
1106 * @return a new robust 3D position radio source estimator.
1107 */
1108 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1109 final double[] qualityScores, final Double initialTransmittedPowerdBm, final RobustEstimatorMethod method) {
1110 return switch (method) {
1111 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(initialTransmittedPowerdBm);
1112 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(initialTransmittedPowerdBm);
1113 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(initialTransmittedPowerdBm);
1114 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(qualityScores, initialTransmittedPowerdBm);
1115 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(qualityScores, initialTransmittedPowerdBm);
1116 };
1117 }
1118
1119 /**
1120 * Creates a robust 3D position radio source estimator.
1121 *
1122 * @param qualityScores quality scores corresponding to each provided
1123 * sample. The larger the score value the better
1124 * the quality of the sample.
1125 * @param readings signal readings belonging to the same radio source.
1126 * @param initialTransmittedPowerdBm initial transmitted power to start the
1127 * estimation of radio source transmitted power
1128 * (expressed in dBm's).
1129 * @param method robust estimator method.
1130 * @param <S> a {@link RadioSource} type.
1131 * @return a new robust 3D position radio source estimator.
1132 * @throws IllegalArgumentException if readings are not valid.
1133 */
1134 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1135 final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point3D>> readings,
1136 final Double initialTransmittedPowerdBm, final RobustEstimatorMethod method) {
1137 return switch (method) {
1138 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(readings, initialTransmittedPowerdBm);
1139 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(readings, initialTransmittedPowerdBm);
1140 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(readings, initialTransmittedPowerdBm);
1141 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(qualityScores, readings,
1142 initialTransmittedPowerdBm);
1143 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(qualityScores, readings,
1144 initialTransmittedPowerdBm);
1145 };
1146 }
1147
1148 /**
1149 * Creates a robust 3D position radio source estimator.
1150 *
1151 * @param qualityScores quality scores corresponding to each provided
1152 * sample. The larger the score value the better
1153 * the quality of the sample.
1154 * @param initialTransmittedPowerdBm initial transmitted power to start the
1155 * estimation of radio source transmitted power
1156 * (expressed in dBm's)
1157 * @param listener listener in charge of attending events raised by this instance.
1158 * @param method robust estimator method.
1159 * @param <S> a {@link RadioSource} type.
1160 * @return a new robust 3D position radio source estimator.
1161 */
1162 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1163 final double[] qualityScores, final Double initialTransmittedPowerdBm,
1164 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener, final RobustEstimatorMethod method) {
1165 return switch (method) {
1166 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(initialTransmittedPowerdBm, listener);
1167 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(initialTransmittedPowerdBm, listener);
1168 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(initialTransmittedPowerdBm, listener);
1169 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(qualityScores, initialTransmittedPowerdBm,
1170 listener);
1171 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(qualityScores, initialTransmittedPowerdBm,
1172 listener);
1173 };
1174 }
1175
1176 /**
1177 * Creates a robust 3D position radio source estimator.
1178 *
1179 * @param qualityScores quality scores corresponding to each provided
1180 * sample. The larger the score value the better
1181 * the quality of the sample.
1182 * @param readings signal readings belonging to the same radio source.
1183 * @param initialTransmittedPowerdBm initial transmitted power to start the
1184 * estimation of radio source transmitted power
1185 * (expressed in dBm's)
1186 * @param listener listener in charge of attending events raised by this instance.
1187 * @param method robust estimator method.
1188 * @param <S> a {@link RadioSource} type.
1189 * @return a new robust 3D position radio source estimator.
1190 * @throws IllegalArgumentException if readings are not valid.
1191 */
1192 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1193 final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point3D>> readings,
1194 final Double initialTransmittedPowerdBm, final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener,
1195 final RobustEstimatorMethod method) {
1196 return switch (method) {
1197 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(readings, initialTransmittedPowerdBm, listener);
1198 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(readings, initialTransmittedPowerdBm, listener);
1199 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(readings, initialTransmittedPowerdBm, listener);
1200 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(qualityScores, readings,
1201 initialTransmittedPowerdBm, listener);
1202 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(qualityScores, readings,
1203 initialTransmittedPowerdBm, listener);
1204 };
1205 }
1206
1207 /**
1208 * Creates a robust 3D position radio source estimator.
1209 *
1210 * @param qualityScores quality scores corresponding to each provided
1211 * sample. The larger the score value the better
1212 * the quality of the sample.
1213 * @param readings signal readings belonging to the same radio source.
1214 * @param initialPosition initial position to start the estimation of radio
1215 * source position.
1216 * @param initialTransmittedPowerdBm initial transmitted power to start the
1217 * estimation of radio source transmitted power
1218 * (expressed in dBm's).
1219 * @param method robust estimator method.
1220 * @param <S> a {@link RadioSource} type.
1221 * @return a new robust 3D position radio source estimator.
1222 * @throws IllegalArgumentException if readings are not valid.
1223 */
1224 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1225 final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point3D>> readings,
1226 final Point3D initialPosition, final Double initialTransmittedPowerdBm,
1227 final RobustEstimatorMethod method) {
1228 return switch (method) {
1229 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
1230 initialTransmittedPowerdBm);
1231 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
1232 initialTransmittedPowerdBm);
1233 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
1234 initialTransmittedPowerdBm);
1235 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(qualityScores, readings, initialPosition,
1236 initialTransmittedPowerdBm);
1237 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(qualityScores, readings, initialPosition,
1238 initialTransmittedPowerdBm);
1239 };
1240 }
1241
1242 /**
1243 * Creates a robust 3D position radio source estimator.
1244 *
1245 * @param qualityScores quality scores corresponding to each provided
1246 * sample. The larger the score value the better
1247 * the quality of the sample.
1248 * @param initialPosition initial position to start the estimation of radio
1249 * source position.
1250 * @param initialTransmittedPowerdBm initial transmitted power to start the
1251 * estimation of radio source transmitted power
1252 * (expressed in dBm's).
1253 * @param method robust estimator method.
1254 * @param <S> a {@link RadioSource} type.
1255 * @return a new robust 3D position radio source estimator.
1256 */
1257 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1258 final double[] qualityScores, final Point3D initialPosition, final Double initialTransmittedPowerdBm,
1259 final RobustEstimatorMethod method) {
1260 return switch (method) {
1261 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm);
1262 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm);
1263 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm);
1264 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(qualityScores, initialPosition,
1265 initialTransmittedPowerdBm);
1266 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(qualityScores, initialPosition,
1267 initialTransmittedPowerdBm);
1268 };
1269 }
1270
1271 /**
1272 * Creates a robust 3D position radio source estimator.
1273 *
1274 * @param qualityScores quality scores corresponding to each provided
1275 * sample. The larger the score value the better
1276 * the quality of the sample.
1277 * @param initialPosition initial position to start the estimation of radio
1278 * source position.
1279 * @param initialTransmittedPowerdBm initial transmitted power to start the
1280 * estimation of radio source transmitted power
1281 * (expressed in dBm's).
1282 * @param listener listener in charge of attending events raised by this instance.
1283 * @param method robust estimator method.
1284 * @param <S> a {@link RadioSource} type.
1285 * @return a new robust 3D position radio source estimator.
1286 */
1287 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1288 final double[] qualityScores, final Point3D initialPosition, final Double initialTransmittedPowerdBm,
1289 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener, final RobustEstimatorMethod method) {
1290 return switch (method) {
1291 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm,
1292 listener);
1293 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm,
1294 listener);
1295 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm,
1296 listener);
1297 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(qualityScores, initialPosition,
1298 initialTransmittedPowerdBm, listener);
1299 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(qualityScores, initialPosition,
1300 initialTransmittedPowerdBm, listener);
1301 };
1302 }
1303
1304 /**
1305 * Creates a robust 3D position radio source estimator.
1306 *
1307 * @param qualityScores quality scores corresponding to each provided
1308 * sample. The larger the score value the better
1309 * the quality of the sample.
1310 * @param readings signal readings belonging to the same radio source.
1311 * @param initialPosition initial position to start the estimation of radio
1312 * source position.
1313 * @param initialTransmittedPowerdBm initial transmitted power to start the
1314 * estimation of radio source transmitted power
1315 * (expressed in dBm's).
1316 * @param listener listener in charge of attending events raised by this instance.
1317 * @param method robust estimator method.
1318 * @param <S> a {@link RadioSource} type.
1319 * @return a new robust 3D position radio source estimator.
1320 * @throws IllegalArgumentException if readings are not valid.
1321 */
1322 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1323 final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point3D>> readings,
1324 final Point3D initialPosition, final Double initialTransmittedPowerdBm,
1325 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener, final RobustEstimatorMethod method) {
1326 return switch (method) {
1327 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
1328 initialTransmittedPowerdBm, listener);
1329 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
1330 initialTransmittedPowerdBm, listener);
1331 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
1332 initialTransmittedPowerdBm, listener);
1333 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(qualityScores, readings, initialPosition,
1334 initialTransmittedPowerdBm, listener);
1335 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(qualityScores, readings, initialPosition,
1336 initialTransmittedPowerdBm, listener);
1337 };
1338 }
1339
1340 /**
1341 * Creates a robust 3D position radio source estimator.
1342 *
1343 * @param qualityScores quality scores corresponding to each provided
1344 * sample. The larger the score value the better
1345 * the quality of the sample.
1346 * @param readings signal readings belonging to the same radio source.
1347 * @param initialPosition initial position to start the estimation of radio
1348 * source position.
1349 * @param initialTransmittedPowerdBm initial transmitted power to start the
1350 * estimation of radio source transmitted power
1351 * (expressed in dBm's).
1352 * @param initialPathLossExponent initial path loss exponent. A typical value is 2.0.
1353 * @param method robust estimator method.
1354 * @param <S> a {@link RadioSource} type.
1355 * @return a new robust 3D position radio source estimator.
1356 * @throws IllegalArgumentException if readings are not valid.
1357 */
1358 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1359 final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point3D>> readings,
1360 final Point3D initialPosition, final Double initialTransmittedPowerdBm,
1361 final double initialPathLossExponent, final RobustEstimatorMethod method) {
1362 return switch (method) {
1363 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
1364 initialTransmittedPowerdBm, initialPathLossExponent);
1365 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
1366 initialTransmittedPowerdBm, initialPathLossExponent);
1367 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
1368 initialTransmittedPowerdBm, initialPathLossExponent);
1369 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(qualityScores, readings, initialPosition,
1370 initialTransmittedPowerdBm, initialPathLossExponent);
1371 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(qualityScores, readings, initialPosition,
1372 initialTransmittedPowerdBm, initialPathLossExponent);
1373 };
1374 }
1375
1376 /**
1377 * Creates a robust 3D position radio source estimator.
1378 *
1379 * @param qualityScores quality scores corresponding to each provided
1380 * sample. The larger the score value the better
1381 * the quality of the sample.
1382 * @param initialPosition initial position to start the estimation of radio
1383 * source position.
1384 * @param initialTransmittedPowerdBm initial transmitted power to start the
1385 * estimation of radio source transmitted power
1386 * (expressed in dBm's).
1387 * @param initialPathLossExponent initial path loss exponent. A typical value is 2.0.
1388 * @param method robust estimator method.
1389 * @param <S> a {@link RadioSource} type.
1390 * @return a new robust 3D position radio source estimator.
1391 */
1392 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1393 final double[] qualityScores, final Point3D initialPosition, final Double initialTransmittedPowerdBm,
1394 final double initialPathLossExponent, final RobustEstimatorMethod method) {
1395 return switch (method) {
1396 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm,
1397 initialPathLossExponent);
1398 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm,
1399 initialPathLossExponent);
1400 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm,
1401 initialPathLossExponent);
1402 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(qualityScores, initialPosition,
1403 initialTransmittedPowerdBm, initialPathLossExponent);
1404 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(qualityScores, initialPosition,
1405 initialTransmittedPowerdBm, initialPathLossExponent);
1406 };
1407 }
1408
1409 /**
1410 * Creates a robust 3D position radio source estimator.
1411 *
1412 * @param qualityScores quality scores corresponding to each provided
1413 * sample. The larger the score value the better
1414 * the quality of the sample.
1415 * @param initialPosition initial position to start the estimation of radio
1416 * source position.
1417 * @param initialTransmittedPowerdBm initial transmitted power to start the
1418 * estimation of radio source transmitted power
1419 * (expressed in dBm's).
1420 * @param initialPathLossExponent initial path loss exponent. A typical value is 2.0.
1421 * @param listener listener in charge of attending events raised by this instance.
1422 * @param method robust estimator method.
1423 * @param <S> a {@link RadioSource} type.
1424 * @return a new robust 3D position radio source estimator.
1425 */
1426 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1427 final double[] qualityScores, final Point3D initialPosition, final Double initialTransmittedPowerdBm,
1428 final double initialPathLossExponent, final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener,
1429 final RobustEstimatorMethod method) {
1430 return switch (method) {
1431 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm,
1432 initialPathLossExponent, listener);
1433 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm,
1434 initialPathLossExponent, listener);
1435 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(initialPosition, initialTransmittedPowerdBm,
1436 initialPathLossExponent, listener);
1437 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(qualityScores, initialPosition,
1438 initialTransmittedPowerdBm, initialPathLossExponent, listener);
1439 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(qualityScores, initialPosition,
1440 initialTransmittedPowerdBm, initialPathLossExponent, listener);
1441 };
1442 }
1443
1444 /**
1445 * Creates a robust 3D position radio source estimator.
1446 *
1447 * @param qualityScores quality scores corresponding to each provided
1448 * sample. The larger the score value the better
1449 * the quality of the sample.
1450 * @param readings signal readings belonging to the same radio source .
1451 * @param initialPosition initial position to start the estimation of radio
1452 * source position.
1453 * @param initialTransmittedPowerdBm initial transmitted power to start the
1454 * estimation of access point transmitted power
1455 * (expressed in dBm's).
1456 * @param initialPathLossExponent initial path loss exponent. A typical value is 2.0.
1457 * @param listener listener in charge of attending events raised by this instance.
1458 * @param method robust estimator method.
1459 * @param <S> a {@link RadioSource} type.
1460 * @return a new robust 3D position radio source estimator.
1461 * @throws IllegalArgumentException if readings are not valid.
1462 */
1463 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1464 final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point3D>> readings,
1465 final Point3D initialPosition, final Double initialTransmittedPowerdBm,
1466 final double initialPathLossExponent, final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener,
1467 final RobustEstimatorMethod method) {
1468 return switch (method) {
1469 case RANSAC -> new RANSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
1470 initialTransmittedPowerdBm, initialPathLossExponent, listener);
1471 case LMEDS -> new LMedSRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
1472 initialTransmittedPowerdBm, initialPathLossExponent, listener);
1473 case MSAC -> new MSACRobustRssiRadioSourceEstimator3D<>(readings, initialPosition,
1474 initialTransmittedPowerdBm, initialPathLossExponent, listener);
1475 case PROSAC -> new PROSACRobustRssiRadioSourceEstimator3D<>(qualityScores, readings, initialPosition,
1476 initialTransmittedPowerdBm, initialPathLossExponent, listener);
1477 default -> new PROMedSRobustRssiRadioSourceEstimator3D<>(qualityScores, readings, initialPosition,
1478 initialTransmittedPowerdBm, initialPathLossExponent, listener);
1479 };
1480 }
1481
1482 /**
1483 * Creates a robust 3D position radio source estimator using
1484 * default method.
1485 *
1486 * @param <S> a {@link RadioSource} type.
1487 * @return a new robust 3D position radio source estimator.
1488 */
1489 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create() {
1490 return create(DEFAULT_ROBUST_METHOD);
1491 }
1492
1493 /**
1494 * Creates a robust 3D position radio source estimator using
1495 * default method.
1496 *
1497 * @param readings signal readings belonging to the same radio source.
1498 * @param <S> a {@link RadioSource} type.
1499 * @return a new robust 3D position radio source estimator.
1500 * @throws IllegalArgumentException if readings are not valid.
1501 */
1502 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1503 final List<? extends RssiReadingLocated<S, Point3D>> readings) {
1504 return create(readings, DEFAULT_ROBUST_METHOD);
1505 }
1506
1507 /**
1508 * Creates a robust 3D position radio source estimator using
1509 * default method.
1510 *
1511 * @param listener listener in charge of attending events raised by this instance.
1512 * @param <S> a {@link RadioSource} type.
1513 * @return a new robust 3D position radio source estimator.
1514 */
1515 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1516 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
1517 return create(listener, DEFAULT_ROBUST_METHOD);
1518 }
1519
1520 /**
1521 * Creates a robust 3D position radio source estimator using
1522 * default method.
1523 *
1524 * @param readings signal readings belonging to the same radio source.
1525 * @param listener listener in charge of attending events raised by this instance.
1526 * @param <S> a {@link RadioSource} type.
1527 * @return a new robust 3D position radio source estimator.
1528 * @throws IllegalArgumentException if readings are not valid.
1529 */
1530 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1531 final List<? extends RssiReadingLocated<S, Point3D>> readings,
1532 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
1533 return create(readings, listener, DEFAULT_ROBUST_METHOD);
1534 }
1535
1536 /**
1537 * Creates a robust 3D position radio source estimator using
1538 * default method.
1539 *
1540 * @param readings signal readings belonging to the same radio source.
1541 * @param initialPosition initial position to start the estimation of radio
1542 * source position.
1543 * @param <S> a {@link RadioSource} type.
1544 * @return a new robust 3D position radio source estimator.
1545 * @throws IllegalArgumentException if readings are not valid.
1546 */
1547 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1548 final List<? extends RssiReadingLocated<S, Point3D>> readings, final Point3D initialPosition) {
1549 return create(readings, initialPosition, DEFAULT_ROBUST_METHOD);
1550 }
1551
1552 /**
1553 * Creates a robust 3D position radio source estimator using
1554 * default method.
1555 *
1556 * @param initialPosition initial position to start the estimation of radio
1557 * source position.
1558 * @param <S> a {@link RadioSource} type.
1559 * @return a new robust 3D position radio source estimator.
1560 */
1561 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(final Point3D initialPosition) {
1562 return create(initialPosition, DEFAULT_ROBUST_METHOD);
1563 }
1564
1565 /**
1566 * Creates a robust 3D position radio source estimator using
1567 * default method.
1568 *
1569 * @param initialPosition initial position to start the estimation of radio
1570 * source position.
1571 * @param listener listener in charge of attending events raised by this instance.
1572 * @param <S> a {@link RadioSource} type.
1573 * @return a new robust 3D position radio source estimator.
1574 */
1575 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1576 final Point3D initialPosition, final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
1577 return create(initialPosition, listener, DEFAULT_ROBUST_METHOD);
1578 }
1579
1580 /**
1581 * Creates a robust 3D position radio source estimator using
1582 * default method.
1583 *
1584 * @param readings signal readings belonging to the same radio source.
1585 * @param initialPosition initial position to start the estimation of radio
1586 * source position.
1587 * @param listener listener in charge of attending events raised by this instance
1588 * @param <S> a {@link RadioSource} type.
1589 * @return a new robust 3D position radio source estimator.
1590 * @throws IllegalArgumentException if readings are not valid.
1591 */
1592 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1593 final List<? extends RssiReadingLocated<S, Point3D>> readings, final Point3D initialPosition,
1594 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
1595 return create(readings, initialPosition, listener, DEFAULT_ROBUST_METHOD);
1596 }
1597
1598 /**
1599 * Creates a robust 3D position radio source estimator using
1600 * default method.
1601 *
1602 * @param initialTransmittedPowerdBm initial transmitted power to start the
1603 * estimation of radio source transmitted power
1604 * (expressed in dBm's).
1605 * @param <S> a {@link RadioSource} type.
1606 * @return a new robust 3D position radio source estimator.
1607 */
1608 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1609 final Double initialTransmittedPowerdBm) {
1610 return create(initialTransmittedPowerdBm, DEFAULT_ROBUST_METHOD);
1611 }
1612
1613 /**
1614 * Creates a robust 3D position radio source estimator using
1615 * default method.
1616 *
1617 * @param readings signal readings belonging to the same radio source.
1618 * @param initialTransmittedPowerdBm initial transmitted power to start the
1619 * estimation of radio source transmitted power
1620 * (expressed in dBm's).
1621 * @param <S> a {@link RadioSource} type.
1622 * @return a new robust 3D position radio source estimator.
1623 * @throws IllegalArgumentException if readings are not valid.
1624 */
1625 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1626 final List<? extends RssiReadingLocated<S, Point3D>> readings, final Double initialTransmittedPowerdBm) {
1627 return create(readings, initialTransmittedPowerdBm, DEFAULT_ROBUST_METHOD);
1628 }
1629
1630 /**
1631 * Creates a robust 3D position radio source estimator using
1632 * default method.
1633 *
1634 * @param initialTransmittedPowerdBm initial transmitted power to start the
1635 * estimation of radio source transmitted power
1636 * (expressed in dBm's)
1637 * @param listener listener in charge of attending events raised by this instance.
1638 * @param <S> a {@link RadioSource} type.
1639 * @return a new robust 3D position radio source estimator.
1640 */
1641 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1642 final Double initialTransmittedPowerdBm,
1643 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
1644 return create(initialTransmittedPowerdBm, listener, DEFAULT_ROBUST_METHOD);
1645 }
1646
1647 /**
1648 * Creates a robust 3D position radio source estimator using
1649 * default method.
1650 *
1651 * @param readings signal readings belonging to the same radio source.
1652 * @param initialTransmittedPowerdBm initial transmitted power to start the
1653 * estimation of radio source transmitted power
1654 * (expressed in dBm's)
1655 * @param listener listener in charge of attending events raised by this instance.
1656 * @param <S> a {@link RadioSource} type.
1657 * @return a new robust 3D position radio source estimator.
1658 * @throws IllegalArgumentException if readings are not valid.
1659 */
1660 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1661 final List<? extends RssiReadingLocated<S, Point3D>> readings, final Double initialTransmittedPowerdBm,
1662 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
1663 return create(readings, initialTransmittedPowerdBm, listener, DEFAULT_ROBUST_METHOD);
1664 }
1665
1666 /**
1667 * Creates a robust 3D position radio source estimator using
1668 * default method.
1669 *
1670 * @param readings signal readings belonging to the same radio source.
1671 * @param initialPosition initial position to start the estimation of access
1672 * point position.
1673 * @param initialTransmittedPowerdBm initial transmitted power to start the
1674 * estimation of radio source transmitted power
1675 * (expressed in dBm's).
1676 * @param <S> a {@link RadioSource} type.
1677 * @return a new robust 3D position radio source estimator.
1678 * @throws IllegalArgumentException if readings are not valid.
1679 */
1680 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1681 final List<? extends RssiReadingLocated<S, Point3D>> readings, final Point3D initialPosition,
1682 final Double initialTransmittedPowerdBm) {
1683 return create(readings, initialPosition, initialTransmittedPowerdBm, DEFAULT_ROBUST_METHOD);
1684 }
1685
1686 /**
1687 * Creates a robust 3D position radio source estimator using
1688 * default method.
1689 *
1690 * @param initialPosition initial position to start the estimation of radio
1691 * source position.
1692 * @param initialTransmittedPowerdBm initial transmitted power to start the
1693 * estimation of radio source transmitted power
1694 * (expressed in dBm's).
1695 * @param <S> a {@link RadioSource} type.
1696 * @return a new robust 3D position radio source estimator.
1697 */
1698 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1699 final Point3D initialPosition, final Double initialTransmittedPowerdBm) {
1700 return create(initialPosition, initialTransmittedPowerdBm, DEFAULT_ROBUST_METHOD);
1701 }
1702
1703 /**
1704 * Creates a robust 3D position radio source estimator using
1705 * default method.
1706 *
1707 * @param initialPosition initial position to start the estimation of radio
1708 * source position.
1709 * @param initialTransmittedPowerdBm initial transmitted power to start the
1710 * estimation of radio source transmitted power
1711 * (expressed in dBm's).
1712 * @param listener listener in charge of attending events raised by this instance.
1713 * @param <S> a {@link RadioSource} type.
1714 * @return a new robust 3D position radio source estimator.
1715 */
1716 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1717 final Point3D initialPosition, final Double initialTransmittedPowerdBm,
1718 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
1719 return create(initialPosition, initialTransmittedPowerdBm, listener, DEFAULT_ROBUST_METHOD);
1720 }
1721
1722 /**
1723 * Creates a robust 3D position radio source estimator using
1724 * default method.
1725 *
1726 * @param readings signal readings belonging to the same radio source.
1727 * @param initialPosition initial position to start the estimation of radio
1728 * source position.
1729 * @param initialTransmittedPowerdBm initial transmitted power to start the
1730 * estimation of radio source transmitted power
1731 * (expressed in dBm's).
1732 * @param listener listener in charge of attending events raised by this instance.
1733 * @param <S> a {@link RadioSource} type.
1734 * @return a new robust 3D position radio source estimator.
1735 * @throws IllegalArgumentException if readings are not valid.
1736 */
1737 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1738 final List<? extends RssiReadingLocated<S, Point3D>> readings, final Point3D initialPosition,
1739 final Double initialTransmittedPowerdBm,
1740 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
1741 return create(readings, initialPosition, initialTransmittedPowerdBm, listener, DEFAULT_ROBUST_METHOD);
1742 }
1743
1744 /**
1745 * Creates a robust 3D position radio source estimator using
1746 * default method.
1747 *
1748 * @param readings signal readings belonging to the same radio source.
1749 * @param initialPosition initial position to start the estimation of radio
1750 * source position.
1751 * @param initialTransmittedPowerdBm initial transmitted power to start the
1752 * estimation of radio source transmitted power
1753 * (expressed in dBm's).
1754 * @param initialPathLossExponent initial path loss exponent. A typical value is 2.0.
1755 * @param <S> a {@link RadioSource} type.
1756 * @return a new robust 3D position radio source estimator.
1757 * @throws IllegalArgumentException if readings are not valid.
1758 */
1759 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1760 final List<? extends RssiReadingLocated<S, Point3D>> readings, final Point3D initialPosition,
1761 final Double initialTransmittedPowerdBm, final double initialPathLossExponent) {
1762 return create(readings, initialPosition, initialTransmittedPowerdBm, initialPathLossExponent,
1763 DEFAULT_ROBUST_METHOD);
1764 }
1765
1766 /**
1767 * Creates a robust 3D position radio source estimator using
1768 * default method.
1769 *
1770 * @param initialPosition initial position to start the estimation of radio
1771 * source position.
1772 * @param initialTransmittedPowerdBm initial transmitted power to start the
1773 * estimation of radio source transmitted power
1774 * (expressed in dBm's).
1775 * @param initialPathLossExponent initial path loss exponent. A typical value is 2.0.
1776 * @param <S> a {@link RadioSource} type.
1777 * @return a new robust 3D position radio source estimator.
1778 */
1779 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1780 final Point3D initialPosition, final Double initialTransmittedPowerdBm,
1781 final double initialPathLossExponent) {
1782 return create(initialPosition, initialTransmittedPowerdBm, initialPathLossExponent, DEFAULT_ROBUST_METHOD);
1783 }
1784
1785 /**
1786 * Creates a robust 3D position radio source estimator using
1787 * default method.
1788 *
1789 * @param initialPosition initial position to start the estimation of radio
1790 * source position.
1791 * @param initialTransmittedPowerdBm initial transmitted power to start the
1792 * estimation of radio source transmitted power
1793 * (expressed in dBm's).
1794 * @param initialPathLossExponent initial path loss exponent. A typical value is 2.0.
1795 * @param listener listener in charge of attending events raised by this instance.
1796 * @param <S> a {@link RadioSource} type.
1797 * @return a new robust 3D position radio source estimator.
1798 */
1799 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1800 final Point3D initialPosition, final Double initialTransmittedPowerdBm,
1801 final double initialPathLossExponent, final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
1802 return create(initialPosition, initialTransmittedPowerdBm, initialPathLossExponent, listener,
1803 DEFAULT_ROBUST_METHOD);
1804 }
1805
1806 /**
1807 * Creates a robust 3D position radio source estimator using
1808 * default method.
1809 *
1810 * @param readings signal readings belonging to the same radio source.
1811 * @param initialPosition initial position to start the estimation of radio
1812 * source position.
1813 * @param initialTransmittedPowerdBm initial transmitted power to start the
1814 * estimation of radio source transmitted power
1815 * (expressed in dBm's).
1816 * @param initialPathLossExponent initial path loss exponent. A typical value is 2.0.
1817 * @param listener listener in charge of attending events raised by this instance.
1818 * @param <S> a {@link RadioSource} type.
1819 * @return a new robust 3D position radio source estimator.
1820 * @throws IllegalArgumentException if readings are not valid.
1821 */
1822 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1823 final List<? extends RssiReadingLocated<S, Point3D>> readings, final Point3D initialPosition,
1824 final Double initialTransmittedPowerdBm, final double initialPathLossExponent,
1825 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
1826 return create(readings, initialPosition, initialTransmittedPowerdBm, initialPathLossExponent, listener,
1827 DEFAULT_ROBUST_METHOD);
1828 }
1829
1830 /**
1831 * Creates a robust 3D position radio source estimator using
1832 * default method.
1833 *
1834 * @param qualityScores quality scores corresponding to each provided
1835 * sample. The larger the score value the better
1836 * the quality of the sample.
1837 * @param <S> a {@link RadioSource} type.
1838 * @return a new robust 3D position radio source estimator.
1839 */
1840 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(final double[] qualityScores) {
1841 return create(qualityScores, DEFAULT_ROBUST_METHOD);
1842 }
1843
1844 /**
1845 * Creates a robust 3D position radio source estimator using
1846 * default method.
1847 *
1848 * @param qualityScores quality scores corresponding to each provided
1849 * sample. The larger the score value the better
1850 * the quality of the sample.
1851 * @param readings signal readings belonging to the same radio source.
1852 * @param <S> a {@link RadioSource} type.
1853 * @return a new robust 3D position radio source estimator.
1854 * @throws IllegalArgumentException if readings are not valid.
1855 */
1856 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1857 final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point3D>> readings) {
1858 return create(qualityScores, readings, DEFAULT_ROBUST_METHOD);
1859 }
1860
1861 /**
1862 * Creates a robust 3D position radio source estimator using
1863 * default method.
1864 *
1865 * @param qualityScores quality scores corresponding to each provided
1866 * sample. The larger the score value the better
1867 * the quality of the sample.
1868 * @param listener listener in charge of attending events raised by this instance.
1869 * @param <S> a {@link RadioSource} type.
1870 * @return a new robust 3D position radio source estimator.
1871 */
1872 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1873 final double[] qualityScores, final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
1874 return create(qualityScores, listener, DEFAULT_ROBUST_METHOD);
1875 }
1876
1877 /**
1878 * Creates a robust 3D position radio source estimator using
1879 * default method.
1880 *
1881 * @param qualityScores quality scores corresponding to each provided
1882 * sample. The larger the score value the better
1883 * the quality of the sample.
1884 * @param readings signal readings belonging to the same radio source.
1885 * @param listener listener in charge of attending events raised by this instance.
1886 * @param <S> a {@link RadioSource} type.
1887 * @return a new robust 3D position radio source estimator.
1888 * @throws IllegalArgumentException if readings are not valid.
1889 */
1890 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1891 final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point3D>> readings,
1892 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
1893 return create(qualityScores, readings, listener, DEFAULT_ROBUST_METHOD);
1894 }
1895
1896 /**
1897 * Creates a robust 3D position radio source estimator using
1898 * default method.
1899 *
1900 * @param qualityScores quality scores corresponding to each provided
1901 * sample. The larger the score value the better
1902 * the quality of the sample.
1903 * @param readings signal readings belonging to the same radio source.
1904 * @param initialPosition initial position to start the estimation of radio
1905 * source position.
1906 * @param <S> a {@link RadioSource} type.
1907 * @return a new robust 3D position radio source estimator.
1908 * @throws IllegalArgumentException if readings are not valid.
1909 */
1910 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1911 final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point3D>> readings,
1912 final Point3D initialPosition) {
1913 return create(qualityScores, readings, initialPosition, DEFAULT_ROBUST_METHOD);
1914 }
1915
1916 /**
1917 * Creates a robust 3D position radio source estimator using
1918 * default method.
1919 *
1920 * @param qualityScores quality scores corresponding to each provided
1921 * sample. The larger the score value the better
1922 * the quality of the sample.
1923 * @param initialPosition initial position to start the estimation of radio
1924 * source position.
1925 * @param <S> a {@link RadioSource} type.
1926 * @return a new robust 3D position radio source estimator.
1927 */
1928 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1929 final double[] qualityScores, final Point3D initialPosition) {
1930 return create(qualityScores, initialPosition, DEFAULT_ROBUST_METHOD);
1931 }
1932
1933 /**
1934 * Creates a robust 3D position radio source estimator using
1935 * default method.
1936 *
1937 * @param qualityScores quality scores corresponding to each provided
1938 * sample. The larger the score value the better
1939 * the quality of the sample.
1940 * @param initialPosition initial position to start the estimation of radio
1941 * source position.
1942 * @param listener listener in charge of attending events raised by this instance.
1943 * @param <S> a {@link RadioSource} type.
1944 * @return a new robust 3D position radio source estimator.
1945 */
1946 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1947 final double[] qualityScores, final Point3D initialPosition,
1948 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
1949 return create(qualityScores, initialPosition, listener, DEFAULT_ROBUST_METHOD);
1950 }
1951
1952 /**
1953 * Creates a robust 3D position radio source estimator using
1954 * default method.
1955 *
1956 * @param qualityScores quality scores corresponding to each provided
1957 * sample. The larger the score value the better
1958 * the quality of the sample.
1959 * @param readings signal readings belonging to the same radio source.
1960 * @param initialPosition initial position to start the estimation of radio
1961 * source position.
1962 * @param listener listener in charge of attending events raised by this instance
1963 * @param <S> a {@link RadioSource} type.
1964 * @return a new robust 3D position radio source estimator.
1965 * @throws IllegalArgumentException if readings are not valid.
1966 */
1967 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1968 final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point3D>> readings,
1969 final Point3D initialPosition, final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
1970 return create(qualityScores, readings, initialPosition, listener, DEFAULT_ROBUST_METHOD);
1971 }
1972
1973 /**
1974 * Creates a robust 3D position radio source estimator using
1975 * default method.
1976 *
1977 * @param qualityScores quality scores corresponding to each provided
1978 * sample. The larger the score value the better
1979 * the quality of the sample.
1980 * @param initialTransmittedPowerdBm initial transmitted power to start the
1981 * estimation of radio source transmitted power
1982 * (expressed in dBm's).
1983 * @param <S> a {@link RadioSource} type.
1984 * @return a new robust 3D position radio source estimator.
1985 */
1986 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
1987 final double[] qualityScores, final Double initialTransmittedPowerdBm) {
1988 return create(qualityScores, initialTransmittedPowerdBm, DEFAULT_ROBUST_METHOD);
1989 }
1990
1991 /**
1992 * Creates a robust 3D position radio source estimator using
1993 * default method.
1994 *
1995 * @param qualityScores quality scores corresponding to each provided
1996 * sample. The larger the score value the better
1997 * the quality of the sample.
1998 * @param readings signal readings belonging to the same radio source.
1999 * @param initialTransmittedPowerdBm initial transmitted power to start the
2000 * estimation of radio source transmitted power
2001 * (expressed in dBm's).
2002 * @param <S> a {@link RadioSource} type.
2003 * @return a new robust 3D position radio source estimator.
2004 * @throws IllegalArgumentException if readings are not valid.
2005 */
2006 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
2007 final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point3D>> readings,
2008 final Double initialTransmittedPowerdBm) {
2009 return create(qualityScores, readings, initialTransmittedPowerdBm, DEFAULT_ROBUST_METHOD);
2010 }
2011
2012 /**
2013 * Creates a robust 3D position radio source estimator using
2014 * default method.
2015 *
2016 * @param qualityScores quality scores corresponding to each provided
2017 * sample. The larger the score value the better
2018 * the quality of the sample.
2019 * @param initialTransmittedPowerdBm initial transmitted power to start the
2020 * estimation of radio source transmitted power
2021 * (expressed in dBm's)
2022 * @param listener listener in charge of attending events raised by this instance.
2023 * @param <S> a {@link RadioSource} type.
2024 * @return a new robust 3D position radio source estimator.
2025 */
2026 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
2027 final double[] qualityScores, final Double initialTransmittedPowerdBm,
2028 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
2029 return create(qualityScores, initialTransmittedPowerdBm, listener, DEFAULT_ROBUST_METHOD);
2030 }
2031
2032 /**
2033 * Creates a robust 3D position radio source estimator using
2034 * default method.
2035 *
2036 * @param qualityScores quality scores corresponding to each provided
2037 * sample. The larger the score value the better
2038 * the quality of the sample.
2039 * @param readings signal readings belonging to the same radio source.
2040 * @param initialTransmittedPowerdBm initial transmitted power to start the
2041 * estimation of radio source transmitted power
2042 * (expressed in dBm's)
2043 * @param listener listener in charge of attending events raised by this instance.
2044 * @param <S> a {@link RadioSource} type.
2045 * @return a new robust 3D position radio source estimator.
2046 * @throws IllegalArgumentException if readings are not valid.
2047 */
2048 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
2049 final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point3D>> readings,
2050 final Double initialTransmittedPowerdBm,
2051 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
2052 return create(qualityScores, readings, initialTransmittedPowerdBm, listener, DEFAULT_ROBUST_METHOD);
2053 }
2054
2055 /**
2056 * Creates a robust 3D position radio source estimator using
2057 * default method.
2058 *
2059 * @param qualityScores quality scores corresponding to each provided
2060 * sample. The larger the score value the better
2061 * the quality of the sample.
2062 * @param readings signal readings belonging to the same radio source.
2063 * @param initialPosition initial position to start the estimation of radio
2064 * source position.
2065 * @param initialTransmittedPowerdBm initial transmitted power to start the
2066 * estimation of radio source transmitted power
2067 * (expressed in dBm's).
2068 * @param <S> a {@link RadioSource} type.
2069 * @return a new robust 3D position radio source estimator.
2070 * @throws IllegalArgumentException if readings are not valid.
2071 */
2072 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
2073 final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point3D>> readings,
2074 final Point3D initialPosition, final Double initialTransmittedPowerdBm) {
2075 return create(qualityScores, readings, initialPosition, initialTransmittedPowerdBm, DEFAULT_ROBUST_METHOD);
2076 }
2077
2078 /**
2079 * Creates a robust 3D position radio source estimator using
2080 * default method.
2081 *
2082 * @param qualityScores quality scores corresponding to each provided
2083 * sample. The larger the score value the better
2084 * the quality of the sample.
2085 * @param initialPosition initial position to start the estimation of radio
2086 * source position.
2087 * @param initialTransmittedPowerdBm initial transmitted power to start the
2088 * estimation of radio source transmitted power
2089 * (expressed in dBm's).
2090 * @param <S> a {@link RadioSource} type.
2091 * @return a new robust 3D position radio source estimator.
2092 */
2093 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
2094 final double[] qualityScores, final Point3D initialPosition, final Double initialTransmittedPowerdBm) {
2095 return create(qualityScores, initialPosition, initialTransmittedPowerdBm, DEFAULT_ROBUST_METHOD);
2096 }
2097
2098 /**
2099 * Creates a robust 3D position radio source estimator using
2100 * default method.
2101 *
2102 * @param qualityScores quality scores corresponding to each provided
2103 * sample. The larger the score value the better
2104 * the quality of the sample.
2105 * @param initialPosition initial position to start the estimation of access
2106 * point position.
2107 * @param initialTransmittedPowerdBm initial transmitted power to start the
2108 * estimation of radio source transmitted power
2109 * (expressed in dBm's).
2110 * @param listener listener in charge of attending events raised by this instance.
2111 * @param <S> a {@link RadioSource} type.
2112 * @return a new robust 3D position radio source estimator.
2113 */
2114 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
2115 final double[] qualityScores, final Point3D initialPosition, final Double initialTransmittedPowerdBm,
2116 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
2117 return create(qualityScores, initialPosition, initialTransmittedPowerdBm, listener, DEFAULT_ROBUST_METHOD);
2118 }
2119
2120 /**
2121 * Creates a robust 3D position radio source estimator using
2122 * default method.
2123 *
2124 * @param qualityScores quality scores corresponding to each provided
2125 * sample. The larger the score value the better
2126 * the quality of the sample.
2127 * @param readings signal readings belonging to the same radio source.
2128 * @param initialPosition initial position to start the estimation of radio
2129 * source position.
2130 * @param initialTransmittedPowerdBm initial transmitted power to start the
2131 * estimation of radio source transmitted power
2132 * (expressed in dBm's).
2133 * @param listener listener in charge of attending events raised by this instance.
2134 * @param <S> a {@link RadioSource} type.
2135 * @return a new robust 3D position radio source estimator.
2136 * @throws IllegalArgumentException if readings are not valid.
2137 */
2138 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
2139 final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point3D>> readings,
2140 final Point3D initialPosition, final Double initialTransmittedPowerdBm,
2141 final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
2142 return create(qualityScores, readings, initialPosition, initialTransmittedPowerdBm, listener,
2143 DEFAULT_ROBUST_METHOD);
2144 }
2145
2146 /**
2147 * Creates a robust 3D position radio source estimator using
2148 * default method.
2149 *
2150 * @param qualityScores quality scores corresponding to each provided
2151 * sample. The larger the score value the better
2152 * the quality of the sample.
2153 * @param readings signal readings belonging to the same radio source.
2154 * @param initialPosition initial position to start the estimation of radio
2155 * source position.
2156 * @param initialTransmittedPowerdBm initial transmitted power to start the
2157 * estimation of radio source transmitted power
2158 * (expressed in dBm's).
2159 * @param initialPathLossExponent initial path loss exponent. A typical value is 2.0.
2160 * @param <S> a {@link RadioSource} type.
2161 * @return a new robust 3D position radio source estimator.
2162 * @throws IllegalArgumentException if readings are not valid.
2163 */
2164 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
2165 final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point3D>> readings,
2166 final Point3D initialPosition, final Double initialTransmittedPowerdBm,
2167 final double initialPathLossExponent) {
2168 return create(qualityScores, readings, initialPosition, initialTransmittedPowerdBm, initialPathLossExponent,
2169 DEFAULT_ROBUST_METHOD);
2170 }
2171
2172 /**
2173 * Creates a robust 3D position radio source estimator using
2174 * default method.
2175 *
2176 * @param qualityScores quality scores corresponding to each provided
2177 * sample. The larger the score value the better
2178 * the quality of the sample.
2179 * @param initialPosition initial position to start the estimation of radio
2180 * source position.
2181 * @param initialTransmittedPowerdBm initial transmitted power to start the
2182 * estimation of radio source transmitted power
2183 * (expressed in dBm's).
2184 * @param initialPathLossExponent initial path loss exponent. A typical value is 2.0.
2185 * @param <S> a {@link RadioSource} type.
2186 * @return a new robust 3D position radio source estimator.
2187 */
2188 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
2189 final double[] qualityScores, final Point3D initialPosition, final Double initialTransmittedPowerdBm,
2190 final double initialPathLossExponent) {
2191 return create(qualityScores, initialPosition, initialTransmittedPowerdBm, initialPathLossExponent,
2192 DEFAULT_ROBUST_METHOD);
2193 }
2194
2195 /**
2196 * Creates a robust 3D position radio source estimator using
2197 * default method.
2198 *
2199 * @param qualityScores quality scores corresponding to each provided
2200 * sample. The larger the score value the better
2201 * the quality of the sample.
2202 * @param initialPosition initial position to start the estimation of radio
2203 * source position.
2204 * @param initialTransmittedPowerdBm initial transmitted power to start the
2205 * estimation of radio source transmitted power
2206 * (expressed in dBm's).
2207 * @param initialPathLossExponent initial path loss exponent. A typical value is 2.0.
2208 * @param listener listener in charge of attending events raised by this instance.
2209 * @param <S> a {@link RadioSource} type.
2210 * @return a new robust 3D position radio source estimator.
2211 */
2212 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
2213 final double[] qualityScores, final Point3D initialPosition, final Double initialTransmittedPowerdBm,
2214 final double initialPathLossExponent, final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
2215 return create(qualityScores, initialPosition, initialTransmittedPowerdBm, initialPathLossExponent, listener,
2216 DEFAULT_ROBUST_METHOD);
2217 }
2218
2219 /**
2220 * Creates a robust 3D position radio source estimator using
2221 * default method.
2222 *
2223 * @param qualityScores quality scores corresponding to each provided
2224 * sample. The larger the score value the better
2225 * the quality of the sample.
2226 * @param readings signal readings belonging to the same radio source.
2227 * @param initialPosition initial position to start the estimation of radio
2228 * source position.
2229 * @param initialTransmittedPowerdBm initial transmitted power to start the
2230 * estimation of radio source transmitted power
2231 * (expressed in dBm's).
2232 * @param initialPathLossExponent initial path loss exponent. A typical value is 2.0.
2233 * @param listener listener in charge of attending events raised by this instance.
2234 * @param <S> a {@link RadioSource} type.
2235 * @return a new robust 3D position radio source estimator.
2236 * @throws IllegalArgumentException if readings are not valid.
2237 */
2238 public static <S extends RadioSource> RobustRssiRadioSourceEstimator3D<S> create(
2239 final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point3D>> readings,
2240 final Point3D initialPosition, final Double initialTransmittedPowerdBm,
2241 final double initialPathLossExponent, final RobustRssiRadioSourceEstimatorListener<S, Point3D> listener) {
2242 return create(qualityScores, readings, initialPosition, initialTransmittedPowerdBm, initialPathLossExponent,
2243 listener, DEFAULT_ROBUST_METHOD);
2244 }
2245
2246 /**
2247 * Gets minimum required number of readings to estimate
2248 * power, position and path-loss exponent.
2249 * This value depends on the number of parameters to
2250 * be estimated, but for position only, this is 4
2251 * readings for 3D.
2252 *
2253 * @return minimum required number of readings.
2254 */
2255 @Override
2256 public int getMinReadings() {
2257 var minReadings = 0;
2258 if (isPositionEstimationEnabled()) {
2259 minReadings += Point3D.POINT3D_INHOMOGENEOUS_COORDINATES_LENGTH;
2260 }
2261 if (isTransmittedPowerEstimationEnabled()) {
2262 minReadings++;
2263 }
2264 if (isPathLossEstimationEnabled()) {
2265 minReadings++;
2266 }
2267 return ++minReadings;
2268 }
2269
2270 /**
2271 * Gets number of dimensions of position points.
2272 *
2273 * @return always returns 3 dimensions.
2274 */
2275 @Override
2276 public int getNumberOfDimensions() {
2277 return Point3D.POINT3D_INHOMOGENEOUS_COORDINATES_LENGTH;
2278 }
2279
2280 /**
2281 * Gets estimated located radio source with estimated transmitted power.
2282 *
2283 * @return estimated located radio source with estimated transmitted power or null.
2284 */
2285 @Override
2286 @SuppressWarnings("unchecked")
2287 public RadioSourceWithPowerAndLocated<Point3D> getEstimatedRadioSource() {
2288 final var readings = getReadings();
2289 if (readings == null || readings.isEmpty()) {
2290 return null;
2291 }
2292 final var source = readings.get(0).getSource();
2293
2294 final var estimatedPosition = getEstimatedPosition();
2295 if (estimatedPosition == null) {
2296 return null;
2297 }
2298
2299 final var estimatedPositionCovariance = getEstimatedPositionCovariance();
2300
2301 final var transmittedPowerVariance = getEstimatedTransmittedPowerVariance();
2302 final var transmittedPowerStandardDeviation = transmittedPowerVariance != null
2303 ? Math.sqrt(transmittedPowerVariance) : null;
2304
2305 final var pathlossExponentVariance = getEstimatedPathLossExponentVariance();
2306 final var pathlossExponentStandardDeviation = pathlossExponentVariance != null
2307 ? Math.sqrt(pathlossExponentVariance) : null;
2308
2309 if (source instanceof WifiAccessPoint accessPoint) {
2310 return new WifiAccessPointWithPowerAndLocated3D(accessPoint.getBssid(), source.getFrequency(),
2311 accessPoint.getSsid(), getEstimatedTransmittedPowerdBm(), transmittedPowerStandardDeviation,
2312 getEstimatedPathLossExponent(), pathlossExponentStandardDeviation, estimatedPosition,
2313 estimatedPositionCovariance);
2314 } else if (source instanceof Beacon beacon) {
2315 return new BeaconWithPowerAndLocated3D(beacon.getIdentifiers(), getEstimatedTransmittedPowerdBm(),
2316 beacon.getFrequency(), beacon.getBluetoothAddress(), beacon.getBeaconTypeCode(),
2317 beacon.getManufacturer(), beacon.getServiceUuid(), beacon.getBluetoothName(),
2318 getEstimatedPathLossExponent(), transmittedPowerStandardDeviation,
2319 pathlossExponentStandardDeviation, estimatedPosition, estimatedPositionCovariance);
2320 } else {
2321 return null;
2322 }
2323 }
2324
2325 /**
2326 * Solves preliminary solution for a subset of samples.
2327 *
2328 * @param samplesIndices indices of subset samples.
2329 * @param solutions instance where solution will be stored.
2330 */
2331 protected void solvePreliminarySolutions(final int[] samplesIndices, final List<Solution<Point3D>> solutions) {
2332
2333 try {
2334 innerReadings.clear();
2335 for (final var samplesIndex : samplesIndices) {
2336 innerReadings.add(readings.get(samplesIndex));
2337 }
2338
2339 // initial transmitted power and position might or might not be available
2340 innerEstimator.setInitialTransmittedPowerdBm(initialTransmittedPowerdBm);
2341 innerEstimator.setInitialPosition(initialPosition);
2342 innerEstimator.setInitialPathLossExponent(initialPathLossExponent);
2343
2344 innerEstimator.setTransmittedPowerEstimationEnabled(transmittedPowerEstimationEnabled);
2345 innerEstimator.setPositionEstimationEnabled(positionEstimationEnabled);
2346 innerEstimator.setPathLossEstimationEnabled(pathLossEstimationEnabled);
2347
2348 innerEstimator.setReadings(innerReadings);
2349
2350 innerEstimator.estimate();
2351
2352 final var estimatedPosition = innerEstimator.getEstimatedPosition();
2353 final var estimatedTransmittedPowerdBm = innerEstimator.getEstimatedTransmittedPowerdBm();
2354 final var estimatedPathLossExponent = innerEstimator.getEstimatedPathLossExponent();
2355 solutions.add(new Solution<>(estimatedPosition, estimatedTransmittedPowerdBm, estimatedPathLossExponent));
2356 } catch (final NavigationException ignore) {
2357 // if anything fails, no solution is added
2358 }
2359 }
2360
2361 /**
2362 * Attempts to refine estimated position and transmitted power contained in
2363 * provided solution if refinement is requested.
2364 * This method sets a refined result and transmitted power or provided input
2365 * result if refinement is not requested or has failed.
2366 * If refinement is enabled, and it is requested to keep covariance, this method
2367 * will also keep covariance of refined result.
2368 * solution if not requested or refinement failed.
2369 *
2370 * @param result result to be refined.
2371 */
2372 protected void attemptRefine(final Solution<Point3D> result) {
2373 final var initialPosition = result.getEstimatedPosition();
2374 final var initialTransmittedPowerdBm = result.getEstimatedTransmittedPowerdBm();
2375 final var initialPathLossExponent = result.getEstimatedPathLossExponent();
2376
2377 if (refineResult && inliersData != null) {
2378 final var inliers = inliersData.getInliers();
2379 final var nSamples = readings.size();
2380
2381 innerReadings.clear();
2382
2383 for (var i = 0; i < nSamples; i++) {
2384 if (inliers.get(i)) {
2385 // sample is inlier
2386 innerReadings.add(readings.get(i));
2387 }
2388 }
2389
2390 try {
2391 innerEstimator.setInitialPosition(initialPosition);
2392 innerEstimator.setInitialTransmittedPowerdBm(initialTransmittedPowerdBm);
2393 innerEstimator.setInitialPathLossExponent(initialPathLossExponent);
2394 innerEstimator.setTransmittedPowerEstimationEnabled(transmittedPowerEstimationEnabled);
2395 innerEstimator.setPositionEstimationEnabled(positionEstimationEnabled);
2396 innerEstimator.setPathLossEstimationEnabled(pathLossEstimationEnabled);
2397 innerEstimator.setReadings(innerReadings);
2398
2399 innerEstimator.estimate();
2400
2401 final var cov = innerEstimator.getEstimatedCovariance();
2402 if (keepCovariance && cov != null) {
2403 // keep covariance
2404 covariance = cov;
2405
2406 final var dims = getNumberOfDimensions();
2407 var pos = 0;
2408 if (positionEstimationEnabled) {
2409 // position estimation enabled
2410 final var d = dims - 1;
2411 if (estimatedPositionCovariance == null) {
2412 estimatedPositionCovariance = covariance.getSubmatrix(0, 0, d, d);
2413 } else {
2414 covariance.getSubmatrix(0, 0, d, d, estimatedPositionCovariance);
2415 }
2416 pos += dims;
2417 } else {
2418 // position estimation disabled
2419 estimatedPositionCovariance = null;
2420 }
2421
2422 if (transmittedPowerEstimationEnabled) {
2423 // transmitted power estimation enabled
2424 estimatedTransmittedPowerVariance = covariance.getElementAt(pos, pos);
2425 pos++;
2426 } else {
2427 // transmitted power estimation disabled
2428 estimatedTransmittedPowerVariance = null;
2429 }
2430
2431 if (pathLossEstimationEnabled) {
2432 // path-loss exponent estimation enabled
2433 estimatedPathLossExponentVariance = covariance.getElementAt(pos, pos);
2434 } else {
2435 // path-loss exponent estimation disabled
2436 estimatedPathLossExponentVariance = null;
2437 }
2438 } else {
2439 covariance = null;
2440 estimatedPositionCovariance = null;
2441 estimatedTransmittedPowerVariance = null;
2442 estimatedPathLossExponentVariance = null;
2443 }
2444
2445 estimatedPosition = innerEstimator.getEstimatedPosition();
2446 estimatedTransmittedPowerdBm = innerEstimator.getEstimatedTransmittedPowerdBm();
2447 estimatedPathLossExponent = innerEstimator.getEstimatedPathLossExponent();
2448 } catch (final Exception e) {
2449 // refinement failed, so we return input value, and covariance
2450 // becomes unavailable
2451 covariance = null;
2452 estimatedPositionCovariance = null;
2453 estimatedTransmittedPowerVariance = null;
2454 estimatedPathLossExponentVariance = null;
2455
2456 estimatedPosition = initialPosition;
2457 estimatedTransmittedPowerdBm = initialTransmittedPowerdBm;
2458 estimatedPathLossExponent = initialPathLossExponent;
2459 }
2460 } else {
2461 covariance = null;
2462 estimatedPositionCovariance = null;
2463 estimatedTransmittedPowerVariance = null;
2464 estimatedPathLossExponentVariance = null;
2465
2466 estimatedPosition = initialPosition;
2467 estimatedTransmittedPowerdBm = initialTransmittedPowerdBm;
2468 estimatedPathLossExponent = initialPathLossExponent;
2469 }
2470 }
2471 }