NMinimize incorrectly says "The problem is unbounded"

I am solving some quadratic optimization problems in Mathematica 12.2 using NMinimize. Mathematica incorrectly gives the error NMinimize::ubnd, saying "The problem is unbounded.".

This should not be the case, however: I am minimizing a sum of squares over a simplex.

Does anyone know why Mathematica might be doing this?

Unfortunately the instances which exhibit this problem are quite large, but see an example here. (This should take ~30s to run.) Many similar problems work fine.

• As a workaround, I can add additional linear inequalities to the constraints that are implied by the ones I already have, after which NMinimize gives good answers. Oct 12 '21 at 0:57
• Maybe it's round-off error? I doubt anyone is going to be able to analyze the example (188 variables, 3MB expression) Oct 12 '21 at 0:59
• @MichaelE2, I've updated the gist with a problem with the constraints specified with exact numbers (the quantity to minimize still contains approximate real numbers, but is still a positive integer combination of squares). Oct 12 '21 at 1:20
• Why do you have the following 2 constraints: P >= 0 and P == 0. Then why consider P at all as a variable to be included in the minimization?
– JimB
Oct 12 '21 at 4:47
• @JimB, just for convenience in the larger problem. I presumed it would have negligible effect here. Oct 12 '21 at 9:10

Using

QuadraticOptimization[error, constraints, vars, Method -> "COIN",
Tolerance -> 0.000001]

I wonder if the issue is just that of lack of numerical precision and/or there are multiple solutions that give the same minimum. Consider the pieces of your code as error (the function being minimized), constraints, and vars.

Using NMinimize:

results = Table[10^i NMinimize[{error/10^i, constraints}, vars][], {i, 6, 10}]
[![Unbounded error message]]
(* {-∞, 5616.11, 5616.45, 5617.94, 5648.9} *)

(The "unbounded" error message is just for when the error is divided by 10^6).