Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Solution Code Write a function called solution that takes a N M matrix as input. This matrix represents the building floor plan where .1's denoting

image text in transcribed

Solution Code Write a function called solution that takes a N M matrix as input. This matrix represents the building floor plan where .1's denoting target cells that requires wifi coverage .es denoting cells that are walls .-1 S denoting cells that are void (do not require wifi coverage) This function must implement the logic to decide where to place routers in order to maximize the wifi coverage and minimize cost for a given floor plan. There are 3 router types that can be used, each with a different coverage (S) and cost . Type 1: S 5:Cost 180 . Type 2: S-9:Cost 360 .Type 3: S15 Cost 480 This function must return 3 arrays: 1. An array containing the row indices of where to place the routers 2. An array containing the corresponding column indices of where to place the routers 3. An array containing the corresponding router types to be used at each row, column location All output arrays should contain integers only and should all be of the same length. The ouput array containing the router types should only contain the integer numbers 1, 2, or 3 representing the router type given above In [ ]: | # Feel free to add any additional functions either #-in this code ceLL (above the solution function), or import numpy as np def solution(floor): in additional code cells above this one ### Example solution : prows= [] #placement row indices pcols. [] # placement col indices ptypes [] #placement router types nrows, ncols = floor . shape for r in range(6, nrows, 11): for c in range (6, ncols, 11): prows.append (r) pcols.append (c) ptypes.append(1) # only use type 1 routers return prows, pcols, ptypes Solution Code Write a function called solution that takes a N M matrix as input. This matrix represents the building floor plan where .1's denoting target cells that requires wifi coverage .es denoting cells that are walls .-1 S denoting cells that are void (do not require wifi coverage) This function must implement the logic to decide where to place routers in order to maximize the wifi coverage and minimize cost for a given floor plan. There are 3 router types that can be used, each with a different coverage (S) and cost . Type 1: S 5:Cost 180 . Type 2: S-9:Cost 360 .Type 3: S15 Cost 480 This function must return 3 arrays: 1. An array containing the row indices of where to place the routers 2. An array containing the corresponding column indices of where to place the routers 3. An array containing the corresponding router types to be used at each row, column location All output arrays should contain integers only and should all be of the same length. The ouput array containing the router types should only contain the integer numbers 1, 2, or 3 representing the router type given above In [ ]: | # Feel free to add any additional functions either #-in this code ceLL (above the solution function), or import numpy as np def solution(floor): in additional code cells above this one ### Example solution : prows= [] #placement row indices pcols. [] # placement col indices ptypes [] #placement router types nrows, ncols = floor . shape for r in range(6, nrows, 11): for c in range (6, ncols, 11): prows.append (r) pcols.append (c) ptypes.append(1) # only use type 1 routers return prows, pcols, ptypes

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Manga Guide To Databases

Authors: Mana Takahashi, Shoko Azuma, Co Ltd Trend

1st Edition

1593271905, 978-1593271909

More Books

Students also viewed these Databases questions