Skip to main content
1 of 3
Michael E2
  • 244.8k
  • 18
  • 351
  • 774

I suspect that the use of a region is calling a specialized optimizer and the option value is not being passed. It should probably be reported.

Here's another way:

dist[x_, y_] = RegionDistance[pg, {x, y}];
penalty[x_?NumericQ, y_?NumericQ] := Unitize[#] + # &@dist[x, y];
fm = FindMaximum[
  FF[x, y] - 
   penalty[x, y], {{x, y}, RegionCentroid@pg, pg[[1, 1]]}\[Transpose],
   MaxIterations -> 30]
(*  {0.200105, {x -> 0.789665, y -> -1.60565}}  *)

Show[
 Plot3D[{FF[x, y], FF[x, y] - penalty[x, y]}, {x, y} \[Element] pg],
 Graphics3D[{Red, Sphere[{x, y, FF[x, y]} /. Last@fm, 0.01]}],
 PlotRange -> All
 ]

enter image description here

Michael E2
  • 244.8k
  • 18
  • 351
  • 774