Embed uses finite difference approximations to compute derivatives of the problem functions. These are computed by Embed routines using forward differences or using central differences. Use of forward differences is the default option. To invoke central differences, use the kderiv option.
Finite difference derivatives have roughly half the precision of the constraint and cost functions. Hence, if each function is accurate to five or six significant digits, then the derivatives have about two or three significant digits, which is adequate in most instances. However, if each function has four or fewer significant digits, then the derivatives have two or less, which may seriously hinder the optimizer.
Low precision often occurs when numerical routines are used to evaluate one or more of the functions. This can occur in chemical process models where recycle loops require iterative solution of a system of implicit nonlinear equations, or when differential equations are solved numerically. Then, the accuracy of these numerical calculations determines the accuracy of the functions.
Inaccurate derivatives can cause Embed to terminate at a non-optimal point, often with the message inform = 2. Possible remedies include:
• Increasing the accuracy of the functions computed (by decreasing the simulation step size)
• Using central differences (by specifying the kderiv option)
• Trying different step sizes (via the pstep option)