Open pedromxavier opened 1 year ago
I think this is the right way. This reformulation also works for disjunction $[y_i, x \in X_i]$ or equivalently indicator variables $y_i \to x \in X_i$ https://www.gurobi.com/documentation/9.5/refman/py_model_agc_indicator.html
Sure, for $x \in A \cup B$,
$$ \xi[A \cup B](\mathbf{y}; z) = z ~~ \xi[A] (\mathbf{y}) + (1 - z) ~~ \xi[B] (\mathbf{y}) $$
or even
$$ \xi \left[ \bigcup{j = 1}^{n} X{j} \right](\mathbf{y}; \mathbf{z}) = \sum{j = 1}^{n} z{j} ~~ \xi[X{j}] (\mathbf{y}) ~~ \textrm{s.t.} ~~ \sum{j = 1}^{n} z_{j} = 1$$
You are reinventing Disjunctive Programming! Let's go!
Implement encoding for $x \in \{0\} \cup X$.
One option is to write
$$ \xi[\{0\} \cup X](\mathbf{y}; z) = z ~ \xi[X] (\mathbf{y}) $$
where $(\mathbf{y}; z) \in \mathbb{B}^{n + 1}$.