A PHP Error was encountered

Severity: Warning

Message: fopen(/home/solutionspile.com/public_html/system/sessions/ci_sessionnvjkeo7b71c45ac9rhut33dd5mn55np9): failed to open stream: No space left on device

Filename: drivers/Session_files_driver.php

Line Number: 176

Backtrace:

File: /home/solutionspile.com/public_html/index.php
Line: 367
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: session_start(): Failed to read session data: user (path: /home/solutionspile.com/public_html/system/sessions)

Filename: Session/Session.php

Line Number: 143

Backtrace:

File: /home/solutionspile.com/public_html/index.php
Line: 367
Function: require_once

[Solved]: python please Locating an artificial flower Ins
Home / Expert Answers / Computer Science / python-please-locating-an-artificial-flower-inspired-by-the-swarm-exhibition-your-company-has-in-pa640

(Solved): python please Locating an artificial flower Inspired by the Swarm exhibition, your company has in ...



python please

Locating an artificial flower
Inspired by the Swarm exhibition, your company has invented an artificial flower. It wants you

You need to write a function that returns the best location to place an artificial flower: locate_busyb (flowers, xmax, ymax)

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 list 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 1 ntegers, 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=\theta, y=\theta \), xmax \( >\theta \), \( y \max >\theta \) Returns the chosen location for the artificial flower, given as a tuple of two integers, corresponding to the \( x \) and \( y \) coordinates of the chosen location. Note that the chosen \( x, y \) coordinates must satisfy \( \theta \leq x \leq x_{\max }, \theta \leq y \leq \) ymax, and 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. Your function should work on grids of any size, including moderately large ones, such as when \( x \max =100, y \max =100 \). 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} \]


We have an Answer from Expert

View Expert Answer

Expert Answer


answer The
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe