MultipleShooter.java

  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.utils;

  18. import java.util.List;
  19. import java.util.Map;

  20. import org.orekit.propagation.SpacecraftState;
  21. import org.orekit.propagation.numerical.EpochDerivativesEquations;
  22. import org.orekit.propagation.numerical.NumericalPropagator;

  23. /**
  24.  * Multiple shooting method applicable for trajectories, in an ephemeris model.
  25.  * Not suited for closed orbits.
  26.  * @see "TRAJECTORY DESIGN AND ORBIT MAINTENANCE STRATEGIES IN MULTI-BODY DYNAMICAL REGIMES by Thomas A. Pavlak, Purdue University"
  27.  * @author William Desprats
  28.  * @author Alberto Fossà
  29.  * @since 10.2
  30.  */
  31. public class MultipleShooter extends AbstractMultipleShooting {

  32.     /** Name of the additional derivatives. */
  33.     private static final String DERIVATIVES = "derivatives";

  34.     /** Derivatives linked to the Propagators.
  35.      * @since 11.1
  36.      */
  37.     private final List<EpochDerivativesEquations> epochEquations;

  38.     /** Simple Constructor.
  39.      * <p> Standard constructor for multiple shooting which can be used with non-autonomous systems.</p>
  40.      * @param initialGuessList initial patch points to be corrected
  41.      * @param propagatorList list of propagators associated to each patch point
  42.      * @param epochEquations list of additional derivatives providers linked to propagatorList
  43.      * @param tolerance convergence tolerance on the constraint vector
  44.      * @param maxIter maximum number of iterations
  45.      */
  46.     public MultipleShooter(final List<SpacecraftState> initialGuessList,
  47.                            final List<NumericalPropagator> propagatorList,
  48.                            final List<EpochDerivativesEquations> epochEquations,
  49.                            final double tolerance, final int maxIter) {
  50.         super(initialGuessList, propagatorList, tolerance, maxIter, false, DERIVATIVES);
  51.         this.epochEquations = epochEquations;
  52.     }

  53.     /** {@inheritDoc} */
  54.     protected SpacecraftState getAugmentedInitialState(final int i) {
  55.         return epochEquations.get(i).setInitialJacobians(getPatchPoint(i));
  56.     }

  57.     /** {@inheritDoc} */
  58.     protected double[][] computeAdditionalJacobianMatrix(final List<SpacecraftState> propagatedSP) {

  59.         final Map<Integer, Double> mapConstraints = getConstraintsMap();
  60.         final double[][] M = new double[mapConstraints.size()][getNumberOfFreeComponents()];

  61.         int k = 0;
  62.         for (int index : mapConstraints.keySet()) {
  63.             M[k][index] = 1.0;
  64.             k++;
  65.         }
  66.         return M;
  67.     }

  68.     /** {@inheritDoc} */
  69.     protected double[] computeAdditionalConstraints(final List<SpacecraftState> propagatedSP) {
  70.         // The additional constraint vector has the following form :

  71.         //           [ y1i - y1d ]---- other constraints (component of
  72.         // Fadd(X) = [    ...    ]    | a patch point equals to a
  73.         //           [vz2i - vz2d]----  desired value)

  74.         // Number of additional constraints
  75.         final double[] fxAdditional = new double[getConstraintsMap().size()];

  76.         // Update additional constraints
  77.         updateAdditionalConstraints(0, fxAdditional);
  78.         return fxAdditional;
  79.     }

  80. }