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
np.random.seed(21069925)
RandomFtoD1=np.round(np.random.uniform(low=1,high=10,size=12),0).astype(int)
RandomFtoD2=np.reshape(RandomFtoD1,(4,3))
CostFtoD=pd.DataFrame(RandomFtoD2,columns=["Atlas","Nebulae","Azure"],
index=["Tonoz","White Kiosk","Quarterage","Middle Yard"])
RandomDtoS1=np.round(np.random.uniform(low=1,high=10,size=15),0).astype(int)
RandomDtoS2=np.reshape(RandomDtoS1,(3,5))
CostDtoS=pd.DataFrame(RandomDtoS2,columns=["Venus","Minerva","Neptunus","Mars","Cere"],
index=["Atlas","Nebulae","Azure"])
RandomFtoS1=np.round(np.random.uniform(low=1,high=10,size=20),0).astype(int)
RandomFtoS2=np.reshape(RandomFtoS1,(4,5))
CostFtoS=pd.DataFrame(RandomFtoS2,columns=["Venus","Minerva","Neptunus","Mars","Ceres"],
index=["Tonoz","White Kiosk","Quarterage","Middle Yard"])
print("The shipment cost from factory to distribution center")
print(CostFtoD)
print("
The shipment cost from distribution center to store")
print(CostDtoS)
print("
The shipment cost from factory to store")
print(CostFtoS)
# The data
warehouses =["Tonoz", "White Kiosk", "Quarterage", "Middle Yard"]
distribution_centers =["Atlas", "Nebula", "Azure"]
stores =["Venus", "Minerva", "Neptunus", "Mars", "Ceres"]
warehouse_capacity =[3000,5000,10000,7000]
store_demand =[5500,4750,6550,4000,4200]
# The solver
solver = pywraplp.Solver.CreateSolver('CBC')
# Defining decision variables
x ={}
for i in warehouses:
for k in distribution_centers:
x[i, k]= solver.IntVar(0, solver.infinity(), f'x[{i},{k}]')
y ={}
for k in distribution_centers:
for j in stores:
y[k, j]= solver.IntVar(0, solver.infinity(), f'y[{k},{j}]')
z ={}
for i in warehouses:
for j in stores:
z[i, j]= solver.IntVar(0, solver.infinity(), f'z[{i},{j}]')
# Objective function
objective = solver.Objective()
for i in warehouses:
for k in distribution_centers:
objective.SetCoefficient(x[i, k], CostFtoDC.at[i, k])
for k in distribution_centers:
for j in stores:
objective.SetCoefficient(y[k, j], CostDCtoS.at[k, j])
for i in warehouses:
for j in stores:
objective.SetCoefficient(z[i, j], CostFtoS.at[i, j])
objective.SetMinimization()
# Constraints
# Warehouse capacity
for i, cap in zip(warehouses, warehouse_capacity):
constraint = solver.Constraint(0, cap)
for k in distribution_centers:
constraint.SetCoefficient(x[i, k],1)
for j in stores:
constraint.SetCoefficient(z[i, j],1)
# Flow balance at distribution centers
for k in distribution_centers:
solver.Add(sum(x[i, k] for i in warehouses)== sum(y[k, j] for j in stores))
# Demand satisfaction
for j, demand in zip(stores, store_demand):
constraint = solver.Constraint(demand, demand)
for k in distribution_centers:
constraint.SetCoefficient(y[k, j],1)
for i in warehouses:
constraint.SetCoefficient(z[i, j],1)
# Solution of the problem
status = solver.Solve()
# Results
if status == pywraplp.Solver.OPTIMAL:
print('Objective value =', solver.Objective().Value())
print('x[i,k] values:')
for i in warehouses:
for k in distribution_centers:
print(f'x[{i},{k}]={x[i, k].solution_value()}')
print('x[k,j] values:')
for k in distribution_centers:
for j in stores:
print(f'y[{k},{j}]={y[k, j].solution_value()}')
print('y[i,j] values:')
for i in warehouses:
for j in stores:
print(f'z[{i},{j}]={z[i, j].solution_value()}')
else:
print('The problem does not have an optimalsolution.')
Answer these questions according to the code sent above using CBC solver
b)(3p) What is value of the objective function?
c)(3p) What is the value of decision variables? According to this values, evaluate the supply
chain and flow in this supply chain?
d)(3p) If we change the capacity of warehouse Quarterage from 10000 to 7500, and the
demand of Ceres from 4200 to 1700, how do the objective value and the values of the
decision variables change?
e)(4p) If we change the shipment cost from warehouse Tonoz to distribution center Atlas as
10 and Azure to Minerva as 5, how the objective function is affected. Give new objective
value and number of shipments, and then explain your answer with few sentences.
f)(7p) If we change the capacity of the warehouse Middle Yard from 7000 to 5000, 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!