# your code hereOptimization Methods
In this tutorial you will learn to code and use common optimization algorithms for static models.
Profit optimization by a monopolist
A monopolist produces quantity \(q\) of goods X at price \(p\). Its cost function is \(c(q) = 0.5 + q (1-qe^{-q})\)
The consumer’s demand for price \(p\) is \(x(p)=2 e^{-0.5 p}\) (constant elasticity of demand to price).
- Write down the profit function of the monopolist and find the optimal production (if any). Don’t use any library except for plotting.
Constrained optimization
Consider the function \(f(x,y) = 1-(x-0.5)^2 -(y-0.3)^2\).
- Use Optim.jl to maximize \(f\) without constraint. Check you understand diagnostic information returned by the optimizer.
# your code here- Now, consider the constraint \(x<0.3\) and maximize \(f\) under this new constraint.
# your code here- Reformulate the problem as a root finding problem with lagrangians. Write the complementarity conditions.
# your code here- Solve using NLSolve.jl
# your code hereConsumption optimization
A consumer has preferences \(U(c_1, c_2)\) over two consumption goods \(c_1\) and \(c_2\).
Given a budget \(I\), consumer wants to maximize utility subject to the budget constraint \(p_1 c_1 + p_2 c_2 \leq I\).
We choose a Stone-Geary specification where
\(U(c_1, c_2)=\beta_1 \log(c_1-\gamma_1) + \beta_2 \log(c_2-\gamma_2)\)
- Write the Karush-Kuhn-Tucker necessary conditions for the problem.
# your code here- Verify the KKT conditions are sufficient for optimality.
# your code here- Derive analytically the demand functions, and the shadow price.
# your code here- Interpret this problem as a complementarity problem and solve it using NLSolve.
# your code here- Produce some nice graphs with isoutility curves, the budget constraint and the optimal choice.
# your code here