# Error in Generalized Geometric programming Optimization

Hello,

I am trying to solve a minimization problem. I have the ratio of two posynomials which I know from theory that it is non-convex problem .
So, in order two solve it I am doing some transfrmations on the denominator and finally I have a ratio of a posynomial and a monomial, which I also know that the result is a posynomial and it is in th standard form of geometric programming problem and it can be easily solved using interior point method.

my cvx code is as follows:
`cvx_begin gp quiet cvx_solver sedumi variables P_s P_r P_j minimize ( (P_s*b(5) + P_r*b(6) + P_r*P_j*b(7) )/ ( ((P_s*b(1))/a(1))^a(1) * ((P_s*P_j*b(2))/a(2))^a(2) * ((P_r*b(3))/a(3))^a(3) * ((P_r*P_j*b(4))/a(4))^a(4)) ) subject to P_tot^-1 *P_s + P_tot^-1 *P_r + P_tot^-1 *P_j <= 1; P_r*P_s^-1 * (a_r / deco_const) <= 1 ; cvx_end`

where a and b are vector with real values and a_r and deco_const also are real numbers. I followed all the rules for writing correct geometric programs.
The code is working most of the times, BUT sometimes,while I am doing many Monte Carlo simulations, this error is coming up:
Error using +
Disciplined convex programming error:
Illegal operation:{log-affine} + {concave}

I hope you can understand, if not I can give you more details.
Thank you in advance.

Do you know precisely where this error is occurring? That is, which of the constraints? I do grant that things seem compliant here, but I don’t know.

yes the error is occuring in the line with the objective function.
and it just happened again in…

OK, so it’s happening in the sum. Somehow, it thinks that one of the terms in the sum is concave instead of log-affine. I’m guessing one of the key values of b is negative when that happens.

Hmm…maybe, I will check it. If it’s negative can I make it work?

No, because it’s no longer a geometric program in that case.

Yes, right. . If I find the problem I will post it.
Thank you very much.
I really appreciated your help.

EDIT: Indeed, one value of b takes negative value in some iteration, although it shouldn’t. So the problem isn’t in my cvx code but elsewhere.