Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Food trucks Emily has three food trucks. There are n possible positions at campus, where she is allowed to park the food trucks (she cannot
Food trucks Emily has three food trucks. There are n possible positions at campus, where she is allowed to park the food trucks (she cannot park more than one at each position). It varies from day to day how many customers will come to a food truck on at a given position. Emily has done a lot of research on her possible customers and she knows exactly how many customers she will get by placing a food truck on each of the possible positions on each day of the semester. The night before the first day of the semester she can place the 3 food trucks at 3 positions of her own choice. She can move the trucks at night, but due to local rules at the university campus she can move at most one truck each night. Your job is to write a program that can compute the maximal number of customers Emily can get during the next m days. Let cij be the number of customers at day i at position j. Example Let m= 3 and n=5. i, j 1 2 3 4 5 1 10 7 5 3 0 2 10 2 16 15 3 | 0 1 1 11 12 To find the optimal solution we have to chose three starting positions and which truck (if any) to move each night. Before the first day of the semester we park the trucks at position 1, 2 and 4 (gives 20 customers the first day). Between day 1 and 2 a truck is moved from position 2 to position 5. Thus on day two the trucks are at position 1, 4 and 5 (gives 32 customers). Between day 2 and 3 a truck is moved from position 1 to position 3. Thus on day three the trucks are at position 3, 4 and 5 (gives 24 customers). In total this gives 76 customers, which is optimal in this instance. Exercise 1. Give an algorithm that given inputs n, m, and Cij for all 1 sism, 1sj sn computes the maximal number of customers Emily can get. Food trucks Emily has three food trucks. There are n possible positions at campus, where she is allowed to park the food trucks (she cannot park more than one at each position). It varies from day to day how many customers will come to a food truck on at a given position. Emily has done a lot of research on her possible customers and she knows exactly how many customers she will get by placing a food truck on each of the possible positions on each day of the semester. The night before the first day of the semester she can place the 3 food trucks at 3 positions of her own choice. She can move the trucks at night, but due to local rules at the university campus she can move at most one truck each night. Your job is to write a program that can compute the maximal number of customers Emily can get during the next m days. Let cij be the number of customers at day i at position j. Example Let m= 3 and n=5. i, j 1 2 3 4 5 1 10 7 5 3 0 2 10 2 16 15 3 | 0 1 1 11 12 To find the optimal solution we have to chose three starting positions and which truck (if any) to move each night. Before the first day of the semester we park the trucks at position 1, 2 and 4 (gives 20 customers the first day). Between day 1 and 2 a truck is moved from position 2 to position 5. Thus on day two the trucks are at position 1, 4 and 5 (gives 32 customers). Between day 2 and 3 a truck is moved from position 1 to position 3. Thus on day three the trucks are at position 3, 4 and 5 (gives 24 customers). In total this gives 76 customers, which is optimal in this instance. Exercise 1. Give an algorithm that given inputs n, m, and Cij for all 1 sism, 1sj sn computes the maximal number of customers Emily can get
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