Assignment 2
Assignment 2
Assignment 2
Exercises 2
(1) In-Class: Johnson Electric has three different plants, each of which produces electric motors
for four different clients. The unit production costs and capacities for each plant are as follows.
Aberdeen 17 800
Birmingham 20 600
Cardiff 24 700
For the next months, the clients have submitted the following orders:
Customer
Customer
Aberdeen 3 2 5 7
Birmingham 6 4 8 3
Cardiff 9 1 5 4
Johnson Electric must decide how many motors to produce in each plant, as well as how much
of each customer’s demand to supply from each plant, so as to minimise the overall costs (that
is, the sum of production and transportation costs).
(a) Construct a linear program that determines the production and distribution plans that
minimise the overall costs.
Hint: Introduce one decision variable for each plant-customer pair, such as AO for
Aberdeen-Onyx or CT for Cardiff-Treble. The decision variable AO should determine
how many motors Johnson Electric produces in Aberdeen that are to be shipped to
Onyx Inc. You will then require constraints for the capacity of each plant as well as for
the demand of each customer.
(b) Solve the linear program using AMPL. What managerial actions would you recommend
based on the optimal solution and the shadow price information?
(2) In-Class: Dualising linear programs.
(a) Using the “indirect method”, find the dual to the linear program:
minimise 3 x1 + 5 x2 - x3
subject to x1 + x3 = 4
x2 - 2 x3 ≤ 2
x1, x2 ≥ 0, x3 unrestricted
(b) Using the “direct method”, find the dual to the linear program:
maximise x1 - x3
subject to x1 + x2 = 4
x3 ≤ 2
x1, x2 ≤ 0, x3 unrestricted
(3) Homework: In class we have defi ned that the dual of the linear program
maximise cTx
subject to Ax ≤ b
x ≥ 0
is
minimise bTy
subject to ATy ≥ c
y ≥ 0
Show that this definition is symmetric, that is, the dual of the linear program
minimise bTy
subject to ATy ≥ c
y ≥ 0
is
maximise cTx
subject to Ax ≤ b
x ≥ 0
Hint: Bring the dual problem into the form of the primal problem (that is, change the
objective into a maximisation and change the constraints), use the above definition to
determine the dual of the resulting problem, and finally show that this dual is actually
equivalent to the primal problem.
(4) Homework: The Graduate Admissions dataset from Kaggle (https://www.kaggle.com/
mohansacharya/graduate-admissions) has the independent variables
GRE: GRE Scores (out of 340)
as well as the dependent variable
Chance: Chance of Admission (ranging from 0 to 1)
(a) Formulate the 1-norm regression problem for this data set (with Chance as the dependent
variable and GRE, TOEFL, …, Res as independent variables) as a linear program. You can
“index” the data by writing “GRE”, “TOEFLi” etc. in your model.
(Please also include an intercept in your regression problem!)
(b) Construct an AMPL file that solves the 1-norm regression problem. To this end, you can use the
Graduate_Admissions.dat file in the exercises folder (which only involves the first 100 records,
to comply with the size limitations of the AMPL demo version) and import the data as follows:
data Graduate_Admissions.dat;
In your model, you can access the i-th element of GRE via GRE[i]. Also, you can create
variable vectors that are indexed by NUM (the candidate number) via
var x {NUM};
Similarly, the i-th component of x can be access via x[i]. You can sum over all elements of x via
sum {i in NUM} x[i]
Finally, you can create a set of constraints, one for each candidate NUM, via
You may want to consult the AMPL book (available online for free) for further information on
sets and indexing.
Solve the problem. Make sure you use CPLEX as a solver (“option solver ‘cplex’;”), as other
solvers have stricter size limitations in the demo version. What is your optimal objective value,
and what are the regression coefficients?
(c) Formulate the infinity-norm regression problem for this data set (again with Chance as the
dependent variable and GRE, TOEFL, …, Res as independent variables — plus an intercept)
as a linear program. You can “index” your data as in part (a). Justify why your model gives the
correct solution (similar to our argumentation for the 1-norm problem in the lecture)!
(d) Construct an AMPL file that solves the infinity-norm regression problem.
Solve the problem. Make sure you use CPLEX as a solver (“option solver ‘cplex’;”).
What is your optimal objective value, and what are the regression coefficients?