# Automatic parameter estimation theory

Automatic parameter estimation (APE) is a mathematical process, known as multi-variable optimization, which automatically adjusts a specified set of function parameters to minimize error between the function and measured data. The mathematical function being minimized is called the objective function.

With analytical modeling in Harmony Enterprise, the objective function is calculated as follows:

• If Calculate Pressure mode is used:

• If Calculate Rate mode is used:

Where (summation is done for all history points, and i is the number of the point):

• (phist)i — historical pressure for the i-th point
• (pcalc)i — calculated pressure for the i-th point
• (qhist)i — historical rate for the i-th point
• (qcalc)i — calculated rate for the i-th point
• wi — weight for the i-th point

wi = 0 if the point is deselected; wi = 1 if the point is selected; wi = 10 if the point is weighted.

If Calculate Both mode is used, the objective function is calculated as the sum of the objective functions for Calculate Pressure and Calculate Rate modes.

Eavg reflects the difference between calculated and historical data; therefore a smaller Eavg indicates a better history match. The value of the objective function Eavg is displayed under the APE group in the Analytical Model pane.

Over an iterative process, the selected modeling parameters are adjusted using the Mead (Simplex) optimization method to minimize the objective function.

Automatic parameter estimation should not be used exclusively because it is possible to find several sets of parameters that yield an acceptable model match. In other words, the solution can be non-unique. It is always recommended to start with parameters obtained from diagnostic analyses, and then fine-tune these parameters manually to obtain a close match. You can use APE for unknown parameters, or parameters which are not known with confidence. The more parameters that are selected for APE (or fitting), the longer the fitting process will take, with a greater chance of finding non-unique solutions. Note that if you include more data points in the fit, it will reduce performance.