Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The objective function works fine in python file, i just wanted to know why the constraints (hashtaged) are not working against the model and whether

The objective function works fine in python file, i just wanted to know why the constraints (hashtaged) are not working against the model and whether this can be amended?

image text in transcribed

image text in transcribed

PRODUCT = [i for i in range (3)] SUPPLIER = [j for j in range(5)] PERIOD = [t for t in range(6)] OBJECTIVE = [k for k in range(3)] LINK1 = [(i,j) for i in PRODUCT for j in SUPPLIER] LINK2 = [(i,t) for i in PRODUCT for t in PERIOD] LINK3 = [(j,t) for j in SUPPLIER for t in PERIOD] LINK4 = [(i,j,t) for i in PRODUCT for j in SUPPLIER for t in PERIOD] PurchaseCost = np.array([[66,73,62,60,71], [121, 134,127,142,122], [28,26,29,25,23]]) OrderingCost = np.array([45000, 64500, 37250, 53400, 42250]) Holding Cost = np.array([12,35,7]) Transport Cost = np.array([33500,55200,33500,38400,55200]) SupplyCapacity = np.array([[550,480,420,890,790], [570,85,450,235,525], [825,430,850,390,720]]) Demand = np.array([DemandP1M1, DemandP2M1, DemandP3M1]) #Demand = np.array([[DemandPIMI, DemandP1M2, DemandP1M3, DemandP1M4, DemandP1M5, DemandP1M6], #[DemandP2M1, DemandP2M2, DemandP2M3, DemandP2M4, DemandP2M5, DemandP2M6), #[DemandP3M1, DemandP3M2, DemandP3M3, DemandP3M4, DemandP3M5, DemandP3M6]]) OccupiedSpace=np.array([0.75,0.85,0.60]) ReductionRate=np.array([0.08,0.1,0.09,0.12,0.09]) Vehiclecapacity=np.array([85,150,85,100,150]) Servicelevel=np.array([[0.95, 0.97, 0.94, 0.99, 0.98], [0.92, 0.99, 0.91, 0.99, 0.92], [0.99, 0.09, 0.99, 0.97, 0.99]]]|| W = 150 #### single period x = mdl.addvars(LINK1, vtype=GRB.CONTINUOUS) y = mdl.addVars (SUPPLIER, vtype=GRB.BINARY) z = mdl.addVars(PRODUCT, vtype=GRB.CONTINUOUS) mdl.modelSense = GRB.MINIMIZE mdl.setObjective(quicksum(PurchaseCost[i,j]*x[i,j] for i in PRODUCT for j in SUPPLIER ) + quicksum (OrderingCost[j]*y[j] for j in SUPPLIER) + quicksum(HoldingCost[i]*(quicksum(x[i,j] for j in SUPPLIER)-Demand[i]) for i in PRODUCT) + quicksum (TransportCost[j]* (quicksum (Occupied Space[i]*x[i,j] for i in PRODUCT)/Vehiclecapacity[j]) for j in SUPPLIER)) #mdl.addConstrs((quicksum(x[i,j,t] for j in SUPPLIER) + z[i,t-1] -Demand[ i,t] >= quicksum((1-ServiceLevel[i,j]) *x[i,j,t] for j in SUPPLIER )) for i in PRODUCT for t in PERIOD); #mdl.addConstrs((Demand[i,t]*y[j,t] - x[i,j,t]) >= for i in PRODUCT for j in SUPPLIER for t in PERIOD); #mdl.addConstrs(quicksum(x[i,j]*Servicelevel[i,j] for j in SUPPLIER) + z[i,t-1]-Demand[i,t]) >= @ for i in PRODUCT for t in PERIOD); #mdl.addConstrs((quicksum (OccupiedSpace[i] for i in PRODUCT))*(quicksum(x[i,j,t]*Service Level[i,j] for j in SUPPLIER)) + 2[i, t-1] - Demand[i,t])

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

Students also viewed these Databases questions