1
$\begingroup$

The code below is my attempt to solve a constrained optimization problem:

$Assumptions = {σ > 0, t > 0, λ > 0, m0 > 0, m1 > 0, k > 0, v0 > 0, v1 > 0, f > 0, TK >= (2*f*k ), acC > 0, acP > 0, ρ > 0 }
r0sq[m0_]  :=  (   ((m0*acC*ρ) + (1 - ρ)*acP)/(1 + (m0 - 1)*ρ))^2;
r1sq[m1_]  :=  (   ((m1*acC*ρ) + (1 - ρ)*acP)/(1 + (m1 - 1)*ρ))^2;
Delta[m0_, m1_] :=   2*σ^2 *   t^2*(  ( 1/(m0*k)*(1 + (m0 -1)*ρ)*(1 - r0sq[m0])) + ( 1/(m1*k)*(1 + (m1 - 1)*ρ)*(1 -r1sq[m1])));
Cost[m0_, m1_] := 2*f*k + v0*m0*k + v1*m1*k  ;
L[m0_, m1_, λ_] := Delta[m0, m1] + λ*(TK - Cost[m0, m1]);
eq1 = D[L[m0, m1, λ], m0]
eq2 = D[L[m0, m1, λ], m1]
eq3 = D[L[m0, m1, λ], λ]
{m0, m1} /.  Solve[{eq1 == 0, eq2 == 0 , eq3 == 0 }, {m0, m1, λ}, Method -> Reduce] 

My issue is that once Mathematica gets to the Solve line it runs for hours wthout solving. I have a slightly different version of this constrained optimization problem which involves $2(1-r)$ rather than $(1-r^2)$. This solves instantly.

Given that I am such a Mathematica-neophyte, I don't know if I haven't coded this very well, or if there is no analytical solution to this problem. Does anyone have any suggestions? Have been fighting with this for about a week now, and going a bit crazy...

$\endgroup$
  • $\begingroup$ Looks like an interesting problem! If you could also describe the problem in English/mathematics, it may be easier to help! $\endgroup$ – mjw Apr 1 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.