Absolute Value¶
The absolute value is one of the most useful functions that have a discontinuity in the first derivative and are therefore not available in optimisation programs based on derivatives. There are three types of approximations of the absolute value in XOptima.
Absolute value regularised with erf¶
The erf
function is very versatile to approximate
those kind of functions. The regularised absolute value
is controlled by the parameter \(h\) so that for
\(x=0\) the function takes the value \(h\).
The expression of the function is:
where \(\kappa:= \dfrac{2}{h\sqrt{\pi}}\) is a constant once \(h\) is fixed. The first and second derivative of this function are:
Absolute value regularised with SinAtan¶
It is possible to approximate the absolute value with the function sinus of the arctangent:
The shape parameter of this function is \(h\) and is chosen such that for \(x=0\) the function \(|x|_{\mathrm{sa}}\) assumes the value \(h\). The first and second derivatives are:
Absolute value regularised with polynomials¶
A third way to approximate the absolute value function is with a smooth connection of two straight lines with a polynomial.