How to model equality in Integer Linear Programming
Use Cast to boolean, for integer linear programming, setting $x=a-b$ and $y=v$.  This only works if you have a constant upper bound on $|a-b|$.  Otherwise, I don't know how to express it in an ILP.

See also Express boolean logic operations in zero-one integer linear programming (ILP), Boolean variable true iff equation is satisfied in ILP, Boolean variable that captures whether an inequality holds.