Question: 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

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
Get step-by-step solutions from verified subject matter experts
