PhD
June 4, 2014, 1:35pm
1
Trying to solve the following code but showing the error “Disciplined convex programming error:”
%% power, p1, p2, K, Ith x and y are known

```
cvx_begin gp
variable P(6)
solve= x *sum(log(1 + P*y));
maximize( solve )
subject to
sum(P)<= Power;
sum(P(1:3))<= p1;
sum(P(4:6))<= p2;
(sum(K*P))<= Ith;
cvx_end
```

where is the problem and what is the solve??
thanks in advance

mcg
(Michael C. Grant)
June 4, 2014, 2:37pm
2

mcg
(Michael C. Grant)
June 4, 2014, 2:38pm
3
Do read that, but also note that you’ve specified programming mode—but you’re not using that correctly, either. Here are the rules for geometric programs, which yours violates in the `solve`

expression.

Try this please

cvx_begin

cvx_expert true

variable P(6)

solve= x sum(log(1 + P y));

maximize( solve )

subject to

```
sum(P)<= Power;
sum(P(1:3))<= p1;
sum(P(4:6))<= p2;
(sum(K*P))<= Ith;
```

cvx_end