# How to divide real affine matrix by real affine scalar?

(Mark L. Stone) #2

You already received guidance on more or less the same thing at Expressing shannon capacity in CVX .

Your attempt at convexification is not convexifying.
log(x/y) (for x and y being scalars) is an indefinite form (neither convex nor concave) with respect to x and y. If this is the problem you need to solve, you will need to use a tool which can handle non-convex problems.

(Michael Tarerefa) #3

Thanks for your response sir, there are more or less the same problem and I have attempted to follow the DCP rules but still not getting it accepteable to CVX. I came across this and tried using the steps to convexify the problem I’m solving. However, if you were to express the last equation on CVX, how would you write the log_sum_exp part which is a convex expression?

(Mark L. Stone) #4

help log_sum_exp

log_sum_exp log(sum(exp(x))).
log_sum_exp(X) = LOG(SUM(EXP(X)).

``````When used in a CVX model, log_sum_exp(X) causes CVX's successive
approximation method to be invoked, producing results exact to within
the tolerance of the solver. This is in contrast to LOGSUMEXP_SDP,
which uses a single SDP-representable global approximation.

If X is a matrix, LOGSUMEXP_SDP(X) will perform its computations
along each column of X. If X is an N-D array, LOGSUMEXP_SDP(X)
will perform its computations along the first dimension of size
other than 1. LOGSUMEXP_SDP(X,DIM) will perform its computations
along dimension DIM.

Disciplined convex programming information:
log_sum_exp(X) is convex and nondecreasing in X; therefore, X
must be convex (or affine).``````

(Michael Tarerefa) #5

Not sure if this is the proper way to express it as I still get CVX error.
Ci = log(Gii) + log(pi) - log_sum_exp(log(Gij) + log(pj) + log(sigma2));

(Mark L. Stone) #6

You want to define a new CVX variable, G_bar, which will be log(G). You only tell CVX about G_bar, and never tell it about G, and therefore do not use log(G) in CVX. Use G_bar, not log(G) in CVX.

(Michael Tarerefa) #7

Dear sir, did you mean this

variable G_bar
or
expression G_bar

(Mark L. Stone) #8

I mean

`variable G_bar`

(Michael Tarerefa) #9

I did the following and got the MATLAB error message
variable G_bar

G_bar == log(G);

Error using cvxprob/newcnstr (line 192)
Disciplined convex programming error:
Invalid constraint: {real affine} == {concave}

Error in == (line 12)
b = newcnstr( evalin( ‘caller’, ‘cvx_problem’, ‘[]’ ), x, y, ‘==’ );

Error in CoalitionalGame (line 79)
G_bar == log(G);

(Michael C. Grant) #10

@Michael_Tarerefa, I need to suggest that you stop trying to use CVX. You really haven’t internalized the necessary approach to using it properly, and I promise you that it will give you nothing but frustration if you continue on this path.

CVX is not a tool for solving any model you want to throw at it. It only solves models that are convex, and in fact, it can’t even solve all convex models! If you don’t respect what is said in the FAQ, you are guaranteed to fail.

(Michael Tarerefa) #11

Dear sir @mcg , the capacity maximization problem I’m trying to solve is a well known convex optimization problem in wireless comunication. I’m making genuine attempts and strongly believe that I’m not far from getting it right. Thanks for the criticism though.

Kind regards

(Mark L. Stone) #12

You should not have
`G_bar == log(G);`

As wrote, if you use G_bar, you should never tell CVX about the existence of G.

(Michael C. Grant) #13

Many problems that are claimed to be convex in papers are not in fact written in their solvable form in those same papers. I wish authors would be required to be more explicit in showing exactly how they solved problems they claim are convex. Heck, if they claim to use CVX they should include the model code or make it readily available, but they often do not.

But I can’t blame authors for the failure of CVX users to read and obey the FAQ. Have you proven it is convex yet? It is not enough to trust other papers. You must prove it is convex, yourself. And more importantly, you must be able to do it solely by using only the rules laid out in the DCP ruleset, using the functions found in the supported function list.

The very fact that you asked “How to divide real affine matrix by real affine scalar” tells me you haven’t followed those instructions. You would not have asked this if you had, because the DCP rules clearly do not allow this, and the FAQ explains why. The same goes for your attempt to subtract one concave logarithm from another.

(Michael Tarerefa) #15

Yes, I agree that most papers claiming to solve convex problems are infact non-convex. I have seen quite a few and wished that authors can make a practice of publishing of their codes along with the papers. Thanks sir.

(Michael C. Grant) #16

Thanks to our conversation I’ve added a new section to the FAQ to talk about “proof by citation”

I know it sounds harsh, here and in the FAQ, to tell people not to use our software. But it really is frustrating, as you surely know, to keep running into these DCP errors.

(Michael Tarerefa) #17

Many thanks @mcg and @Mark_L_Stone for your patience and understanding. I have been able to resolve the problem using CVX. This thread of conversation challenged me and open my eyes to the workings of CVX. Thanks once again.

(Amalhay A) #18

Dear @Michael_Tarerefa,

I am having the same problem as you. Could you please share the solution you found.

(Michael Tarerefa) #19

It will help if I know the exact problem you’re trying to solve using CVX. Then I can be able to offer guidance.

(Amalhay A) #20

This is the problem, i am trying to solve using cvx.

My code looks like this for now:

cvx_begin
variables power(m,1)
minimize ( -min(((Apower))./(sum(A_modifpower,2)+self)))
power<1000*ones(m,1);
power >= 0;
cvx_end

PS: I have already defined the path gain matrix

(Mark L. Stone) #21

Presumably, all elements of A are >= 0.

http://www.cvxpy.org/examples/applications/maximise_minimum_SINR_BV4.20.html should be implementable in CVX.

Study sections 4.2.5 and 4.3.2 of Boyd and Vandenberghe “Convex Optimization” https://web.stanford.edu/~boyd/cvxbook/ so that you can understand this solution.

(Michael Tarerefa) #22

Hi @AmalhayA , sorry for the very late response. Have you solved the problem? If not, we can chat over email, feel free to message me on tarebimike@gmail.com