NMinimize/NMaximize is unable to generate initial points

Mathematica 10 generates a warning that it is unable to generate initial points for numerical optimization problems. I picked a particularly simple example. The problem goes away when Abs is dropped.

NMinimize[{x + y, x >= 0 && Abs[x + 10 y + 100] <= 1}, {x, y}]


NMinimize::incst: "NMinimize was unable to generate any initial points satisfying the inequality constraints {-1+Abs[100+x+10\ y]<=0}. The initial region specified may not contain any feasible points. Changing the initial region or specifying explicit initial points may provide a better solution."

Despite the warning, Mathematica computes the correct solution. How can I get rid of the warning?

• You can use Off. Commented Nov 13, 2014 at 16:21
• True but I prefer to understand why Mathematica generates the warning and what it needs not to generate it. Commented Nov 13, 2014 at 16:29
• One way that works is to replace Abs[expr]<=val with expr<=val&&-expr<=val. I do not know whether this will work in general but I expect it to be useful when expr is linear (NMinimize uses some linear programming to get initial points). Commented Nov 13, 2014 at 17:23

You can get a glimpse into the workings of NMinimize by turning on the debug-printing:

Block[{OptimizationNMinimizeDumpdbPrint = Print},
NMinimize[{x + y, x >= 0 && Abs[x + 10 y + 100] <= 1}, {x, y}]
]


It seems at a cursory glance that it decided to search for points in the rectangle:

{{x,0.,2.},{y,-1,1}}


In this region it found zero of the three points it needs for the default Nelder-Mead method.

However, sometimes simplifying the constraints helps:

NMinimize[{x + y,
Reduce[x >= 0 && Abs[x + 10 y + 100] <= 1, {x, y}, Reals]}, {x, y}]

(*  {-10.1, {x -> 0., y -> -10.1}}  *)


No messages.

Documentation states: "This error can typically be avoided by providing starting values for the variable".

Lets try to find these values:

 FindInstance[{x >= 0, Abs[100 + x + 10 y] <= 2}, {x, y}, Reals]


{{x -> 0, y -> -(49/5)}}

FindInstance[{x >= 1, Abs[100 + x + 10 y] <= 1}, {x, y}, Reals]


{{x -> 1, y -> -10}}

Lets try:

 NMinimize[{x + y,
x >= 0 && Abs[x + 10 y + 100] <= 1}, {{x, 0, 1}, {y, -10, -49/5}}]


{-10.1, {x -> 0., y -> -10.1}}

And no error report.

• In the answer, you use two points satisfying the constraints rather than one. Is it necessary to do so? In case it isn't, would the proper syntax be {{x,0},{y,-10}}? I couldn't find this info in the online documentation for NMinimize. Commented Mar 13, 2019 at 11:48
• @Patricio Mathematica has a lot of undocumented features and commands. Your simply should try. Note, however, that by specifying one and two point condition your automatically use different Minimization methods.
– Acus
Commented Mar 13, 2019 at 11:56
• I was trying as you answered. I get the message Maximize::ivar: {x,0.23} is not a valid variable. Any suggestions? Commented Mar 13, 2019 at 11:59
• Ok. I see. I typed Maximizeinstead of NMaximize. When I use NMaximize it asks for a lower and and upper bound. Thanks. Commented Mar 13, 2019 at 12:02