The first half of the trajectory is optimized by adjusting the velocity component of the initial conditions so that the trajectory - remember the integration is being done backward in time, starting at conjunction - ends outside of Earth's orbit. Then the velocity is decreased, causing the end point to get closer to Earth.
The first few iterations target Earth's Sphere of Influence (a circle centered at Earth with a radius of about 9.3 E5 Km). Subsequent iterations continue integrating the flight path until it either intersects Earth or passes behind Earth.
The program output shows both stages of the process - the coarse, heliocentric targeting of the SOI, then the fine geocentric targeting of Earth itself. The integration is stopped as soon as the range to Earth starts increasing. This is the closest point of approach to Earth, and a tangential thrust is applied here to put the spacecraft in a circular orbit. The spacecraft must still reach the 200 Km parking orbit, so addtional thrust is added for a simple Hohmann Transfer to the lower orbit.
NOTE: In this "pure" Hohmann scenario, the optimal trajectory begins at the 200 Km parking orbit itself (even though the optimization technique calculates an additional small Hohmann for prior iterations that do not terminate at the parking orbit; the program still needs a total thrust for each pass).
The user defined options allow more complex conditions. One scenario is for the spacecraft to start at the initial parking orbit, go to a higher altitude orbit, and to begin the escape trajectory from there, slightly behind the Earth. The spacecraft has a small gravity assisted
flyby
. Another option allows the periapse of this hyperbola to drop as low as 15 Km above Earth. In either case there will be two thrusts calculated for the maneuver: One very small thrust to raise the height of the parking orbit, then the large escape thrust to begin the escape trajectory.
The optimization of these user-defined scenarios is more complex than just stopping the integration when the range starts opening. These options are intended to explore the possibility of letting the spacecraft go past Earth so that the gravity of Earth can be used to change the geometry of the trajectory and lower the speed of the spacecraft, reducing the thrust needed to achieve an escape trajectory. So, once the range begins opening, the program calculates the total thrust to reach the 200 Km parking orbit at each step of the integrator. The lowest final thrust among these values is saved as the global minimum is the optimal thrust for that particular pass. Additional passes are done until the closest point of approach to Earth on the trajectory is 200 Km (or less, if so specified by the user). The lowest total thrust among all these passes is the global minimum for the Earth half of the flight path.