Quasiconvex programming trouble with addition operator

31 views
Skip to first unread message

Patrick O'Callaghan

unread,
May 22, 2021, 7:54:23 AM5/22/21
to cvxpy
Consider the two rather standard quasi-convex programs in cvxpy:
```py
import cvxpy as cp
```
The following QCP solves without much trouble:
```py
x1 = cp.Variable()
x2 = cp.Variable()
obj = cp.sqrt(x1) * cp.sqrt(x2)
BC = [ 3 * x1 + x2 <= 100]
prob = cp.problem(cp.Maximize(obj), BC)
prob.solve(scp = True, verbose = True)
```
Whereas the following fails:
```py
x1 = cp.Variable()
x2 = cp.Variable()
obj = (cp.sqrt(x1) + cp.sqrt(x2)) ** 2
BC = [ 3 * x1 + x2 <= 100]
prob = cp.problem(cp.Maximize(obj), BC)
prob.solve(scp = True, verbose = True)
```
Your suggestions are welcome.

Patrick O'Callaghan

unread,
May 23, 2021, 9:47:18 PM5/23/21
to cvxpy
A couple of corrections that don't change the substance of the question: 

import cvxpy as cp

x1 = cp.Variable()
x2 = cp.Variable()
BC = [3 * x1 + x2 <= 100]
Consider the two rather standard quasi-convex programs in cvxpy:

The following QCP solves without much trouble:

objCD = cp.sqrt(x1) * cp.sqrt(x2)
probCD = cp.Problem(cp.Maximize(objCD), BC)
probCD.solve(qcp=True, verbose=True)
print("x1 = ", x1.value, "and x2 = ", x2.value)

Whereas the following fails:

objCES = (cp.sqrt(x1) + cp.sqrt(x2)) ** 2
probCES = cp.Problem(cp.Maximize(objCES), BC)
probCES.solve(qcp=True, verbose=True)
print("x1 = ", x1.value, "and x2 = ", x2.value)

Your suggestions are welcome.

Steven Diamond

unread,
May 24, 2021, 6:44:14 PM5/24/21
to cvxpy
Could you post a github issue for this?

Patrick O'Callaghan

unread,
May 24, 2021, 8:39:12 PM5/24/21
to cvxpy
Sure
Reply all
Reply to author
Forward
0 new messages