How to use gradient and Hessian in optimization problem when objective and constraint functions contain variables without analytic expression with respect to states?

5 views (last 30 days)
I've write a code using Fmincon to minimize my objective function. But I found my results highly depend on my initial guess for the states and not always converge or take a very long time to compute. So I looked the tutorial introduced on "Matlab Optimisation Toolbox User Guide (2015)" about "Symbolic Math Toolbox Calculates Gradients and Hessians". But when I looked back my optimization problem, I don't know how to or whether it is possible to implement the tutorial method, since in both my objective and constraints functions there are variables which I need to find values according to look-up-tables based on my states which I want to optimize, for example:
%% objective function J = -(2*Fx_FL + 2*Fx_RL -Fdrag)/m/g;
Here Fdrag is the function of one of my states U, m and g are constants. Fx_FL is the force which depends on torque Tm_FL, and Tm_FL is interpolated from a look-up-table based on other three states (U, W_FL, Top1) [all these states are going to be optimized too]. Fx_RL has the same situation as Fx_FL described above. Since the look-up-table doesn't have analytic expression, I don't know how to generate the gradient and Hessian for my objective function and my constraints.
I also heard a method called automatic differentiation, but I don't know what it is and how it works.
Could you help me with my problem? Thank you very much.

Answers (1)

Alan Weiss
Alan Weiss on 21 Apr 2015
It doesn't sound as if gradients or Hessians will help in this case.
It sounds to me like your calculations might be based on solving a simulation or ODE. For suggestions in this case, see Optimizing a Simulation or ODE.
If I am wrong, then what is taking so much time in your objective function calculation?
Alan Weiss
MATLAB mathematical toolbox documentation
  2 Comments
Tao
Tao on 21 Apr 2015
Here time is not the thing that really brothers me, but the result itself. Given initial guess for my states for Fmincon, sometimes the result converges nicely, sometimes not.
I don't think I have to solve ode, since the optimization is to search the optimal states at a "frozen time point". If states (U, W_FL, Top1) are given, then Tm_FL is known by just look for a known table. But I'm wondering whether this kind of optimization can be provided with gradients and Hessians?
Thanks a lot.
Alan Weiss
Alan Weiss on 23 Apr 2015
It is possible that there is some nonsmoothness in your objective function or nonlinear constraint functions due to interpolating from table lookups. So follow the suggestion in my previous link and use larger-than-default finite differencing steps, and maybe central finite differences.
You might also try to smooth your objective or nonlinear constraint functions by basing them on some sort of spline or convolution.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!