# Optimizing trajectories with GMAT: how to understand the "Vary" parameters, and how to know what values to use for them?

I've been using GMAT in my free time to optimize trajectories, and have varied burn component values and spacecraft states, usually with success. The vary command in GMAT, with the Yukon optimizer that I am using, has the following parameters that can be changed:

• Initial value: The initial guess. I know the gradient descent optimization method that GMAT uses is very sensitive to initial conditions and so this must be feasible or reasonably close.

• Perturbation: The step size used to calculate the finite difference derivative.

• Max step: The maximum allowed change in the control variable during a single iteration of the solver.

• Additive scale factor: Number used to nondimensionalize the independent variable. This is done with the equation $$xn = m (xd + a)$$, where $$xn$$ is the non-dimensional parameter, $$xd$$ is the dimensional parameter and this parameter is $$a$$.

• Multiplicative scale factor: Same as above, but it's the variable $$d$$ in the equation.

For the initial value, I can usually see when my chosen value is feasible by observing the solver window or a graphical display of the orbit in different iterations. The max step is the most intuitive of these parameters for me, and by trial and error, observation of the solver window and how sensitive my target variables are to changes in the control variables I can usually get it right and get convergence. It is still partially trial and error, though.

However, I do not understand the effect of the other parameters on the optimization. I read a bit about finite difference and nondimensionalization/rescaling, and I think I understand them conceptually, but I still don't understand what values they have to be to get an optimal optimization process.

This is especially a problem now because I have started to vary epochs (TAIModJulian usually) or time intervals (e.g. "travel for x days" and find optimal x, or to find optimal launch windows), and I cannot get the optimizer to vary them properly, even when I use a large step size. The optimizer usually stays close to the initial values, and eventually leads to a non-convergence message.

I have noticed that using large values for the two scale factors sometimes gives me larger step sizes and occasionally what I want, but it's still trial and error. As far as perturbation goes, I do not understand its influence on how the optimization works. Sometimes for extremely small values I get array dimension errors, sometimes for very large values I get similar results to if I'm using too large a max step size, and that's about it. I usually use 10-5 to 10-7 and it seems to work most of the time. Unfortunately information on the topic seems sparse, and from what I can tell GMAT's documentation uses different terminology for these concepts than what I can find online.

So I guess my question is two-fold: how to understand the optimization parameters of GMAT and what they should be in different situations, and what should they be when I want GMAT to consider a wide array of possible trajectories with different values of control variables, especially when those control variables are epochs or time intervals? Is there a procedure or automatic method that takes into account the scale of the optimization problem and its sensitivity, and gives an estimate of what the optimization parameters should be?

In my experience with GMAT, sometimes I found it easier to initially start with a Targeting problem then refine from there, as a successful targeting problem will give you good convergent bounds to optimize from. While targeting can still be a bit picky with its inputs, I was able to run a for loop through starting values for varied values in order to find a range that would converge.

With regard to your issue of Epochs/Time intervals, GMAT can be very odd with these, so I would do something like this (for loop variable can be placed inside a vary or achieve as well):

For departure_time = 0 : time_interval : ending_time
Target
Propagate Sat1.ElapsedDays = departure_time
Vary
Maneuver (or Prop or whatever)
Achieve
*( Report successful values if necessary)
EndTarget
EndFor


This way you can store convergent time values and even epochs for future use. Additionally, you can stack for loops in order to further analyze wider ranges of trajectories. I know I use Targeting in my example, but you should be able to switch out optimization with little to no problems.

Also, VF13ad may be a more flexible optimizer as well. I think it can be found here http://www.thinksysinc.com/downloads.html

• This seems like a good idea, thanks. How can I get GMAT to check on whether convergence has been achieved so that it knows to store the values? Oct 4, 2022 at 14:55

@Karl, I run trajectories on GMAT for 10 years or about. You are much advanced over me and I cannot give a technical answer. When I had questions as you do, I used to email contributors and very often got personal answers. The contributors list from gmat sourceforge site is: dcooley, djcinsb, jjkparker, mstarkinmd, noblehatten, ravidavi. But their emails are hard to find now; they are not listed anymore. Perhaps you could look them up someplace and pose your questions directly to authors. jjkparker and cooley used to communicate back to me. On sourceforge, you might also join or contact all on the developers list with your query and perhaps you might get an answer.

There used to be a GMAT user forum but it is gone as is the GMAT.org home page. But new versions of the source code keep coming out. GMAT looks to be in use on current missions.

A harder approach is to download the source code and search the code for the sections related to "vary". A new version for at least 2020, maybe newer, is available. Perhaps you could figure out what the code is doing and make your own mods as needed.