0

I am trying to solve a geometric programming problem with cvx package in Matlab. Objective function is maximization, but inside it, I have to define a min function. When I try to run the code, I got this error

Error using cvx/mtimes (line 41) Inner matrix dimensions must agree.

Error in cvx/mrdivide (line 15) z = mtimes( x, y, 'rdivide' );

and the code is here:

cvx_begin gp
variables P_1 P_2
maximize ((D * (log2(P_1 * min(G_1/(np + (P_2 * G_2)))))) + log2((P_2 * G_3)/(np + (P_1 * G_3))))
subject to
    P_2 <= P_max_Cell;
    P_1 <= P_max_D2D;
    P_2 * (G_3/(np + (P_1 * G_3))) >= C_th;
    min(G_1/(np + (P_2 * G_2))) * P_1 >= D_th;
    ((np + (P_2 * G_2)) * min(G_1/(np + (P_2 * G_2)))) <= G_1; cvx_end

My previous problem has been solved, but i have another error that I now why it happens, but I don't know how to solve it. The error is:

Disciplined convex programming error: Cannot perform the operation: {log-convex} .* {log-concave}

It is belong to the last line of code. Can anyone help me toward this problem?

S Kh
  • 105
  • 2
  • 9
  • I think the error message is pretty clear, isn't it? – BillBokeey Nov 26 '15 at 10:23
  • I didn't understand what it means. Can you please explain it for me? – S Kh Nov 26 '15 at 10:25
  • When you multiply a matrix X by a matrix Y (i.e. X*Y), the number of columns of X must equal the number of rows of Y. – Matthew Gunn Nov 26 '15 at 10:28
  • 2
    It means that, on line 41 of your script, you are trying to divide two matrices that don't have the right dimensions for this operation. I'm guessing you want to do term by term multiplications and divisions. If so, the right operators are `.*` `./` instead of `*` and `/` – BillBokeey Nov 26 '15 at 10:29
  • Thank you very much @BillBokeey. I will try to fix it. – S Kh Nov 26 '15 at 11:00
  • Thanks, both of you are right. – S Kh Nov 26 '15 at 11:10

0 Answers0