1
$\begingroup$

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.

$\endgroup$
5
  • $\begingroup$ 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. $\endgroup$ Oct 12 '21 at 0:57
  • 1
    $\begingroup$ Maybe it's round-off error? I doubt anyone is going to be able to analyze the example (188 variables, 3MB expression) $\endgroup$
    – Michael E2
    Oct 12 '21 at 0:59
  • $\begingroup$ @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). $\endgroup$ Oct 12 '21 at 1:20
  • $\begingroup$ 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? $\endgroup$
    – JimB
    Oct 12 '21 at 4:47
  • $\begingroup$ @JimB, just for convenience in the larger problem. I presumed it would have negligible effect here. $\endgroup$ Oct 12 '21 at 9:10
2
$\begingroup$

Using

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

(possibly tweaking the Tolerance) instead gives good answers.

$\endgroup$
2
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.