Question: Adapt the code with the new information provided We have feedback from our drivers that we need to allow an extra 1 5 minutes between
Adapt the code with the new information provided We have feedback from our drivers that we need to allow an extra minutes between pairs of farms on a milk run. Additionally, we need to allow minutes cleaning time between milk runs made by the same tanker
Taking these times into account, which of the milk runs should we now use? Please provide us with the minimum total cost of collections.
The previuos code is:
from gurobipy import
from Milkruns import Milkruns
# Farms
farms Cowbell 'Creamy Acres', 'Milky Way', 'Happy Cows', 'Udder Delight', 'Fresh Pail', 'Cowabunga', 'Utopia', 'Moo Meadows', 'Bluebell', 'Harmony', 'Velvet Valley', 'Moonybrook', 'Cloven Hills', 'Midnight Moo', 'Willows Bend', 'Moosa Heads', 'Dreamy Dairies', 'Happy Hooves', 'Highlands'
F rangelenfarms
# Supply from each farm
Supply
# Processing facilities
facilities PPP
Prangelenfacilities
Tankers range
#Data Milkruns
#R facility tanker must leave from
#R list of farms visited
#R total time takenmins
#R total cost of milk run$
R rangelenMilkruns
# Processing facility capacities
PMin
PMax
# Create a new model
m ModelTeal Cow Dairy"
#VARIABLES
#binary variable if milkrun r is assigned to tanker k at facility j
X jkr: maddVarvtype GRBBINARY for r in R for j in P for k in Tankers
#binary variable if tanker k is part of the fleet at processing facility j
Z jk: maddVarvtypeGRBBINARY for k in Tankers for j in P
#OBJECTIVE: Minimise total cost of collections
msetObjectivequicksumMilkrunsr Xj k r for r in R for j in P for k in Tankers
quicksum k Zj k for k in Tankers for j in P GRBMINIMIZE
#Constraints
#each milkrun is assigned to one tanker at a processing facility
for r in R:
maddConstrquicksumXjkr for j in P for k in Tankers if j Milkrunsr
#each farm i is srvicied by exactly one milkrun
for i in F:
maddConstrquicksumXjkr for j in P for k in Tankers for r in R if i in Milkrunsr
for j in P:
#Processing capacity constraint
maddConstrquicksumSupplyiXjkr for r in R for k in Tankers for i in Milkrunsr PMinj
maddConstrquicksumSupplyiXjkr for r in R for k in Tankers for i in Milkrunsr PMaxj
for k in Tankers:
#each tanker can only be used for hours
maddConstrquicksumMilkrunsrXjkr for r in RZjk
#unlock tankers in order and check if total timeis within the limits
if k:
maddConstrZjk Zjk
maddConstrquicksumMilkrunsrXjkr for r in RZjk
#each milkrun r is assigned to at most one processing facility and a tanker
for r in R:
maddConstrquicksumXjkr for j in P for k in Tankers
moptimize
printMin total cost of collection: mObjVal
Consider this info :
When the questions states 'extra minutes between pairs of farms on a milk run', does this mean if there are farms, it will take minutes and if there are farms, it will take minutes to unload the milk
So a tanker doing three milk runs would require minutes of cleaning, while a tanker doing a single run would require no cleaning during the day it can be done at night, before the next day
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
