ProblemSet 1 -- Optimization
1. An optimization question in widget manufacturing
A manufacturing firm makes a profit of $
1200 per unit on the sale of
a product known as a widget. The firm hopes to increase widget sales
by offering a rebate; after some number-crunching, it is estimated
that for every $
100 of rebate, the number of widgets sold in a given
month will increase by 15%.
What amount of rebate will maximize the manufacturers profit for the month? Model the question as a single-variable optimization problem.
Compute the sensitivity of your answer to the 15% assumption. Consider both the amount of rebate and the resulting profit.
Suppose that rebates actually generate only a 10% increase in sales per
$
100. What is the effect? What if the response is somewhere between 10% and 15% per$
100 of rebate?Under what circumstances would an offer of a rebate cause a reduction in profit?
2. Computing yields with multi-variate optimization
A chemist is synthesizing a compound. In the last step, she must dissolve her reagents in a
solution with a particular pH
level \(H\), for \(1.2 ≤ H ≤ 2.7\), and heated to a temperature \(T\) (in
degrees Celsius), for \(66 ≤ T ≤ 98\). Her goal is to maximize her percent yield as a percentage
of the initial mass of the reagents.
The equation determining the percentage \(F (H,T)\) is
\[F(H,T) = −0.038\cdot T^2 − 0.223 \cdot T\cdot H − 10.982 \cdot H^2 + 7.112 \cdot T + 60.912 \cdot H − 328.898.\]
Find the optimal temperature and
pH
level in the allowed range.Use
matplotlib
to produce a graph and a contour plot of the percentage of the powder function \(F (H, T )\).
(You should consult this week’s jupyter notebooks
to see some
examples. To get a usable copy of your image, you can proceed in a few
ways:
if you produce the graph in colab you can right-click on the image and
Save As
a file on your file system.if you work in Python on your computer, you can save the image via a command like
> g.savefig(”myGraphImage.png”)
3. Blood typing
Human blood is generally classified in the “ABO” system, with four
blood types: A
, B
, O
, and AB
. These four types reflect six
gene pairs, with blood type A
corresponding to gene pairs AA
and
AO
, blood type B
corresponding to gene pairs BB
and BO
, blood
type O
corresponding to gene pair OO
, and blood type AB
corresponding to gene pair AB
. Let \(p\) be the proportion of gene A
in the population, let \(q\) be the proportion of gene B
in the
population, and let \(r\) be the proportion of gene O
in the
population. For example, the quantity \(p\) represents the ratio of the
total number of blood-type genes of type A
to the total number of
blood-type genes. Since each blood-type gene is either A
, B
or
O
, it is clear that \(p + q + r = 1\).
The Hardy-Weinberg principle implies that:
\((\clubsuit)\) The quantities \(p\), \(q\), and \(r\) remain constant from generation to generation, as do the frequencies of occurrence of the different genotypes
AA
,AO
, … .Assuming the validity of \((\clubsuit)\), what is the probability that an individual has genotype
AA
?BB
?OO
? What is the probability of an individual having two different genes? Express your response using the quantities \(p\), \(q\) and \(r\).Still assuming the valiidty of \((\clubsuit)\), find the maximum percentage of the population that can have two different genes. Perform this computation in two different ways:
- directly maximize a function of only two variables
- use the method of Lagrange multipliers.
Explain in words what the Lagrange multiplier represents in the second computation of part (b).
4. Newton’s method and root finding
microprocessors
One of the uses of Newton’s method is in implementing division on microprocessors, where only addition and multiplication are available as primitive operations. To compute \(x = a/b\), first the root of \(f(x) = 1/x − b\) is found using Newton’s method, then the fraction is computed with one last multiplication by \(a\).
Find the Newton iteration needed to solve \(f(x) = 0\) and explain why it is well-suited to this purpose. (Note: The point here is to approximate division, so you shouldn’t use division functions implemented in
python
!)experiments
Apply Newton’s Method to compute \(1/b\), where \(b\) is: (i) the last 3 digits of your student number; and (ii) the area code of your phone number. For these experiments, report the number of iterations required for the approximation to be consistent to 10 digits.