This means we want something below:

Image by the author

To generalize the above equation to all regions, we can use matrix multiplication:

Image by the author

Target

Reduce the number of areas used to build restaurants.

Image by the author

Solve

Now we have the limitations and the goal, solve the problem!

'optimal'

Spectacular! Since the state of the problem is optimal, optimal solutions are found. To view solutions, type:

array([0., 1., 1., 0., 0.])

This result shows that Areas 2 and 3 are two ideal locations for building restaurants.

Why are areas 2 and 3 chosen? From the image below, we can see that by building restaurants in areas 2 and 3, each area is 25 miles from at least one restaurant!

LEAVE A REPLY

Please enter your comment!
Please enter your name here