# Maximize a simple expression based on EuclideanDistance takes too long

Do you know if there is a mistake in this command syntax? It is very simple and still it takes too long. I cannot obtain any result at all:

Maximize[{(EuclideanDistance[{a, d}, {b, e}]+EuclideanDistance[{b, e}, {c, f}]+EuclideanDistance[{c, f}, {a, d}]), 0<=a<=1,0<=d<=1,0<=b<=1,0<=e<=1,0<=c<=1,0<=f<=1}, {a,d,b,e,c,f}]
• This is not a simple optimization problem:a nonlinear and nondifferentiable target function in 6 variables. The result of NMaximize[{(EuclideanDistance[{a, d}, {b, e}] + EuclideanDistance[{b, e}, {c, f}] + EuclideanDistance[{c, f}, {a, d}]), 0 <= a <= 1, 0 <= d <= 1, 0 <= b <= 1, 0 <= e <= 1, 0 <= c <= 1, 0 <= f <= 1}, {a, d, b, e, c, f}, Method -> "DifferentialEvolution"] suggests an exact solution. Nov 17, 2020 at 19:05

RandomInstance[scene, RandomSeeding -> 4]

Maximizing the sum of the distances

{max, arg} =
NMaximize[{(EuclideanDistance[{a, d}, {b, e}] +
EuclideanDistance[{b, e}, {c, f}] + EuclideanDistance[{c, f}, {a, d}]),
0 <= a <= 1, 0 <= d <= 1, 0 <= b <= 1, 0 <= e <= 1, 0 <= c <= 1,
0 <= f <= 1}, {a, d, b, e, c, f}] /. x_Real :> RootApproximant[x]

(* {2 + Sqrt[2], {a -> 1, d -> 1, b -> 1, e -> 0, c -> 0, f -> 1}} *)

Equivalently, maximizing the perimeter of the triangle

{max2, arg2} =
NMaximize[{Perimeter[Triangle[{{a, d}, {b, e}, {c, f}}]], 0 <= a <= 1,
0 <= d <= 1, 0 <= b <= 1, 0 <= e <= 1, 0 <= c <= 1, 0 <= f <= 1}, {a, d,
b, e, c, f}] /. x_Real :> RootApproximant[x]

(* {2 + Sqrt[2], {a -> 1, d -> 1, b -> 1, e -> 0, c -> 0, f -> 1}} *)

As expected, the results are identical

{max, arg} === {max2, arg2}

(* True *)

Show[GeometricScene[{ad -> {a, d}, be -> {b, e}, cf -> {c, f}} /. arg,