Replace any self-loops in the objective or constraints.

Self-loop $$i^2$$ is removed by introducing a new variable $$j$$ with interaction $$i*j$$ and adding constraint $$j == i$$.

Acts on the objective and constraints in-place.

Returns

Mapping from the integer variable labels to their introduced counterparts. The constraint enforcing $$j == i$$ uses the same label.

Examples

>>> from dimod import Integer, ConstrainedQuadraticModel
>>> i = Integer('i')