Task: Find, rounded appropiately to the precision of your system's real numbers representation, the lenght of the shortest closed polyline in Cartesian coordinate system of the given vertices and of the number of edges equal to the number of vertices — by exhaustive search.

Let A⊂ℝ×ℝ be the set of all given vertices.

Let f(x, a, Y)∈ℝ, for a, x ∈ (A∖Y) and Y ⊆ A, be — if Y≠∅ — sum of d(x, b) and f(b, a, Y∖{b}), with a b∈Y for which f(b, a, Y∖{b}) was the smallest, or — if Y=∅d(x, a).

where d(a, b) = (ax - bx)2 + (ay - by)2 for any a, b ∈ A

The result is f(x, a, (A∖{a})) for any selected a∈A.