I want to reformulate the constraint:
$$[x = a] \Leftrightarrow [d = 1]$$
where $d$ is a binary variable
$$ d \in \mathbb{Z}, \quad d \geq 0, \quad d \leq 1$$
and $x$ is bounded
$$m \leq x \leq M$$
Is there a way to do this?
I know there are ways for inequality constraints, like
$[x \leq a] \Leftrightarrow [d = 1]$
can be reformulated as
$x \leq a + M (1-d)$
$x \geq a + m d$
and similar
$[x \geq a] \Leftrightarrow [d = 1]$
can be reformulated as
$x \leq a + M d$
$x \geq a + m (1-d)$.
Let $\epsilon>0$ be a tolerance, introduce additional binary variables $d^-$ and $d^+$, and impose the following linear constraints: \begin{equation} d^- + d + d^+ = 1 \\ m d^- + a d + (a+\epsilon) d^+ \le x \le (a-\epsilon) d^- + a d + M d^+ \end{equation} If $x \in \mathbb{Z}$, you can take $\epsilon=1$.