# 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] >= 0 and P[0] == 0. Then why consider P[0] 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]


(possibly tweaking the Tolerance) instead gives good answers.

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][[1]], {i, 6, 10}]
[![Unbounded error message][1]][1]
(* {-∞, 5616.11, 5616.45, 5617.94, 5648.9} *)


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

Using QuadraticOptimization:

qo = Table[error /. QuadraticOptimization[error/10^i, constraints, vars, Method -> "COIN",
Tolerance -> 0.000001], {i, 6, 10}]
(* {5616.45, 5617.94, 5648.9, 5702.51, 5978.63} *)


The resulting values for the parameters can vary a great deal which is why I say there might be multiple solutions meaning there might be some linear combinations of some of the parameters that give the same minimum.