2
$\begingroup$

My object function is $\frac{4 d k (1 - 2 r) r + k^2(3 r-1)r + d^2 (1 + r (6 r-5))}{ 2 (1-r)^2 r} + q* \frac{d^2 (2 - 3 r) + 2 d k ( 2 r-1) + k^2 (1 -(3 - r) r)}{(1-r)^2}$.

And I'm trying to find $r\in (\frac{1}{2},1)$ that minimizes the object function under the condition of $d\in (0,1)$, $\frac{2r-1}{r}d < k <d$, and $q>1$.

My code is as follows:

minR = Last@Minimize[{(4 d k (1 - 2 r) r + k^2 r (-1 + 3 r) + d^2 (1 + r (-5 + 6 r)))/(2 (-1 + r)^2 r) + q*(d^2 (2 - 3 r) + 2 d k (-1 + 2 r) + k^2 (1 + (-3 + r) r))/(-1 + r)^2, 1/2 < r < 1, 0 < d < 1, 0 < (2 r - 1)/r d < k < d,q>1}, r]

... and it has been running forever, more than 6 hours. Any comments will be greatly appreciated!

$\endgroup$
4
  • $\begingroup$ Any assumptions on $q$? Also, why didn't you include your constraints on $r$ in the Minimize[] call? $\endgroup$ Commented Mar 3, 2019 at 3:31
  • $\begingroup$ @J.M. is computer-less: Thanks! Just edited with q>1. And I do have the constraint on r in the Minimize[] $\endgroup$
    – ppp
    Commented Mar 3, 2019 at 3:34
  • $\begingroup$ Oh, it was there and I missed it, apologies. Then, you should put in the $q$ constraint in Minimize[] as well. Since the constraints are expected to be in the second part of the list input, you should do something like Minimize[{function, 0 < d < 1 && 1/2 < r < 1 && q > 1 && 0 < (2 r - 1)/r d < k < d}, r]. $\endgroup$ Commented Mar 3, 2019 at 3:37
  • $\begingroup$ @J.M. is computer-less: Oh, you are right, I missed to include q>1 in Minimize[]. But it is still running long even when I add q>1 as you suggested. $\endgroup$
    – ppp
    Commented Mar 3, 2019 at 3:41

1 Answer 1

1
$\begingroup$

First, strict inequalities make a problem. To illustrate it, let us consider

Minimize[{x, 1 < x && x < 2}, x]

Minimize::wksol: Warning: there is no minimum in the region in which the objective function is defined and the constraints are satisfied; returning a result on the boundary.
{1,{x->1}}

Second, the problem is too complicated for current CASes. To demostrate it, let us consider a simplified problem with weak inequalities instead of strict ones:

{(4 d k (1 - 2 r) r + k^2 r (-1 + 3 r) +  d^2 (1 + r (-5 + 6 r)))/(2 (-1 + r)^2 r) +  
q*(d^2 (2 - 3 r)+d k (-1 + 2 r) + k^2 (1+(-3 + r) r))/(-1 + r)^2, (2 r - 1)/r d <= k <=  d}/.
{d -> 1/2, q -> 3/2};
Minimize[%, r]

which produces a piecewise expression in k including

$$ \text{Root}\left[2048 \text{$\#$1}^3+\text{$\#$1}^2 \left(-7168 k^2+2048 k-3328\right)+\text{$\#$1} \left(8192 k^4-5120 k^3+9344 k^2-2304 k+1504\right)-3072 k^6+3072 k^5-6784 k^4+2880 k^3-2548 k^2+516 k-117\&,2\right]$$

Addition. The following

ClearAll[d, k, q, r]; {(4 d k (1 - 2 r) r + k^2 r (-1 + 3 r) + 
  d^2 (1 + r (-5 + 6 r)))/(2 (-1 + r)^2 r) + 
 q*(d^2 (2 - 3 r) + d k (-1 + 2 r) + k^2 (1 + (-3 + r) r))/(-1 + r)^2, (2 r - 1)/r d <= k <= d && 
 r > 1/2 && r < 1} /. {d -> 1/2, q -> 3/2};Minimize[%, r]

works. The result is a piecewise expression which is too long to be cited here.

Edit. Missed inequalities r > 1/2 && r < 1 are added.

$\endgroup$
3
  • $\begingroup$ Thanks, user64494. Can you please give me some insight on what the notation # is? And why we have Root[]? $\endgroup$
    – ppp
    Commented Mar 3, 2019 at 17:42
  • $\begingroup$ See reference.wolfram.com/language/ref/Root.html for info. $\endgroup$
    – user64494
    Commented Mar 3, 2019 at 17:48
  • $\begingroup$ Thanks, user64494! $\endgroup$
    – ppp
    Commented Mar 3, 2019 at 18:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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