How to divide real affine matrix by real affine scalar?

I am trying to perform a division operation of a numerator (5x4 real affine expression) by a denominator (scalar real affine expression). One of the DCP rules is that an affine cannot be divided by another another. Hence, I have tried to convexify the expressions using logarithm. This produces a {convex} - {concave} expression that CVX is rejecting and flagging as error. Please is there another way I can make it acceptable to CVX. Here are my codes.

% Operation that I want to perform sinr = log(numer ./ denom)
% numer is a 5x4 real affine expression
%denom is a scalar real affine expression

sinr = 0;
for t = 1:size(numer,1)
for v = 1:size(numer,2)
sinr = sinr + log(numer(t,v)) + (-log(denom));
end
end

obj = B_RB .* sinr;

maximize(obj)
subject to
0<=pf<=(10^(23/10))/1000;
cvx_end

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.

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?

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).

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));

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.

1 Like

Dear sir, did you mean this

variable G_bar
or
expression G_bar

I mean

variable G_bar

1 Like

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_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.

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

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.

1 Like

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.

1 Like

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.

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

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.

2 Likes

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.

Dear @Michael_Tarerefa,

I am having the same problem as you. Could you please share the solution you found.
Thanks in advance,

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

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

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.