Answered step by step
Verified Expert Solution
Question
1 Approved Answer
5. (30) Consider a chain of stores that ship products to customers that are residing in either houses or apart- ments. The distances between the
5. (30) Consider a chain of stores that ship products to customers that are residing in either houses or apart- ments. The distances between the stores and the residences are given in file q5.distance.txt. Shipping costs are dependent on the distance values and each given product have a different cost multiplier for shipping cost calculation. Let p, be the cost t multiplier for product k P, dj be the distance between store II (for a set of stores I) and residence jESH USA (for a set of houses Sy and apartments SA). Also, and a 3 represent and max costs for shipment for residence type r (H, A). Then, for product & P. the cost of shipment c, between store / E1 and residence j of type re (H. A) can be calculated as (d)-min (da)) -xx (+ (-)x max (4)-min (da) (do)) HELES (1) Following values in the problem data are fixed: il, bes -6. 10, -4-8 Your task is to create a dataframe for a given set of products (it can be any number of products) and their respective cost multipliers. This dataframe must follow a specific format. For instance, for the following input (which will be provided as a dictionary of values), c.g 1 p 1: 1.0, 2: 1.2) your program is expected to return the dataframe given in Figure 2 (values inside dataframe are not neces- sarily correct). Sample function call is provided below. apartment1 apartment2 apartment 3 prod house1 house2 house3 house4 store1 8.4 6.34 4.97 1 8.18 10.36 9.27 6.55 store2 8.4 4.29 6.00 1 10.91 7.64 10.36 6.00 store3 3.6 5.66 5.31 1 8.73 12.00 10.91 10.36 storel 7.0 5.29 4.14 2 6.82 8.64 7.73 5.45 store2 7.0 3.57 5.00 2 9.09 6.36 8.64 5.00 store3 3.0 4.71 4.43 2 7.27 10.00 9.09 8.64 Figure 2: Sample cost dataframe (order of columns is not important) 1 #Products multipliers 2 p={1:1.2.2:1} 3 4 required function name and sample function call with the expected return vals cost.df calculate.cost.dataframe ("q5.distance", p)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started