1
$\begingroup$

This page https://reference.wolfram.com/language/tutorial/ConstrainedOptimizationComparison.html

says "Even for local optimization, it may still be worth using NMinimize for small problems" and that the Minimize and Maximize commands "...are suitable only for problem with a small number of variables."

What does "small" mean here?

$\endgroup$

1 Answer 1

1
$\begingroup$

Let us consider a sequence of "toy" problems.

Table[First[Maximize[{-Sum[x[j]^2, {j, 1, n}], 
 Sum[x[j]*j, {j, 1, n}] == 1 && 
  (And @@ Table[x[j] >= 0, {j, 1, n}]) && 
x[1] + x[n] <= 1/n^2}, Table[x[j], {j, 1, n}]]] // Timing, {n, 10, 150, 20}]

{{0.078125, -(131/44375)}, {0.71875, -(382727/ 3464370000)}, {14.0156, -(1510731/63162500000)}, {33.1406, -( 3906799/447762490000)}, {63.8438, -(8049883/ 1959803505000)}, {111.672, -(72098867/ 32036996970000)}, {180.719, -(70489201/ 51688555360000)}, {276.109, -(83439379/93974681250000)}}

Draw a conclusion on your own.

$\endgroup$
5
  • $\begingroup$ BTW, NMaximize results is {{1.79688, -0.00295211}, {31.4688, -0.000110475}, {61.5625, -0.0000239182}, {105.313, -8.72515*10^-6}, {154.797, -4.10749*10^-6}, {216.438, -2.25049*10^-6}, {293.359, -1.36373*10^-6}, {394.734, -8.8789*10^-7}}. $\endgroup$
    – user64494
    Commented Jun 9 at 7:28
  • $\begingroup$ Mathematica v12.2 can't solve your toy problem n=10 in finite time. What's your version? $\endgroup$ Commented Jun 9 at 8:56
  • $\begingroup$ @UlrichNeumann: 14.0 on Windows 10. $\endgroup$
    – user64494
    Commented Jun 9 at 9:20
  • $\begingroup$ Does version 14.0 thread GreaterEqual over lists? A traditional way to enter the system would be Maximize[{-Sum[x[j]^2, {j, 1, n}], Sum[x[j]*j, {j, 1, n}] == 1 && (And @@ Table[x[j] >= 0, {j, 1, n}]) && x[1] + x[n] <= 1/n^2}, Table[x[j], {j, 1, n}]]. $\endgroup$ Commented Jun 9 at 16:47
  • $\begingroup$ @HenrikSchumacher: Thank you for your valuable comment. This construction does not work in 14.0, but does not affect the result. Fixed. $\endgroup$
    – user64494
    Commented Jun 10 at 3:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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