#obj = cp.Minimize(x1 - 2*x2 - mu*cp.log(-1*(x2**2 - x1 - 1)) - mu*cp.log(-1*(-x2)) )
-1.9999851857553026
x1 value : [1.81318945e-06]
x2 value : [1.00000041]
3 - Inverse barrier method I get the DCP ERROR:
x1 = cp.Variable(1)
x2 = cp.Variable(1)
g1 = (x2**2 - x1 - 1)
g2 = (-x2)
f = x1 - 2*x2
obj = cp.Minimize(f)
mu = 0.000001
obj = cp.Minimize(f - mu/g1 - mu/g2)
problem = cp.Problem(obj)
print(problem.solve())
However, when I ran the code above, it gives me the following error:
DCPError: Problem does not follow DCP rules. Specifically:
The objective is not DCP. Its following subexpressions are not:
1e-06 / (power(var82, 2.0) + -var81 + -1.0)
1e-06 / -var82
4 - things that I have tried
I know that
- (f).curvature is 'AFFINE'
- (mu/g1).curvature is 'QUASICONCAVE'
- (mu/g2).curvature is 'QUASILINEAR'
- (f - mu/g1 - mu/g2).curvature is 'UNKNOWN'
so I tried to solve using obj = cp.Minimize(f - mu*cp.inv_pos(g1) - mu*cp.inv_pos(g2))
but since
- (mu*cp.inv_pos(g2)).curvature is 'CONVEX'
- (mu*cp.inv_pos(g1)).curvature is 'QUASICONCAVE'
I get the same error
I have also tried using problem.solve(qcp=True)
but I get the following error DQCPError: The problem is not DQCP.
I have already seen
The DCP ruleset — CVX Users' Guide (cvxr.com) which basically states that implementing the same expression using different functions may change the DCP status. but no matter what, I cannot end up with DCP problem.
5 - things that I have deduced.
Both inverse barrier and logarithmic barrier methods, establish a rapidly increasing cost around the boundaries. (Constraints are implied using a high cost) So since the problem can be solved using log barrier method (refer to section 2 for a better understanding) , it should be solvable by using the inverse barrier method. Both methods work in a similar way.
Since expressing some functions in a different way (i.e. the following code is
sqrt( x^2 + 1 ) interpreted as not DCP while the
norm( [ x 1 ] ) is interpreted as DCP,
The DCP ruleset — CVX Users' Guide (cvxr.com)) changes the DCP status, rewriting the objective function may solve the problem.
6 - my ultimate question
- How can this problem be solved using the inverse barrier method?
7 - appendix
Inverse barrier method :
log barrier method :