It is much more efficient to use matlabFunction. Therefore you should perform this calculation only once, and generate code, via matlabFunction, to call during execution of the solver.Įvaluating symbolic expressions with the subs function is time-consuming. This means that a symbolic gradient or Hessian has to be placed in the appropriate place in the objective or constraint function file or function handle.Ĭalculating gradients and Hessians symbolically can be time-consuming. Optimization gradients, and sometimes Hessians, are supposed to be calculated within the body of the objective or constraint functions. This requires you to translate between vectors and scalars. However, symbolic variables are scalar or complex-valued, not vector-valued. Optimization objective and constraint functions should be defined in terms of a vector, say x.
0 Comments
Leave a Reply. |