How to prevent fmincon from immediately going to the lower bound of time in a minimum time problem?

2 views (last 30 days)
Carleen McKenna
Carleen McKenna on 8 Jul 2021
Commented: Carleen McKenna on 8 Jul 2021
Hi everyone,
I'm currently attempting to solve a trajectory optimization problem of 249, or 8N+1 where N = 31, variables (replicating past work - this problem has apparently been solved using NPSOL). The 8N are all the variables included in the dynamics of the problem, 8 variables (6 states and 2 controls) over N = 31 time steps, and the +1 is the time step Δt. I am using Hermite-Simpson collocation for nonlinear constraints and my objective function is minimum time, or J = Δt*N as opposed to final time due to the suggestion of a 2005 paper on the topic: https://arxiv.org/pdf/2005.12136.pdf (if anyone wanted to look at it). This objective function change from just using has actually improved the performance of the solver, but I still consistently have convergence issues, constantly either receiving infeasible trajectories or having the solver exceed the maximum number of evaluations. I have upper and lower bounds on several of the variables, including the time step.
Below are the optimoptions I'm using:
options = optimoptions(@fmincon, 'MaxIter', 10000, ...
'MaxFunEvals', 150000, 'DiffMinChange', .1, 'Display', 'iter',...
'ConstraintTolerance', 1e-8, 'OptimalityTolerance', 1e-12,...
'FiniteDifferenceStepSize', 1e-1);
The behavior I observe is that the solver immediately goes to the lower bound of the the time step and then doesn't change, in a way "bouncing around" for hundreds of iterations of the solver in one place until it finally settles for a trajectory that in no way satisfies my constraints. Removing constraints only results in wilder trajectories that make no sense. How do I prevent this behavior? The lower bound is currently one second, with an upper bound of around 30 seconds, for a problem that should take around 15-25 seconds. It makes no sense for this trajectory to occur in one second and yet this is what the solver is saying happens.

Answers (1)

Alan Weiss
Alan Weiss on 8 Jul 2021
I am not sure that I understand exactly what is happening. But it sounds to me as if the nonlinear constraints are not being satisfied, and the objective function value is overpowering the constraint values for the solver.
So I suggest that you multiply your nonlinear constraint function by a large number, say 1e3 or 1e4, and see whether that helps. Of course, you should also check your nonlinear constraint function by setting some trajectories and seeing that the constraint values make sense for those trajectories.
As an aside, your finite differencing options do not make sense. I suuggest that you remove the DiffMinChange option call. See Set Larger Finite Differences.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
  1 Comment
Carleen McKenna
Carleen McKenna on 8 Jul 2021
I agree that my objective function is definitely overpowering my nonlinear constraints, and I wasn't sure how to prevent this from happening. I will try your suggestion, thanks!

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!