## 4 Optimization
### Implementation to Optimize the ShF and ShM  
The optimization problem consists of minimizing \(\beta_{ShF}\) and \(\beta_{ShM}\) (see Equations (35) and (36)). \(\mathbf{X}\) is the vector that contains all the variables values that need to be calculated, this is,\([x_{c1},y_{c1},t_{c1},x_{c2},y_{c2},t_{c2},x_{c3},y_{c3},t_{c3}]\). As two functions need to be optimized, \(\beta_{ShF}\) and \(\beta_{ShM}\), it can be stated that this is a multi-objective problem. In this research, the objectives are in conflict, it means that, when optimizing the values of \(\mathbf{X}\) for minimizing \(\beta_{ShF}\), a worse value of \(\beta_{ShM}\) can be obtained and vice-versa. All the solutions \(\mathbf{X}\) can be represented in a two dimensional plane with the pair \((\beta_{ShF}(\mathbf{X}),\beta_{ShM}(\mathbf{X}))\), as it can be seen in Figure 4. We say a solution is dominated \(\mathbf{X^{d}}\) when its two objectives are worse than at least other solution, this is, \(\exists x:\beta_{ShF}(\mathbf{X^{d}})\geq\beta_{ShF}(\mathbf{X})\wedge\beta_ {ShF}(\mathbf{X^{d}})\geq\beta_{ShF}(\mathbf{X})\). And the non-dominated solutions \(\mathbf{X^{*}}\) are the ones that \(\beta_{ShF}(\mathbf{X^{*}})\leq\beta_{ShF}(\mathbf{X})\vee\beta_{ShM}(\mathbf{ X^{*}})\leq\beta_{ShM}(\mathbf{X})\forall x\). Figure 4b shows an example of non-dominated (dark blue) and dominated solutions (light blue). The Pareto Front [17] is conformed by the non-dominated solutions. According to the specific mechanical reaction that is more urgent to optimize, it is recommended to choose a specific solution from the Pareto Frontier. The technique weighted sum [31], that is widely known for solving multi-objective problems, was used for defining the objective function of the optimization problem (Equation (48)). \[f(\mathbf{X})=\gamma*\beta_{ShM}(\mathbf{X})+(1-\gamma)*\beta_{ShF}(\mathbf{X}) \tag{48}\]  
where \(\gamma\) is a scalar value that determines the importance given to each of the objectives of the optimization. The simplified version of Projected Gradient Descent algorithm is used for solving the optimization problem (Equation (48)). It is described in Algorithm 1. \(RandomBoxConstraints()\) calculates a vector of random variables with uniform distribution respecting the specified bounds. \(GradientFiniteDiff(f,\mathbf{X_{0}})\) and \(HessianFiniteDiff(f,\mathbf{X_{k}},\mathbf{P_{k}})\) calculate the approximation of the Gradient vector and the Hessian matrix based on the Equations (44), (46) and (47). \(\|.\|\) represents the vector norm. \(\epsilon\) is a small scalar (\(\epsilon=1e-5\)). To handle bound constraints, a simplified version of Projected Gradient Descent is used, so when a solution is found outside of the boundaries, it is projected to the valid region. The Boolean function \(isInvalid(\mathbf{X_{k+1}})\) returns true if the obtained vector contains values inside the boundaries otherwise, it returns false. The function \(clip(\mathbf{X_{k+1}})\) is used to clip the values of the vector if they are not valid. Clipping the values implies that if the value is smaller than the lower value allowed, then the value is converted to the minimal. In the same way, if the value is bigger than the maximum value allowed, then the value is converted to the maximum. The algorithm implements two stop conditions: (1) \(||\mathbf{X_{k+1}}-\mathbf{X_{k}}||<\epsilon\). It means that the difference between \(\mathbf{X_{k+1}}\) and \(\mathbf{X_{k}}\) is too small, so there is no change in the current solution, this also includes when the Gradient vector norm is close to 0. (2) \(k>NMaxIter\). It means that the maximum number of iterations has been reached (In this work \(NMaxIter=1000\)).