NLP problem with fmincon: Non-differentiable point in objective function
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Consider the simplified optimisation problem having as decision variable the vector:
where N is the number of discretisation points, multiplied by the number of variables per point (e.g. 6 state variables and 3 control variables).
Let the objective function be defined such that the control effort is minimised:
Where n is the number of discretisation points and is the 3x1 control vector at the i-th time instant.
In code notation, this becomes:
%% Example:
% Problem data:
timeInstants = 10;
stateVariables = 6;
controlVariables = 3;
allVariables = stateVariables + controlVariables;
decisionVariables = allVariables*timeInstants;
% Indeces:
idx = reshape(1:decisionVariables,allVariables,[])';
controlIdx = idx(:,1:controlVariables)';
% NLP vector:
x = rand(1,decisionVariables);
% Objective function:
f = sum(vecnorm(x(controlIdx)));
From literature, I know that the optimal solution of my problem is bang-bang, i.e.:
The analytical Jacobian and Hessian are defined as:
Considering the control profile I'm looking for, the convergence is affected by the singularity when , where both Jacobian and Hessian become indeterminate.
I tried to overcome the problem by imposing alternatives forms when the NaN occurs (such as ones or zeros), but considering that the zero solution is optimal, this causes convergence failures.
The same problem occurs with numerical derivatives.
How can I overcome this problem?
Do you have any reference about other people facing this issue?
Thanks in advance.
0 comentarios
Respuestas (1)
Torsten
el 12 de Jun. de 2024
Editada: Torsten
el 12 de Jun. de 2024
The solution variables for "fmincon" must be continuous in order to compute gradients, Hessians etc. Therefore, the solver is not suited for problems with decision variables. Maybe you can use "intlinprog", maybe you have to use "ga".
Ver también
Categorías
Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!