I need to find the minimum of a function. However, the condition is that the final state should be normalized i.e. sum of the squares must be one. One way to deal with it is just add the constraint into the Mathematica function NMinimize and solve it. In that case the function is a quartic polynomial. However I can also divide all the parameters to the sum of their squares and then the problem will be without a constraint but this means that the problem will not be a nice, simple quartic polynomial. I am using "DifferentialEvolution" and "RandomSearch" methods and I am wondering based on how they work should I solve the problem with constraint or embed it into the function? This is my question. I have tried and haven't seen any difference but on the other hand my code takes ages to evaluate so I wanted to ask if anyone has any experience upon.
I don't get why you use a quartic polynomial as constraint. The sum of squares minus
1 is quadratic. Squaring that once more is a very bad move as that will lead to a constraint mapping that does not satisfy any of the standard constraint qualifications: its differential vanishes whenever the constraint is satisfied (which also means that
NMinimize might run into problems.)
The second method has the problem that you might end up dividing by zero. Actually, your objective function will have a nasty singularity at
0. Moreover, you will have 1-parameter family of minimizers and your Hessian of the energy will have a nontrivial nullspace (wherever the objective function is twice differentiable). Newton-like optimization methods might have problems with that. Though BFGS, Mathematica's standard method for local unconstrained optimization, might be sufficiently robust and still quick enough for that.
All in all, I would suggest to use the constrained optimization approach with the quadratic constraint.