pengpeng
(Pengpeng Liu)
April 19, 2018, 9:38am
1
Hello everyone!Please help me.Why did cvx rejact my codes.Only rou(1,k) is a variable.

```
for k=1:K
for n=1:N
Jvli(k,n)=(itrq(1,n)-w(1,k))^2+(itrq(2,n)-w(2,k))^2+H^2;
Object(k,n)=miu(k,n)*(M-baita(k,n)*(1+exp(-a*(b0*itrp(1,n)*(1-rou(1,k))/Jvli(k,n)-b))));
Objectsum=Objectsum+Objectkn(k,n);
end
end
```

Disciplined convex programming error:
Illegal operation: {real constant} + {invalid}

Well, something is invalid, but you may not have shown us enough of your program to determine what.

Perhaps you should remove semicolons so that you can better see what is happening. Can you provide us a (minimal) reproducible example?

pengpeng
(Pengpeng Liu)
April 19, 2018, 12:25pm
3
```
![image|461x65](upload://cTKCZZ7INDoC9ouCOWsGALsvFSd.png)
```

This is my mathematical formula.q is a 2N matrix. w is a 2 k matrix

The image was not successfully uploaded.

Please show us your reproducible ode, not pictures of math formulas. We don’t know what is “invalid”

I think this is due to numerical overflow with exp(x), which occurs in MATLAB double precision at x > = 709.79.

The first time through the for loop, here is what happens:
`-a*(b0*itrp(1,n))`

evaluates to 180000.
and

`exp(-a*(b0*itrp(1,n))*(1-rou(k)))`

```
ans =
cvx invalid expression (scalar)
```

Indeed, we see

exp(709*(1-rou(1,k)))
ans =
cvx log-affine expression (scalar)

exp(710*(1-rou(1,k)))
ans =
cvx invalid expression (scalar)

So it appears that overflow with exp is causing the error. . Perhaps `Jvli(k,n)-b`

comes into play as well.

I will have to leave further diagnosis and repair to someone more knowledgeable.

pengpeng
(Pengpeng Liu)
April 19, 2018, 2:08pm
7
Thank you very much! Mark.