0
$\begingroup$

I'm working with Maximize and it does not generate any result but simply reproduces the same code. My object function is rather complex which is:

$0.18 k-0.36 + \frac{k^2 r (c (0.018\, -0.036 q)+0.0036)+c (-0.02304 q-0.03456)+0.07632}{r}+0.06 (-2 + k) (-5.92 + (-4 + (2 - 0.1 k) k) r + c (0.96 - 0.5 k^2 r + q (0.64 + k^2 r)))$

I would like to find the optimal $r\in [0,1]$ and $k\in [0,1]$ given $q\in [1,2]$ and $c\in [0,1]$. My Mathematica code is as follows:

Maximize[{-0.36 + 0.18 k + (0.07632 + c (-0.03456 - 0.02304 q) + k^2 (0.0036 + c (0.018 - 0.036 q)) r)/r + 0.06 (-2. + k) (-5.92 + (-4. + (2. - 0.1 k) k) r + c (0.96 - 0.5 k^2 r + q (0.64 + k^2 r))), 1<=q <=2, 0 <= c <= 1}, {r, k}]

Can any one help?

$\endgroup$
  • 1
    $\begingroup$ There is no maximum. If $c=k=0,q=1$ then the value is unbounded as $r\to 0^+$ because of dividing by $r$. More precisely, the value is $0.07632/r + 0.3504 + 0.48r$. $\endgroup$ – Somos Apr 20 at 21:57
1
$\begingroup$

Give it exact input:

Maximize[
 Rationalize[
  Rationalize@{-0.36 + 
     0.18 k + (0.07632 + c (-0.03456 - 0.02304 q) + 
        k^2 (0.0036 + c (0.018 - 0.036 q)) r)/r + 
     0.06 (-2. + k) (-5.92 + (-4. + (2. - 0.1 k) k) r + 
        c (0.96 - 0.5 k^2 r + q (0.64 + k^2 r))), {1 <= q <= 2, 
     0 <= c <= 1}},
  0], {r, k}]

Mathematica graphics

$\endgroup$
  • $\begingroup$ thanks! May I ask some questions? (i) Why do we have 0 right before {r,k}? (ii) Does the result mean the objective function is negative infinite under the given conditions and, otherwise, positive infinite, regardless of the value of r and k? $\endgroup$ – ppp Apr 20 at 21:29
  • $\begingroup$ @ppp (i) Rationalize[expr] vs. Rationalize[expr, 0]; The ifirst is done, and if some numbers did not get rationalized, the second one will force the numbers to be converted to the exact fraction equivalent to the floating-point number, very likely with the large denominator that can make the symbolic solution more difficult to compute. (In fact, after testing, the second, outer Rationalize with the 0 turns out to be unnecessary.) (ii) The answer means the function is unbounded, probably because of the r in the denominator. $\endgroup$ – Michael E2 Apr 20 at 21:41

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.