# Defining multiple constraints compactly where some index combinations are not defined

My question is about how usual/strange defining constraints compactly can be (in a scientific document). Formally, I define constraints $$f_{i,j,k}(x) \leq 0, \quad \forall i \in [I], \ \forall j \in [I], \ \forall k \in K(i,j)​$$ where $$K(i,j) := \{ k \ : \ A_k \cap (A_i \cap A_j) \neq \emptyset \}$$. However, for some combinations of $$(i,j)$$, we have $$A_{i} \cap A_j = \emptyset$$ so we have $$K(i,j) = \emptyset$$. I have two options:

1. Define the constraints for all $$i \in [I]$$ and for all $$j,k$$ in some (slightly more) complicated set parametrized by $$i$$, or,
2. Just note that if we have some constraints where $$k$$ is not defined, we ignore these constraints (i.e., these constraints are not defined).

I was wondering, can I "get away" with the second option? I do not want to introduce a set for $$(j,k)$$, rather keep it as it is, and just ignore the constraints for $$i,j$$ where $$K(i,j) = \emptyset$$.

End-notes: $$f$$ is an arbitrary function, $$x$$ is a decision variable, $$I$$ is an abitrary natural number, e.g., $$I = 5$$, and $$|I|$$ denotes $$1,\ldots, I$$. The sets $$A_i$$ for $$i \in [I]$$ are not important in this context.

• Why not define a sparse set of triples $(i,j,k)$ and use that instead? Nov 15 '21 at 21:25
• @RobPratt thanks for your answer. What do you mean by sparse set? It sounds like it is point 1. above which I am trying to avoid. Nov 15 '21 at 21:37
• The answer also depends on the modeling tool being used (not all tools allow empty constraints, some have great support for sparse sets). In general, I prefer to make things as explicit as possible (not in the least to document that this is a sparse structure) and to generate small models instead of relying only on the presolver. Nov 16 '21 at 0:50

The constraint is defined only for triples $$(i,j,k)$$ satisfying the domain conditions, including the requirement that $$k\in K(i,j)$$. So I think it is fine to just point out that $$K(i,j)$$ can be empty and remind the reader that $$K(i,j)=\emptyset$$ implies there are no instances of this constraint for that combination of $$i$$ and $$j$$. In other words, I think your option 2 is perfectly acceptable.
One approach is to define a sparse set $$T$$ of triples: $$T=\{i\in [I], j \in [I], k\in [I]: A_i \cap A_j \cap A_k \not= \emptyset\}$$ or $$T=\{(i,j,k)\in [I]^3: A_i \cap A_j \cap A_k \not= \emptyset\}.$$ Then write the constraint as $$f_{i,j,k}(x) \le 0 \quad \text{for (i,j,k)\in T}$$