0
$\begingroup$

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.

$\endgroup$
5
  • 1
    $\begingroup$ Before throwing it at 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 be fraction==0 and if you could convince yourself that the denominators aren't zero then numerator==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's Maximize 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$
    – Bill
    Commented Dec 14, 2023 at 3:17
  • $\begingroup$ 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$
    – user64494
    Commented Dec 14, 2023 at 7:53
  • $\begingroup$ @Bill, thanks, I tried Maximize which I added as edit but didn't obtained the result. $\endgroup$
    – ppp
    Commented Dec 14, 2023 at 15:01
  • $\begingroup$ @user64494, thanks for your help, but would there be a way to obtained the result analytically, not numerically? I tried Maximize, the result of which I added as edit but didn't obtain the answer. $\endgroup$
    – ppp
    Commented Dec 14, 2023 at 15:02
  • $\begingroup$ @ppp these look awfully complicated to find analytical solutions. Are there meaningful special cases (e.g. parameter is 0, asymptotic limits) where you might start to look for an analytical solution? Sometimes these are useful to initiate numerical optimizations for more fulsome models. $\endgroup$
    – Eric Brown
    Commented Dec 14, 2023 at 16:52

0