Hello

I need to define a variable with limited domain in discrete parts in cvx

for example variable x that is bounded like

0 <= x <= 1

10 <= x <= 11

but i cant define like above in cvx.

is it possible to have a variable like that in cvx?

This can be done as MIDCP

RobPratt provides a general formulation at https://math.stackexchange.com/questions/3961000/decision-variable-must-lie-in-union-of-multiple-disjoint-intervals/3961273

In your example,

```
variable x
variable z(2) binary
10*z(2) <= x <= z(1) + 11*z(2)
sum(z) == 1
```

Note: I corrected a typo in the statement which is now `variable z(2) binary`

thanks for your answer

but I actually wanted to define a variable with two separate domain so i can simulate binary variable like this:

-1e-6<=x<=1e-6

1-1e-6<=x<=1+1e-6

because I get the error “SDTP3 does not support integer variables.”

if I use:

binary z(2)

I get the same error and It would be useless for me.

I read about this error but I didn’t understand it completely

what is this error about and is there any other way to define binary variable in SDTP3?

Try other solvers.

IT worked

thanks so much