Locating an artificial flower Inspired by the Swarm exhibition, your company has invented an artificial flower. It wants you to figure out the best location to place the artificial flower, given the location of the existing flowers. The chosen location of the artificial flower should maximise the distance between it and all of the existing flowers. Artificial flower: If we place the artificial flower at \( (\theta, 3) \), the sum of the distances to the existing flowers would be \( 2+5+5=12 \) (again, we use Manhattan distance). Alternatively, if we place the artificial flower at \( (4,1) \), the sum of the distances to existing flowers would be \( 4+3+3=10 \), which is not such a good choice of location if we want to maximise the distances.
You need to write a function that returns the best location to place an artificial flower: Locate_busyb(flowers, xmax, ymax) flowers: a L1st of the coordinates of one or more real flowers, in arbitrary order, where the coordinates of each flower are given as a tuple of two 1ntegers, corresponding to the \( x \) and \( y \) coordinates. xmax, ymax: the \( x \) and \( y \) coordinates of the top-right corner of the region where artificial flower can be placed. Note that the bottom-left corner of the region is always \( x=0, y=\theta \), xmax \( >\theta \), ymax \( >\theta \). Returns the chosen location for the artificial flower, given as a tuple of two 1 ntegers, corresponding to the \( x \) and \( y \) coordinates of the chosen location. Note that the chosen \( x, y \)
location \( x \), y must not already contain a flower: Assumptions: The chosen location should be an empty cell (not occupied by a flower) within the defined region, such that it maximises the sum of the Manhattan distances from each flower to the chosen location. If there are two or more locations that equally maximise the sum of distances to the flowers, then pick the one that minimises the expression \( x+(y+x \max ) \) You can assume there are no duplicate locations in flowers. Example calls: \[ \begin{array}{l} \gg>\text { locate_busyb }[[(0,1),(2,0),(5,3)], 5,3) \\ (5,0) \\ \gg>\text { locate_busyb }[[(0,4),(4,4),(4,0),(0,0)], \\ (1,0) \\ \gg>\text { locate_busyb( }[(0,0),(0,2)], 4,3) \\ (4,3) \end{array} \]
Explanation: Note: In the second example, all cells have the same sum of distances, but \( (1, \theta) \) minimises \( x+(y * \) xmax \( ) \)