Is this possible, that some constraints have parameters that depend on the target function? Or do the constraints need to be statable in an unchanging way?
Wait, I need to add stuff that was in the original file, that I simplified... Hang on. It works now.
Almost, but not quite. The constraints need to be defined outside NMinimize, as they are a bit complicated. See new file. It works now! Thanks.
Do you mean something like this?:
NMinimize[{f, x^2 + y^2 + f^2 <= 4} /. f -> Cos[x] + Cos[y], {x, y}] (* {0.356557, {x -> 1.39121, y -> -1.39191}} *)