Easy FindMaximum returns a wrong answer

FindMaximum in region is a new function in mma10,but when I tried the following example:

region = Polygon[{{0, 0}, {10, 0}, {10, 5}, {5, 5}, {5, 10}, {0, 10}}]
FindMaximum[{x + y, {x, y} \[Element] region}, {x, y}]

Mathematica 10.1 returns

{10., {x -> 5., y -> 5.}}

We can easily know that it is wrong. What's the story?

• NMaximize[{x + y, {x, y} \[Element] region}, {x, y}] however does work? – dr.blochwave Apr 28 '15 at 11:34
• You can also use Maximize[{x + y, {x, y} \[Element] region}, {x, y}] for this case as well. – dr.blochwave Apr 28 '15 at 11:43
• @blochwave I have tried that,but I wonder why FindMaximum "goes wrong". – WateSoyan Apr 28 '15 at 11:50
• The point {5,5} is a local maxima in the region when approached along the line x==y – Bob Hanlon Apr 28 '15 at 21:48
• @BobHanlon why then, if you specify a starting point of e.g. {{x, 9.9}, {y, 4.9}}, does MMA still head off in the direction of {5,5}? – dr.blochwave Apr 29 '15 at 6:50

Defining just one of the points of the region with a decimal point helps, suggesting that the method chosen by FindMaximum for integer coordinates is a perhaps a linear programming method, and gets stuck at the observed {5, 5}.

Instead one can do:

region = Polygon[{{0., 0}, {10, 0}, {10, 5}, {5, 5}, {5, 10}, {0,
10}}];
result = Last@FindMaximum[{x + y, {x, y} \[Element] region}, {x, y}]
(* {x -> 10., y -> 5.} *)

Show[ContourPlot[x + y, {x, y} \[Element] region],
Graphics[{Red, PointSize[Large], Point[{x, y} /. result]}]] • It's obvious that we can't know how mma works unless we are members of Wolfram Research.It's a pity that mma returns a unexpectedly result.So how to get a good answer is just a technical task in some extents. – WateSoyan May 8 '15 at 7:31