```
variables v(n) d(n) dg(n) c(m)
subject to
(stdgibbs+d) + R*T*S'*log(c) == dg
log(cl) <= log(c) <= log(cu)
```

Problem: S matrix contain negative number, log and equality on first constraint, log and <= on second constraint. Anyone can help?

```
variables v(n) d(n) dg(n) c(m)
subject to
(stdgibbs+d) + R*T*S'*log(c) == dg
log(cl) <= log(c) <= log(cu)
```

Problem: S matrix contain negative number, log and equality on first constraint, log and <= on second constraint. Anyone can help?

Out of your 3 constraints, the only which looks convex is log(c1) <= log©. Why isn’t CVX accepting my model? READ THIS FIRST!

Because you have not shown your overall optimization problem, we dont’ know whether there might somehow be a reformulation which can get around this, but I doubt it.

Hi Mark, thank you for your reply

my whole model is like this:

cvx_begin

variables v(n) d(n) dg(n) c(m)

variable q(n) binary

minimize (theta*sum(abs(v-V)) + sum(abs(d-dnist)./sd))
subject to
(stdgibbs+d) + R*T

0 <= v + M

0 <= -dg -0.02 + M

S*v == 0

dneg <= d <= dpos

log(cl) <= log© <= log(cu)

cvx_end

when I try to calculate this without log (just c), the cvx give a success message, however the actual model need log©. Is there any way to reformulate this problem to convex?

Why not just use log(c) as your variable—call it `logc`

. Then your model is linear in that variable. I don’t see it used any other way in the model, so why not?

Yes, there is an obvious reformulation now that we see the entirety of the problem. Therefore, I have removed the dreaded Nonconvex label.

Thank you for the help guys