# How does one design a trajectory involving a lunar and Earth flyby and Lagrange points? What tools are used to calculate the initial guesses?

I'm trying to design a trajectory that takes a spacecraft from Sun-Earth L2 to a lunar flyby, to an Earth flyby and then to Mars (two flybys might be too complex, I might just do one). I've optimized a variety of interplanetary trajectories in GMAT with initial guesses generated from a simple software called Trajectory Optimization Tool, which uses patched conics to give the user dates for the arrival at the various planets in the trajectory (see image for an example of its inputs and outputs).

The problem is that it uses patched conics and can only do interplanetary trajectories (so no Earth-Moon trajectories and the like), meaning it can't be used for what I'm trying to do. So how do mission designers go about getting a "first glance" or low-fidelity analysis of the dates they should be looking for for such trajectories? What software does what the one on the image does, but with Lagrange points and Earth-centered trajectories?

• “I’ve optimized … in GMAT…”. Was this a manual procedure? GMAT has optimization routines you can minimize duration / fuel with. It’s not out of box ready to do that’s, but I think at least one of the demo missions does this.
– cms
Aug 16 at 0:21
• @cms I made a GMAT script that tries to optimize the trajectory described in the question but I can't get it to work, I think GMAT is only meant to be used to optimize with initial guesses. Hence me looking for a tool that can do what Trajectory Optimization Tool does but more advanced. Here (imgur.com/a/TrqIiYr) you can find an example of a similar script I did for an SEL2-Earth flyby-Mars trajectory, which also didn't vary the variables the way I wanted it to. Is my intuition correct that GMAT simply can't do this, or am I doing something wrong with its optimization settings? Aug 16 at 12:51
• Generally speaking, the sort of people who do this for real already have a suite of custom in-house tools (e.g., the top-notch stuff NASA explicitly does not make available open-source, unlike GMAT) or have paid hundreds of thousands of dollars in software licensing fees to one of the very small number of commercial vendors who specialize in this extremely niche application. AGI will happily teach you "free" classes giving you instructions how to use STK to do it, but if you can't afford their tool, that doesn't help. Aug 19 at 23:14