Question
QUESTION Consider the following optimization problem that is coded in CBC . from pulp import* Factory = [A, B] Mall = [M1, M2, M3, M4]
QUESTION
Consider the following optimization problem that is coded in CBC.
from pulp import* Factory = ["A", "B"]
Mall = ["M1", "M2", "M3", "M4"]
Prod = {"A": 1000,"B": 2000}
Sales = {"M1": 1500,"M2": 600,"M3": 700,"M4": 200}
Cost = {"A": {"M1":2, "M2":4, "M3":5, "M4":2},
"B": {"M1":3, "M2":1, "M3":3, "M4":2}}
prob = LpProblem("Final Exam", LpMinimize)
X = LpVariable.dicts("x",(Factory, Mall), lowBound = 0, upBound = None, cat = const.LpInteger)
prob += lpSum(Cost[f][s]*X[a][b] for f in Factory for s in Mall)
for w in Factory:
prob += lpSum(X[f][s] for s in Mall) <= Prod[f]
for b in Mall:
prob += lpSum(X[f][s] for f in Factory) >= Sales[s]
We are trying to model the sales distribution channel of a supply chain. There are two factories (A, B) and four Malls (M1,M2,M3,M4). On the left you can see the Python code of the optimization problem for CBC library. Please solve the following questions.
a) Write the mathematical model of the second for loop that is written in bold.
b) Assume factory B cannot serve second and third mall, i.e. there is no flow from factory B to M2 and M3. Write the mathematical equation for this constraint
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started