Lazy Lane Extra Credit STOR 415
Code Submission Instruction
• Upload your code (Q2 & Q6) by Sakai. You will see a “ExtraHW Code” Assign- ment on Sakai.
• Upload your written solution by Gradescope
• Create a folder with the name “ExtraHW’. In the folder you should include three
files: ’LL.mod’, ’LLtotal.mod’, ’LL.dat’.
• Make sure your file and folder NAMES are correct. Otherwise, we may fail to
run your code. The following are some examples for WRONG NAMES:
– “Extrahw”
– ”LL.mod.txt”
– ”LL.mod”
– From now on, if you don’t follow the right format, you will have an instant 50% credit off.
• Compress the folder into “ExtraHW.zip” or “ExtraHW.rar” and submit it to Sakai.
• All codes will be run by the grader.
Optimization is widely used in urban planning. For example, the futuristic city Telosa (to be built in the Arizona desert) is planned, so that each resident will have at most a 15 minute commute. This exercise is a toy version of a city planning optimization problem.
1. (40 points) Lazy Lane is a straight highway in Orange County, North Carolina. It extends for 10 km. There are n people who live on Lazy Lane at locations p1,p2,…,pn, where pj is the distance in km from the beginning of Lazy Lane to the jth person’s house. There is one giant alarm clock on Lazy Lane that wakes up all of its residents at exactly the same time (once a day), at which time they immediately start walking to the bus stop to go to work. Person j walks to the bus stop at speed rj km/hour, and needs to arrive to the bus stop by time tj (j = 1,…,n).
CS Help, Email: tutorcs@163.com
The Lazy Lane Bus Company (LLBC) is placing a single bus stop on Lazy Lane.
LLBC would like to know where to place the bus stop and when to sound the alarm clock, so as to allow the residents of Lazy Lane to sleep as late as possible.
LLBC has appointed you as Lord/Lady of Lazy Lane (LLL) and they ask you to formulate this problem as a linear program.
2. (20 points)
Solve the Lazy Lane problem with AMPL. The data is given in the LL.dat file.
First write a code which only has a mod file. Then write a code which has a mod file and a dat file. Only turn in the version which has the mod file and the dat file.
When will the alarm clock go off? Where willl be the bus stop? Suppose everyone goes to bed at 11 PM.
What is the maximum amount of sleep that a person gets? What is the total amount of sleep they get?
3. (10 points) Suppose you are person 1, and you absolutely do not want to walk for more than 30 minutes to the bus stop. What nonlinear constraint should you add to the LP? Can you formulate this new constraint with linear constraints?
4. (10 points) For this part, ignore the previous part. Suppose again you are person 1, and you want to force yourself to walk at least 30 minutes to the bus stop, to get sufficient exercise. What nonlinear constraint should you add to the LP? Can you formulate this new constraint with linear constraints?
5. (30 points) For this part, consider only the basic setup with the walking speeds, and location of the residents, and ignore the subsequent parts. Suppose that everybody buys a separate alarm clock, and as soon as they wake up, they start walking to the bus stop. Also suppose that everyone goes to sleep at the same time.
Formulate an LP to locate the bus stop so the total amount of sleep the residents get, is maximized.
6. (20 points) Solve this version with AMPL. There should be a separate mod and dat file.
Where willl be the bus stop?
Suppose everyone goes to bed at 11 PM.
What is the maximum amount of sleep that a person gets? What is the total amount of sleep?
Programming Help, Add QQ: 749389476