I'm trying to solve the following optimization problem.
\begin{aligned} \max_{e, s} \quad & v=\frac{(\lambda + i)U_{emp}+(1-e)U_{unemp}}{i(1-e+\lambda+i)}\\ \textrm{s.t.} \quad & \lambda = \frac{(1-e) n L}{1-e n L}\\ & U_{emp}=w-s-\frac{1}{(w-s)(1-e)} \\ & U_{unemp}=\frac{s\lambda}{1-e}-\frac{1-e}{s\lambda}\\ \end{aligned} where $0\leq i \leq 1$, $0\leq e \leq 1$, $0\leq a \leq 1$, $w > s > 0$, $n> 0$, $L>0$, $0<nL<1$.
The solution method is simple: First find the two first-order conditions and then solve them simultaneously to obtain the optimal values of $e^*$ and $s^*$.
My code for this is as follows:
v = ((i + lambda) Uem - (-1 + e) Uun)/(i (1 - e + i + lambda));
lambda = ((1 - e) n L)/(1 - e n L);
Uem = (w - s) - 1/((w - s) (1 - e));
Uun = (s lambda)/(1 - e) - 1/((s lambda)/(1 - e));
Solve[{D[v, e] == 0, D[v, s] == 0}, {e, s}]
which is running forever. Any help would be greatly appreciated.
Edit: I tried Maximize
. My code is the following.
v = ((i + lambda) Uem - (-1 + e) Uun)/(i (1 - e + i + lambda));
lambda = ((1 - e) n L)/(1 - e n L);
Uem = (w - s) - 1/((w - s) (1 - e));
Uun = (s lambda)/(1 - e) - 1/((s lambda)/(1 - e));
Maximize[{v, {e, s}]
which is still running forever.
Solve
look at the size and complexity of your two derivatives! I'm not surprised it can't immediately give you a solution. Both can befraction==0
and if you could convince yourself that the denominators aren't zero thennumerator==0
would be smaller and maybe easier, but that doesn't seem to be enough. Can you find any other ways to make this a much simpler problem? Is there any chance that Mathematica'sMaximize
might be smarter than differentiate-and-solve? I didn't see an example in the docs of simultaneous max of two functions, but maybe there is a way $\endgroup$i = 1; beta = 2; a = 1; w = 3; lambda = 3; n = 2; NMaximize[v, {e, s}]
performs{2.27322*10^49, {e -> -0.25, s -> 3.}}
. The result is not from the real world.NMinimize[v, {e, s}]
outputs{-1.09131*10^15, {e -> -0.495135, s -> 3.}}
. $\endgroup$Maximize
which I added as edit but didn't obtained the result. $\endgroup$Maximize
, the result of which I added as edit but didn't obtain the answer. $\endgroup$