I have the following concave function
$$f(x)=\frac{ax}{cx+d}$$
where $a, c, d > 0$ and $0 \le x \le 1$. How can I use CVX tools to maximize $f(x)$?
It seems that the CVX does not support such structure even if $f(x)$ is concave.
I have the following concave function
$$f(x)=\frac{ax}{cx+d}$$
where $a, c, d > 0$ and $0 \le x \le 1$. How can I use CVX tools to maximize $f(x)$?
It seems that the CVX does not support such structure even if $f(x)$ is concave.
$$\begin{array}{ll} \text{maximize} & \dfrac{c x}{a x + b}\\ \text{subject to} & 0 \leq x \leq 1\end{array}$$
where $a, b, c > 0$ are given. Note that
$$\dfrac{c x}{a x + b} = \cdots = \frac ca - \frac{bc}{a} \left(\frac{1}{a x + b}\right)$$
Since $ \frac{bc}{a} > 0$, we have the following minimization problem
$$\begin{array}{ll} \text{minimize} & \dfrac{1}{a x + b}\\ \text{subject to} & 0 \leq x \leq 1\end{array}$$
As $-\frac ba \notin [0,1]$, we have the following linear maximization problem
$$\begin{array}{ll} \text{maximize} & a x + b\\ \text{subject to} & 0 \leq x \leq 1\end{array}$$
and, thus, the maximum is attained at $x = 1$.
Since I do not have CVX in this machine, I will use CVXPY instead. Let $a = b = 1$. Thus,
>>> from cvxpy import *
>>> x = Variable()
>>> objective = Minimize( inv_pos(x+1) )
>>> constraints = [ x >= 0, x <= 1 ]
>>> prob = Problem(objective,constraints)
>>> prob.solve()
0.4999999999223261
>>> x.value
1.0000000000418874
Note that the minimum is attained at $x = 1$.