I am an applied statistics student trying to solve a problem where constrained optimization is required. I have a function $f(x, p_1, p_2)$ in which $p_1 \epsilon [0,1]$, $p_2 \epsilon [0,1]$ are probabilities, and $x \epsilon (-\infty,2)$. I am looking for the optimal range of the 3rd parameter $x$ under the condition that $f(x, p_1, p_2) > 0$ only if $p_1 \leq 0.9 \cap p_2 \leq 0.805$. I naively calculated $x$ as the zero of the function $f(x, p_1=0.9,p_2=0.805)$. However, with some trial and error it quickly became clear to me that this leads to an incorrect solution. The function and what I tried in the R programming language is given below:

valueFunc = function(x, p1, p2){
  b1 = (1-p1) * x + 2 - 4 * p2
  b2 = (1-p1) * x + (1-p2) * x       
  a = 2-4*p1 + (p1-p2) * x       

  return(a - max(b1, b2))

#What I have tried
x=uniroot(valueFunc, interval = c(0,-500), p1=0.9, p2=0.805)$root

Please let me know how should I approach this problem to find the optimal range of $x$? Links to articles are welcome. A general direction and/or a solution from which I can learn is also welcome. Due to limited exposure to such problems I have probably not selected all tags correctly.

  • $\begingroup$ It would help if you can write out the objective function (e.g., you want to minimize $f(x,p_1,p_2)$ for fixed $p_1$ and $p_2$, or something like that), and what your constraints are (e.g., $x \in (-\infty,2)$.) It's a little hard to tell from what you wrote. $\endgroup$ – LarrySnyder610 May 7 at 15:49

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.