Providing gradient using fmincon in an Model Predictive Control context
6 次查看(过去 30 天)
显示 更早的评论
Hello
I've set up a nonlinear MPC problem in Matlab. I'm using Fmincon as the solver which is extremely slow. Looking at the time and run profiler I see that we spend most amount of calculation time in calculating finite differences. So I'm now trying to provide the gradient for fmincon.
Now, the nonlinear constraints are on the states while the optimisation variable is the input u. So the gradient of the constraint function should be zero? (well, zeros to cover the whole horizon). But using the 'CheckGradients' true option throws an error saying that my provided gradient value is not that of the calculated by fmincon. So my question is, how can the gradient be anything other than zero?
0 个评论
回答(1 个)
Matt J
2017-4-25
编辑:Matt J
2017-4-25
Now, the nonlinear constraints are on the states while the optimisation variable is the input u. So the gradient of the constraint function should be zero?
No, the states are functions of u and so the constraints will also depend on u. MPC is not my field, but I suspect that if you have constraints as a function of the states, then using the chain rule together with the state equations, you can calculate their gradients with respect to u.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Model Predictive Control Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!