ISM-C1004 - Assignment - 3 .XLSB
ISM-C1004 - Assignment - 3 .XLSB
The Sales & Marketing department has just released its demand estimates for the following month and
unfortunately the total demand exceed the total production capacity. The mills have informed Sales &
operations of the extra capacity they could provide for the following month and also provided
estimates on the cost of making use of this extra capacity.
The Advanced Analytics team has formulated a MILP model that extends the transhipment model you
are familiar with to also optimize decisions on the use of the extra capacity. The model is as follows:
𝑀={0,1,2}: Mills
Indexes:
𝑊={0,…,3}: Warehouses
𝐶={0,…,12}: Customer areas
You can use any Python environment you want, for instance, https://jupyter.cs.aalto.fi/
a) Complete the source code ("transhipment.py" in MyCourses) and copy paste the lines of code you
added to the textbox on the right. For each line of Python code you also need to have comments
exlaining what it does in your own words. (3 pts)
b) Report the optimal total costs, i.e., optimal objective function value. (1 pt)
Answer here
You can use any Python environment you want, for instance, https://jupyter.cs.aalto.fi/
a) Complete the source code ("transhipment.py" in MyCourses) and copy paste the lines of code you
added to the textbox on the right. For each line of Python code you also need to have comments
exlaining what it does in your own words. (3 pts)
b) Report the optimal total costs, i.e., optimal objective function value. (1 pt)
Answer here
c) Report the mills in which it is optimal to utilize the extra capacity.(1 pt)
Answer here
d) Report the optimal transportation routes and volumes. Include only those routes in which some
non-zero amount is being transported) (1 pt)
Answer here
al 28 points)
ANSWER FOR a) [PASTE SOURCE CODE HERE]
from pulp import *
#Indices
Mills = list(range(3))
Warehouses = list(range(4))
Customer_areas = list(range(13))
#Parameters
Transp_cost_A = [[54, 96, 137, 161],
[61, 121, 133, 141],
[211, 191, 90, 72]] #Transportation costs from mills to warehouses
Transp_cost_B = [[100, 120, 150, 160, 300, 310, 340, 490, 430,360, 280, 350, 200],
[200, 240, 280, 310, 280, 400, 440, 410, 380, 190, 80, 150, 90],
[280, 260, 320, 400, 140, 319, 290, 240, 230, 80, 60, 60, 160],
[320, 280, 200, 130, 130, 70, 100, 90, 100, 190, 370, 320, 390]] #Transportation costs from
warehouses to customers
Ext_cost = [300000,400000,450000] #Extra capacity costs
Capacity_limit=[9900, 2100, 4200] #Production capacities
Capacity_ext = [1100,1400,1500] #Extra capacities
Demands = [650,260,650,130,780,2500,910,3120,910,3640,1040,1650,1780] #Customer area demands
#TODO: add objective function and constraints here after back from Alps!:
#constraint 1: capacity contraint with extra capacity
for i in Mills:
model += (
lpSum(x[i][k] for k in Warehouses) <= Capacity_limit[i] + z[i] * Capacity_ext[i],
f"Capacity_at_Mill_{i}",
)
#constraint 2: balancing nodes
for k in Warehouses:
model += (
lpSum(x[i][k] for i in Mills) == lpSum(y[k][j] for j in Customer_areas),
f"Flow_Balance_at_Warehouse_{k}",
)
#constraint 3: balancing demand
for j in Customer_areas:
model += (
lpSum(y[k][j] for k in Warehouses) == Demands[j],
f"Demand_at_Customer_{j}",
)
model.solve() #Solve the optimal solution to model
print("---------------")
for k in Warehouses:
for j in Customer_areas:
if (y[k][j].varValue>0):
print("Transport "+str(y[k][j].varValue)+" tons from Warehouse "+str(k)+" to Customer area
"+str(j)+".")
print("---")
tion costs from
l (minimization)
e decision variables
o Customer area
ISM-C1004 - Business Analytics 1 - Assignment 3 (Total 28 points)
Transportation problem with non-linear costs (6 pts)
P&T company produces canned peas. Peas are prepared at three canneries and shipped by truck to four warehouses.
The company has started a project that seeks to reduce transportation costs. The current monthly distribution of peas,
consumes production capacities of canneries (𝑠_𝑖), is presented in Table 1.
As a part of the project, the company has collected data on the transportation distances between the canneries and the
at historical data on shipping costs, and noticed that the single truck cost per kilometer on a particular route increases i
route. It is suspected that P&T is such a large player that its use of the trucking capacity affects prices. Specifically, P&T
fits the historical data well when coefficients 𝑎 and 𝑏 have the values presented in Table 3.
𝑖∈{1,…,3}, 𝑗∈{1,…,4}, for the decision variables representing the transportation volumes (in number of trucks). For
a) Mathematically formulate an NLP model to minimize transportation costs so that demands are satisfied and capacitie
and 𝑏, the following symbols: 𝑟_𝑖𝑗 for distances, 𝑠_𝑖 for cannery capacities and 𝑑_𝑗 for warehouse demands. (2p)
c) Solve the model using "GRG nonlinear"-algorithm with the current plan as a starting solution (i.e. as values in the var
optimal objective function value. (0.5 p)
d) Solve the model using "GRG-nonlinear"-algorithm with a starting solution of all zeros. Report optimal objective functi
the value in c) but can also be the same]
216226.6
Answer here
Table 1
Destination (Warehouse)
Current plan for distribution (trucks)
Sacramento Salt Lake City Rapid City Albuquerque
Bellingham 75 10
Source
(Cannery) Eugene 5 60 60
Albert Lea 15 85
Table 2
Destination (Warehouse)
Distance (km)
Sacramento Salt Lake City Rapid City Albuquerque
Bellingham 1339 1481 1887 2502
Source
(Cannery) Eugene 1016 1201 1991 2283
Albert Lea 2872 1968 1120 1977
Table 3
Regression model coefficients
a 0.003
b 0.3465
(Total 28 points)
ent monthly distribution of peas, which meets warehouse demands (𝑑_𝑗) and
es between the canneries and the warehouses (Table 2). They have also looked
er on a particular route increases if a lot of peas are transported along that
ty affects prices. Specifically, P&T has found that the regression model
ble 3.
emands are satisfied and capacities are not exceeded. Use the notation 𝑥_𝑖𝑗,
volumes (in number of trucks). For the fixed parameters use, in addition to 𝑎
𝑗 for warehouse demands. (2p)
tation model implementation with two 3x4 tables representing distances and
cost on each route. With the current distribution plan the transporation costs
g solution (i.e. as values in the variable cells when opening solver). Report the
os. Report optimal objective function value (0.5 p) [HINT: this might differ from
Grading
a) Is the formulation re
Formulation is reasona
exist.) (2 pts)
Formulation is reasona
Formulation is reasona
Completely unreasonab
b) Is the spreadsheet im
The variables are clearl
function and constraint
Small errors or not clea
There are major errors
No spreadsheet implem
bellingham
source eugene
albert sea
a
b
cost per km
total cost
constraint capacity
Grading
a) Is the formulation reasonable? (+0-2pts)
Formulation is reasonable and correct. (Note that multiple equivalent formulations
exist.) (2 pts)
Formulation is reasonable, but there are minor mistakes (1pts)
Formulation is reasonable, but there are major mistakes. (0.5pts)
Completely unreasonable or no mathematical formulation given. (0 pts)
c) Resonable value, does not have to be correct as non-linear solver is not that good
(+0.5pt)
d) Resonable value, does not have to be correct as non-linear solver is not that good
(+0.5pt)
There are major errors in the spreadsheet implementation. (1pt)
No spreadsheet implementation given. (0 pts)
c) Resonable value, does not have to be correct as non-linear solver is not that good
(+0.5pt)
=
d) Resonable value, does not have to be correct as non-linear solver is not that good
(+0.5pt)
destination
sacramento salt lake city rapid city albuquerque
37 0 0 48
43 60 22 0
0 0 53 47
1339 1481 1887 2502
1016 1201 1991 2283
2872 1968 1120 1977
0.003
0.3465
0.4569706645 0.3465 0.3465 0.491029335497
0.4760293355 0.5265 0.411971 0.3465
0.3465 0.3465 0.506029 0.486970664503
22531.733707 0 0 59187.43173647 233658.1
20882.106573 37939.59 17900.41 0
0 0 30137.9 45078.95617906
demand
1 1 1 1 85 <= 85
1 1 1 1 125 <= 125
1 1 1 1 100 <= 100
80 60 75 95
= = = =
80 60 75 95
ISM-C1004 - Business Analytics 1 - Assignment 3 (Total 28 points)
Non-linear location problem (4 pts)
Whale Oil Ltd. operates six offshore oilrigs. It is planning to build a service platform from
which maintenance helicopters could serve the rigs, and needs to decide what would be the
best location for the service platform to minimize annual flight costs. The locations of the
rigs are given in the Table 1 and illustrated on the attached map.
The cost of one kilometer helicopter flight is about 5 euros. It is estimated that there will be
250 flights annually to each rig, except for Heidrun (175 flights) and Midgard (600 flights).
Furthermore, the service platform has to be within 110 km range from one of the two land
bases to allow building fiber optic communications cables.
a) Mathematically formulate an NLP problem that identifies the cost minimizing location for
the service platform. Remember to include the return flight to the distance travelled per
flight. (2p) [HINT: You can use the notations in Table 1 to make your formulation more
compact]
c) Solve the NLP model with "GRG nonlinear"-algorithm, report the optimal objective
function value and draw the optimal solution to the map (0.5p)
Answer here
d) Solve the NLP model with "Evolutionary"-algorithm, report the optimal objective
function value and draw the optimal solution to the map (0.5p) [HINT: answer might differ
form that of c)]
Answer here
Table 1
Oil rigs
Land base 1 Land base 2 Norne Heidrun Midgard Smorbukk Draugen Ormen Lange
i 1 2 3 4 5 6 7 8
xi 280 200 234 243 224 189 220 128
350
Norne
300
250
Midgard
200
Smorbukk Heidrun
150
Draugen
100
Land base 2
0
120 140 160 180 200 220 240 260 280 300
Grading
in euros (𝑥_𝑖) and the resulting increase in new customers (𝐶_𝑖 (𝑥_𝑖 )) is
Based on this analysis they found that the relationship between marketing expenditure
GearSledge has hired you to build prescriptive analytics tools to support marketing allocation
decisions. GearSledge's new policy is that more should be spent on internet marketing
(Podcasts, Social media) than on traditional media (TV, radio). Moreover, to meet prior
contractual commitments at least 30 keuros must be spent on Radio.
a) Develop a single figure visualization that shows the new customers obtained as a function of
marketing expenditure for each media. Clearly label axes and graphs. An appropriate choice for
the range of the horizontal axis would be from zero euros to the annual budget. (1p)
contractual constraints are satisfied. (2p) [HINT: You can use the symbols 𝑎_𝑖,𝑏_𝑖, 𝑐_𝑖, 𝑥_𝑖 to
expenditures so that the number of new customers is maximized, while budget, policy and
c) Implement the NLP model using spreadsheets, solve it, and report the optimal allocation.
(2p) [HINT: Give a feasible starting solution for the solver]
Answer here
Table 1 i ai bi ci
TV 1 1500 20000 1
Podcasts 2 1300 10000 0.5
Radio 3 2000 70000 4
Social media 4 2000 60000 2
Total 28 points)
000 euros
ata on
omers.
penditure
1).
llocation
ng
or Spreadsheet implementation here (b)
unction of
choice for
ting
𝑐_𝑖, 𝑥_𝑖 to
cy and
ocation.
Grading
a) Is the visualization appropriate (0-1pts)
the
ISM-C1004 - Business Analytics 1 - Assignment 3 (Total 28 points)
Non-linear portfolio optimization problem (7 pts)
Wealthy industrialist H.E. Pennypacker is restructuring her investment portfolio and has decided to allocate capital acros
She has hired you for support the decision-making, and asks you to construct a Markowitz model to identify an allocatio
standard deviation of monthly returns), and a monthly expected return of at least 1%. Furthermore, at most 2% of the c
fund and at most 1% to Enrgy fund, since H.E. Pennypacker does not want to appear as a supporter of the Tobacco and O
5% of the capital should be invested in Health fund. The planning horizon is one month and the model should use data o
industry funds (Table 1).
a) Build the NLP model using spreadsheets and solve the optimal allocation. Shorting of the funds is not allowed, i.e., fun
(3p) [HINT: To check the correctness of your implementation, make sure that if you invest in only one fund, then the exp
model match those in the historical data].
b) To which funds should H.E. Pennypacker allocate capital and how much? What is the expected return and standard de
allocation? (1p)
Answer here
c) After seeing the results H.E. Pennypacker wants you to analyze the tradeoff between risk and expected returns more c
of different values for the expected return requirement and produce a graph showing standard deviation of returns as a
Range of five different values suffices, i.e., no use of macros is required. Make sure that this range includes the maximum
portfolios. (3p)
Table 1
mean 0.257407 0.739753 0.95321 1.187037 0.790617 1.004444 0.189012 0.931481
std 5.987369 10.52106 7.662813 14.60619 7.380956 7.737281 7.858871 4.560736
Grading
a) Is the implementation reasonable? (+0-3pts)
Implementation is reasonable and correct. (Not
Implementation is reasonable, but there are m
Implementation is reasonable, but there are m
Completely unreasonable or no mathematical fo
b) Everyting correct 1p
c) 3 points if the graph has been done. -1p if axe
min/max not included etc.