1   /* Copyright 2002-2025 CS GROUP
2    * Licensed to CS GROUP (CS) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * CS licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *   http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.orekit.estimation.leastsquares;
18  
19  import org.hipparchus.linear.MatrixDecomposer;
20  import org.hipparchus.linear.QRDecomposer;
21  import org.hipparchus.optim.nonlinear.vector.leastsquares.LeastSquaresProblem.Evaluation;
22  import org.hipparchus.optim.nonlinear.vector.leastsquares.SequentialGaussNewtonOptimizer;
23  import org.orekit.propagation.conversion.PropagatorBuilder;
24  
25  /**
26   * Sequential least squares estimator for orbit determination.
27   * <p>
28   * When an orbit has already been estimated and new measurements are given, it is not efficient
29   * to re-optimize the whole problem. Only considering the new measures while optimizing
30   * will neither give good results as the old measurements will not be taken into account.
31   * Thus, a sequential estimator is used to estimate the orbit, which uses the old results
32   * of the estimation and the new measurements.
33   * <p>
34   * In order to perform a sequential optimization, the user must configure a
35   * {@link org.hipparchus.optim.nonlinear.vector.leastsquares.SequentialGaussNewtonOptimizer SequentialGaussNewtonOptimizer}.
36   * Depending if its input data are an empty {@link Evaluation}, a complete <code>Evaluation</code>
37   * or an a priori state and covariance, different configuration are possible.
38   * <p>
39   * <b>1. No input data from a previous estimation</b>
40   * <p>
41   * Then, the {@link SequentialBatchLSEstimator} can be used like a {@link BatchLSEstimator}
42   * to perform the estimation. The user can initialize the <code>SequentialGaussNewtonOptimizer</code>
43   * using the default constructor.
44   * <p>
45   * <code>final SequentialGaussNewtonOptimizer optimizer = new SequentialGaussNewtonOptimizer();</code>
46   * <p>
47   * By default, a {@link QRDecomposer} is used as decomposition algorithm. In addition, normal
48   * equations are not form. It is possible to update these two default configurations by using:
49   * <ul>
50   *   <li>{@link org.hipparchus.optim.nonlinear.vector.leastsquares.SequentialGaussNewtonOptimizer#withDecomposer(MatrixDecomposer) withDecomposer} method:
51   *       <code>optimizer.withDecomposer(newDecomposer);</code>
52   *   </li>
53   *   <li>{@link org.hipparchus.optim.nonlinear.vector.leastsquares.SequentialGaussNewtonOptimizer#withFormNormalEquations(boolean) withFormNormalEquations} method:
54   *       <code>optimizer.withFormNormalEquations(newFormNormalEquations);</code>
55   *   </li>
56   * </ul>
57   * <p>
58   * <b>2. Initialization using a previous <code>Evalutation</code></b>
59   * <p>
60   * In this situation, it is recommended to use the second constructor of the optimizer class.
61   * <p>
62   * <code>final SequentialGaussNewtonOptimizer optimizer = new SequentialGaussNewtonOptimizer(decomposer,
63   *                                                                                           formNormalEquations,
64   *                                                                                           evaluation);
65   * </code>
66   * <p>
67   * Using this constructor, the user can directly configure the MatrixDecomposer and set the flag for normal equations
68   * without calling the two previous presented methods.
69   * <p>
70   * <i>Note:</i> This constructor can also be used to perform the initialization of <b>1.</b>
71   * In this case, the <code>Evaluation evaluation</code> is <code>null</code>.
72   * <p>
73   * <b>3. Initialization using an a priori estimated state and covariance</b>
74   * <p>
75   * These situation is a classical satellite operation need. Indeed, a classical action is to use
76   * the results of a previous orbit determination (estimated state and covariance) performed a day before,
77   * to improve the initialization and the results of an orbit determination performed the current day.
78   * In this situation, the user can initialize the <code>SequentialGaussNewtonOptimizer</code>
79   * using the default constructor.
80   * <p>
81   * <code>final SequentialGaussNewtonOptimizer optimizer = new SequentialGaussNewtonOptimizer();</code>
82   * <p>
83   * The MatrixDecomposer and the flag about normal equations can again be updated using the two previous
84   * presented methods. The a priori state and covariance matrix can be set using:
85   * <ul>
86   *   <li>{@link org.hipparchus.optim.nonlinear.vector.leastsquares.SequentialGaussNewtonOptimizer#withAPrioriData(org.hipparchus.linear.RealVector, org.hipparchus.linear.RealMatrix) withAPrioriData} method:
87   *       <code>optimizer.withAPrioriData(aPrioriState, aPrioriCovariance);</code>
88   *   </li>
89   * </ul>
90   * @author Julie Bayard
91   * @since 11.0
92   */
93  public class SequentialBatchLSEstimator extends BatchLSEstimator {
94  
95      /**
96       * Simple constructor.
97       * <p>
98       * If multiple {@link PropagatorBuilder propagator builders} are set up, the
99       * orbits of several spacecrafts will be used simultaneously. This is useful
100      * if the propagators share some model or measurements parameters (typically
101      * pole motion, prime meridian correction or ground stations positions).
102      * </p>
103      * <p>
104      * Setting up multiple {@link PropagatorBuilder propagator builders} is also
105      * useful when inter-satellite measurements are used, even if only one of
106      * the orbit is estimated and the other ones are fixed. This is typically
107      * used when very high accuracy GNSS measurements are needed and the
108      * navigation bulletins are not considered accurate enough and the
109      * navigation constellation must be propagated numerically.
110      * </p>
111      * <p>
112      * The solver used for sequential least squares problem is a
113      * {@link org.hipparchus.optim.nonlinear.vector.leastsquares.SequentialGaussNewtonOptimizer
114      * sequential Gauss Newton optimizer}.
115      * Details about how initialize it are given in the class JavaDoc.
116      * </p>
117      *
118      * @param sequentialOptimizer solver for sequential least squares problem
119      * @param propagatorBuilder builders to use for propagation.
120      */
121     public SequentialBatchLSEstimator(final SequentialGaussNewtonOptimizer sequentialOptimizer,
122                                       final PropagatorBuilder... propagatorBuilder) {
123         super(sequentialOptimizer, propagatorBuilder);
124     }
125 
126 }