Interface of Mechatronix¶
Regularised functions¶
There are functions in mathematics which look innocent from an analytic viewpoint but that give birth to a number of computational issues once implemented numerically. Some of them are famous, like the sign function or the absolute value, some other are less known and do not contain apparent traps.
Penalty/Barrier functions¶
There are many types of penalties and barrier functions in XOptima, they are described here in detail. For a general purpose penalty that works most of the times, use the cosine-logarithmic penalty (see Figure The plot of the cosine logarithmic barrier with the parameters discussed in the example. and Section U_COS_LOGARITHMIC).
To have an idea of what this penalty does, consider for simplicity the interval \(I=(a,b)\). Penalty and barrier are functions that smoothly approximates the characteristic function \(\chi_I(x)\) that is identically zero inside \(I\) and infinity outside \(I\). The problem is that the discontinuity cannot be treated numerically in the convergence process. Hence it is convenient to find a smooth function that approximates the discontinuity. The difference between a barrier and a penalty is that a barrier function is a smooth function which takes the value infinity outside the interval \(I\), while a penalty function is defined in the whole space and is fastly growing outside the interval \(I\).