# How to write set overlap constraint in cvx?

Hi, I’m working on an optimization problem and I need to write this constraint in cvx, but I don’t know how. This is it:
A_i \cap A_j != Ø
when A_i is a circle:
A_i = { x : ||x_i - c_i ||_2 <= r_i } , i=1,…,m

How should it be said in the model? And then how to write it in cvx?

I don’t understand your intended constraints. If you want A_i and A_j to have a non-empty intersection for every combination of i and j, isn’t that the same as the collection, i.e., intersection, of all A_i being non-empty?. I.e., that the problem having all the A_i 's as constraints is feasible? In which case, just specify all the A_I as constraints.

If that is not what you want, what do you want? And is that constraint convex? If not convex, then depending on what it is, perhaps it can be done with judicious use of enough binary variables.

1 Like

Thank you very much for your response. In my optimization problem, which is an exercise for my university, it has been said that we want to find m circles A_i = { x : ||x-c||_2 <= r } , i=1,..,m , with their centers and radiuses to minimize total areas and there are two constraints:

The first constraint is that the first n circles are constant, i.e. , c_i = cfix_i , r_i = rfix_i for i=1,..,n .

[Edited] : I just contact the Teacher Assistant about it, and they said they had a mistake in typing the question! The correct one is like this:

And the second constraint is A_i \cap A_j = Ø , i,j \in S (the set S is defined as some i’s and j’s). And It also says that some of the circles may be just a single point c (i.e. , r=0).

So now it is about to “not” have any overlap for some circles. Still I don’t know how to write that in cvx.

(Sorry for my English btw it’s not my mother language.)

Now are you saying that constraints A_i and A_j must not be mutually satisfied? if so, and all the A_i mus be satsfiied, the problem would be infeasible.

Anyhow if you have a well-specified convex mathematical optimization problem for which you need assistance formulating in a way compatible with CVX, and such (re)formulation is not the point of a school assignment, then readers on this forum might be able to help. It is not the place of this forum to do school assignments or to help you formulate convex optimization problems when you don’t even know mathematically what you want.

1 Like

Yeah I know, I didn’t want to formulate the problem. I wanted to implement a constraint in cvx. I was thinking the same thing that you said in your previous reply, that the second constraint was not clear. so I asked TA and then they said the formulation was wrong… So they wasted so much of my time and yours. I’m working on it and if I succeed, I may post the answer here for those readers who might have the same problem.

Expressing that two disks do NOT overlap is equivalent to saying that their centers are far enough and that is not convex.

1 Like