Question: import pandas as pd import numpy as np import math np . random.seed ( 2 1 0 6 9 9 2 5 ) RandomFtoD 1
import pandas as pd
import numpy as np
import math
nprandom.seed
RandomFtoDnproundnprandom.uniformlowhighsizeastypeint
RandomFtoDnpreshapeRandomFtoD
CostFtoDpdDataFrameRandomFtoDcolumnsAtlas"Nebulae","Azure"
indexTonoz"White Kiosk","Quarterage","Middle Yard"
RandomDtoSnproundnprandom.uniformlowhighsizeastypeint
RandomDtoSnpreshapeRandomDtoS
CostDtoSpdDataFrameRandomDtoScolumnsVenus"Minerva","Neptunus","Mars","Cere"
indexAtlas"Nebulae","Azure"
RandomFtoSnproundnprandom.uniformlowhighsizeastypeint
RandomFtoSnpreshapeRandomFtoS
CostFtoSpdDataFrameRandomFtoScolumnsVenus"Minerva","Neptunus","Mars","Ceres"
indexTonoz"White Kiosk","Quarterage","Middle Yard"
printThe shipment cost from factory to distribution center"
printCostFtoD
print
The shipment cost from distribution center to store"
printCostDtoS
print
The shipment cost from factory to store"
printCostFtoS
# The data
warehouses Tonoz "White Kiosk", "Quarterage", "Middle Yard"
distributioncenters Atlas "Nebula", "Azure"
stores Venus "Minerva", "Neptunus", "Mars", "Ceres"
warehousecapacity
storedemand
# The solver
solver pywraplp.Solver.CreateSolverCBC
# Defining decision variables
x
for i in warehouses:
for k in distributioncenters:
xi k solver.IntVar solver.infinity fxik
y
for k in distributioncenters:
for j in stores:
yk j solver.IntVar solver.infinity fykj
z
for i in warehouses:
for j in stores:
zi j solver.IntVar solver.infinity fzij
# Objective function
objective solver.Objective
for i in warehouses:
for k in distributioncenters:
objective.SetCoefficientxi k CostFtoDC.ati k
for k in distributioncenters:
for j in stores:
objective.SetCoefficientyk j CostDCtoS.atk j
for i in warehouses:
for j in stores:
objective.SetCoefficientzi j CostFtoS.ati j
objective.SetMinimization
# Constraints
# Warehouse capacity
for i cap in zipwarehouses warehousecapacity:
constraint solver.Constraint cap
for k in distributioncenters:
constraint.SetCoefficientxi k
for j in stores:
constraint.SetCoefficientzi j
# Flow balance at distribution centers
for k in distributioncenters:
solver.Addsumxi k for i in warehouses sumyk j for j in stores
# Demand satisfaction
for j demand in zipstores storedemand:
constraint solver.Constraintdemand demand
for k in distributioncenters:
constraint.SetCoefficientyk j
for i in warehouses:
constraint.SetCoefficientzi j
# Solution of the problem
status solver.Solve
# Results
if status pywraplp.Solver.OPTIMAL:
printObjective value solver.ObjectiveValue
printxik values:
for i in warehouses:
for k in distributioncenters:
printfxikxi ksolutionvalue
printxkj values:
for k in distributioncenters:
for j in stores:
printfykjyk jsolutionvalue
printyij values:
for i in warehouses:
for j in stores:
printfzijzi jsolutionvalue
else:
printThe problem does not have an optimalsolution
Answer these questions according to the code sent above using CBC solver
bp What is value of the objective function?
cp What is the value of decision variables? According to this values, evaluate the supply
chain and flow in this supply chain?
dp If we change the capacity of warehouse Quarterage from to and the
demand of Ceres from to how do the objective value and the values of the
decision variables change?
ep If we change the shipment cost from warehouse Tonoz to distribution center Atlas as
and Azure to Minerva as how the objective function is affected. Give new objective
value and number of shipments, and then explain your answer with few sentences.
fp If we change the capacity of the warehouse Middle Yard from to what
should we expect? Can we obtain optimal solution? Please explain your conclusion clearly.
If it is necessary make some arrangement and give the results with explanations.
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
