Self-loop $$i^2$$ is removed by introducing a new variable $$j$$ with interaction $$i*j$$ and adding constraint $$j == i$$.
Mapping from the integer variable labels to their introduced counterparts. The constraint enforcing $$j == i$$ uses the same label.