UC Berkeley Optimization
UC Berkeley Optimization
Homework 2
Due Date: 09/26/2021 (Sunday) at 11:59pm
Homework requirement
• Submit your homework (typed, scanned or photographed) and the corresponding AMPL
files in a single .pdf
• Make sure your homework is legible, and the AMPL files are well organized
• For problems that require a mathematical formulation, please clearly state the defini-
tion of decision variables and the indexes of them. Write a sentence to explain each
constraint and objective function. Also include an explanation of the optimal solution
when you are required to solve the problem in AMPL.
• For problems that require using AMPL please include (1) the model file, (2) the data
file (if you used one), (3) the optimal objective and variable values. You can save your
values in AMPL by typing the command “display objname, obj, varname, var
> filename.txt;” into the console, where “filename” is unique for each problem.
Combine these files into a single pdf, either by saving them as a pdf or using a screen-
shot.
1
Formulate a production plan for NSC that will minimize the total cost over the next
four months. Linearize the absolute value terms in the objective function and solve
using AMPL.
2. (Linear regression) Is there a relationship between IEOR 240 final exam scores and
the number of hours spent studying per week? A study was conducted involving 8
students and the data is shown below.
Hours spent studying per week IEOR 240 final score
4 75
9 82
10 92
14 100
4 68
7 88
12 95
3 77
Find a linear regression model by using the minimum absolute error method. Refor-
mulate it as a linear programming and solve it using AMPL. Give a prediction of the
IEOR 240 final score on a student who studied 2 hours a week.
3. (Solving LP graphically) Solve the following problems graphically. Comment on
whether the problem is infeasible, unbounded, has unique optimal solution, or has
infinitely many optimal solutions.
(a) max 3x + y
s.t. 2x + y ≤ 6
x+y ≤4
x ≥ 0, y ≥ 0
(b) max x+y
s.t. 2x + y ≤ 6
x+y ≤4
x ≥ 0, y ≥ 0
(c) max x+y
s.t. −x + y ≥ 1
x−y ≥1
x ≥ 0, y ≥ 0
(d) max x+y
s.t. −x + y ≤ 1
x−y ≤1
x ≥ 0, y ≥ 0
(e) min x+y
s.t. −x + y ≤ 1
x−y ≤1
x ≥ 0, y ≥ 0