# $(max(0, f(x)))^2$ or $(max(0, exp(f(x))))^2$ for soft constraints with Gauss-Newton

I need some kind of inequality constraint in my optimization problems (rude version of SVM for example or skeleton based mesh fitting). However hard constraints is not suitable for me because sometimes small constraint violations are allowed.

I think about $(max(0, f(x)))^2$ as soft constraint function where $f(x)$ is constraint. I.e. i want to keep $f(x) \le 0$. $f(x)$ is linear function.

At first glance this function is ok because it provide some kind of barrier for constraint and it can be expressed as sum of squares as Gauss-Newton solvers need. But I'm not sure that Gauss-Newton can hold such kind of function. Because expression inside squares (max(0, f(x))) is not smooth.

I think about $(max(0, exp(f(x))))^2$ as "barrier". This function is smooth (because $max(0, exp(f(x)))$ is smooth).

So my question is:

Is ok to use $(max(0, exp(f(x))))^2$ or $(max(0, f(x)))^2$ within Gauss-Newton for smooth constaint? If not which kind of function i should use?

PS Sorry for my poor English and math skills.