fmincon vs VF13ad

General help that does not fall into a more specific category

fmincon vs VF13ad

Postby Koln » Tue Nov 11, 2014 12:11 pm

Hi everyone,

should fmincon and VF13ad provide the same results?

since I got the optimizer from MATLAB running I went ahead and modified the script from the tutorial Optimal Lunar Flyby using Multiple
Shooting to use fmincon instead of VF13ad. I ran it and, to my surprise, it doesn't provide the same results. The values for all the parameters are the same within the specified tolerance, but the delta-V required changes from the ~0.09 km/s of the user guide to ~0.12 km/s from fmincon. That's a whole 30% increase so, I was wondering, why could it be? I defined the optimizer as in the code below (I changed barely anything from the VF13ad version and used default values whenever required):

Code: Select all
Create FminconOptimizer NLPOpt;
NLPOpt.ShowProgress = true;
NLPOpt.ReportStyle = Normal;
NLPOpt.ReportFile = '';
NLPOpt.MaximumIterations = 200;
NLPOpt.DiffMaxChange = '0.1';
NLPOpt.DiffMinChange = '1e-8';
NLPOpt.MaxFunEvals = '1000';
NLPOpt.TolX = '1.0000e-04';
NLPOpt.TolFun = '1.0000e-05';
NLPOpt.TolCon = '0.1';

I make this run copying literally everything from the tutorial into the script and just changing optimizer. Changing tolerances doesn't make any relevant difference and the optimizer doesn't reach the maximum number of iterations, so that isn't a problem.

Funnily enough, the XY plots (the plots of the errors) are the same as in the tutorial for the first run without all the constraints, but in the optimized trajectory they differ completely. This is kind of expected, since the optimization process may be different and it may vary the parameters differently, but I would expect that both optimizers arrive at the same results.

So, should they get the same results? If not, how can I assure that the result from fmincon are optimal and not just some kind of local minimum? And if they should give the same results, what am I doing wrong? I see nothing else I should change for the fmincon optimizer. Maybe is the tutorial in the user guide old? ^^

Thanks for your time!

Posts: 5
Joined: Thu Nov 06, 2014 5:11 pm

Re: fmincon vs VF13ad

Postby jjkparker » Tue Nov 11, 2014 3:45 pm


I can't test this script right now, but I think it is NOT generally unexpected that using a different optimizer on this problem may produce a different answer. VF13 and fmincon are both local optimizers, which mean they will converge on a local minimum that is not guaranteed to also be (and is generally not) the global minimum.

fmincon is using a different method than VF13, so it takes a different "path" through the problem, which may cause it to find a different local minimum. As an experiment, you could try varying the flyby date or initial state slightly in various ways, and see if the solution converges differently due to those variations.
Joel J. K. Parker
Flight dynamics engineer, GMAT team
Posts: 617
Joined: Thu Jan 07, 2010 9:48 pm
Location: NASA Goddard Space Flight Center, Greenbelt, MD

Re: fmincon vs VF13ad

Postby Koln » Wed Nov 12, 2014 12:24 pm

Thanks for the clarification Joel ^^. I'll play around with the optimizer and see where I get :)
Posts: 5
Joined: Thu Nov 06, 2014 5:11 pm

Re: fmincon vs VF13ad

Postby kitamura » Fri Jun 01, 2018 4:23 am

I realized the same result that Fmincon optimizer converges to the different local optima from VF13ad.

Then, I tried additional constraints on lower boundary of MOI.Element1.

For example, if I constrained the lower boundary by
"nonlinearConstraint NLPOpt(MOI.Element1>=-0.08)",
I got the more fuel efficient trajectory than VF13ad with ~0.08 km/s

It seems this Tutorial has many local minimums.

Posts: 3
Joined: Sun May 27, 2018 2:58 pm

Return to General

Who is online

Users browsing this forum: No registered users and 2 guests