# Design Optimization

The goal of an optimization run is to minimize an objective function, $\psi$ , specified in the following integral form:(1)
$\psi ={\psi }_{0}\left(b\right)+{\int }_{{t}_{0}}^{{t}_{f}}L\left(x,\lambda ,b,t\right)d\tau$

${\psi }_{0}\left(b\right)$ represents the initial value of $\psi$ that may be accumulated from prior analysis when multiple simulates are involved.

You can differentiate the above equation with respect to time, to obtain the following equivalent relationships:(2)
$\begin{array}{l}\stackrel{˙}{z}=L\left(x,b,t\right)\\ z\left({t}_{0}\right)\triangleq {\Psi }_{0}\left(b\right)\\ \therefore \Psi =z\left({t}_{f}\right)\end{array}$

In MotionSolve, the equations $\stackrel{˙}{z}=L\left(x,b,t\right)$ are defined through a new modeling element, RV. RV accepts a function expression as input. An initial condition is also specified. As output, it returns the time integral of the expression $L$ . RVAL is the $y$ output mentioned earlier.

When a DSA is performed, MotionSolve computes the partial derivatives of the RVALs with respect to each of the design variables. This is returned in an array DSARY.

The sensitivity of the cost function, $\frac{\partial \psi }{\partial b}$ , is in terms of the DSARY.

The Python interface to MotionSolve supports several optimization functions. It is designed to follow a well-defined sequence of steps and require minimal input from you.

## The Key Steps to Performing an Optimization:

• Create a designable model of a system using this interface
• Instrument the model to be optimization ready
• Create model responses that you wish to optimize. These are called metrics.
• Define target values you want for the metrics you defined
• Create an objective from the metric functions and target values
• Create an optimizer and give it the objective you defined
• Ask the optimizer to optimize the system