This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
optim:start [2019/06/17 10:10] helene created |
optim:start [2022/03/25 11:48] (current) helene |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Parameter optimization tool for Lagamine ====== | + | ====== OPTIM: Parameter optimization tool for Lagamine ====== |
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Objective ===== | ||
+ | This optimization program allows the identification of the values of parameters likely to minimize an objective function representing the difference between two curves. The program will take a reference curve as an input (an experimental curve for instance) and will attempt to approach this curve with the finite element code Lagamine using different parameters obtained through the **Levenberg-Marquardt** algorithm. A schematic representation of the algorithm is shown in <imgref image1>. \\ \\ | ||
+ | <imgcaption image1|Optim algorithm>{{ :optim:optim_gen1.png?600 |}}</imgcaption> \\ | ||
+ | The optimization process is iterative and stops once a stop criterion is met, such as the stabilization of the objective function for instance. \\ | ||
+ | The code gives the possibility to optimize a set of parameters using several curves for one simulation, or several simulations at a time. All the curves are then concatenated in one global curve for the computation of the objective function. | ||
+ | |||
+ | ---- | ||
+ | |||
+ | |||
+ | ===== Description ===== | ||
+ | The objective function to be minimized by the algorithm is the following: \\ | ||
+ | \[S=\sqrt{\displaystyle\sum_{i=1}^{n_{total}} (u_i^{FE}-u_i^{REF})^2}\] | ||
+ | Where: | ||
+ | * $i$ represents one of the $n_{total}$ points of the global reference curve. If the global curve is constituted of several curves, $n_{total}$ is the sum of the $n$ points of each curve (each curve can have a different number of points). In Optim, the number of points $n$ to be used for each curve is defined by the user (NPOI) in the *.info file. Giving a larger NPOI to a curve gives it more weight in the objective function. | ||
+ | * $u_i^{FE}$ and $u_i^{REF}$ represent respectively the values of the Finite Element (FE) curve and of the REFerence curve at points $i$ (see <imgref fig1>). For a given curve, Optim computes the value $u_i$ by interpolation at points $i$ (represented by the $x_i$ in <imgref fig1>). These points correspond to the division of the abscissa range of the curves in NPOI points. | ||
+ | |||
+ | <imgcaption fig1|>{{ :optim:figure1.png?600 |}}</imgcaption> | ||
+ | |||
+ | One should be careful on the range on which the objective function is calculated. This range goes from $x_A$ to $x_F$ where: | ||
+ | * $x_A=max(x_{init}^{EF},x_{init}^{REF})$ | ||
+ | * $x_A=min(x_{end}^{EF},x_{end}^{REF})$ | ||
+ | |||
+ | The objective function is the square root of the sum of the squares of the residuals. The function must however be modified in the case where several curves of different orders of magnitude are used. The residual is then rewritten as: \\ \[res_i=\left(\frac{u_i^{FE}-u_i^{REF}}{u_i^{REF}}\right) \text{ if }|u_i^{REF}|>tolerance\] | ||
+ | \[res_i=\left({u_i^{FE}-u_i^{REF}}\right) \text{ if }|u_i^{REF}|<tolerance\] | ||
+ | |||
+ | In order to minimize the objective function, the program needs the derivatives of this function with respect to the parameters $P_j$: | ||
+ | \\ \[\frac{\partial S}{\partial P_j}=\frac{\partial S}{\partial u^{EF}}\frac{\partial u^{EF}}{\partial P_j}=\frac{1}{S(P)}{\displaystyle\sum_{i=1}^{n_{total}} res_i \frac{\partial u_i^{EF}}{\partial P_j}}\] \\ | ||
+ | Therefore, the only unknowns are the $\frac{\partial u_i^{EF}}{\partial P_j}$ that must be computed by finite difference in the Lagamine code. To compute these derivatives, Lagamine performs simulations with perturbed values of each parameter $P_j$ to be optimized (see <imgref fig2>). | ||
+ | |||
+ | <imgcaption fig2|>{{ :optim:dudp.png?400 |}}</imgcaption> | ||
+ | |||
+ | The derivatives can then be estimated as: \\ | ||
+ | \[\frac{\partial u_i^{EF}}{\partial P_j}=\frac{u_i^{EF}(P_j^+)-u_i^{EF}(P_j^-)}{P_j^+-P_j^-}\] | ||
+ | With: | ||
+ | \[ \begin{cases} | ||
+ | P_J^+=(1+PREC_{IA})P_J \\ | ||
+ | P_J^-=(1-PREC_{IA})P_J | ||
+ | \end{cases}\] | ||
+ | $PREC_{IA}$ is an input value chosen by the user (see [[optim:files#*.ia file|*.ia file]]); the recommended value is $PREC_{IA}=0.001$. | ||