dwavesystems/dimod

Update `BQM.add_linear_equality_constraint()` to take into account the minimal activation of the constraint

arcondello opened this issue · 1 comments

For linear equality constraints like $\sum_i x_i a_i = 0$ such that $a_i >= 0$ $\forall i$, I think we can just do $E(x) = objective(x) + \alpha (\sum_i x_i a_i )$ rather than $E(x) = objective(x) + \alpha (\sum_i x_i a_i ) ^2 $. This obviously results in far fewer quadratic terms, although the penalty is applied linearly rather than quadratically. It would be nice to handle this case, either automatically or via a keyword argument.

Though, thinking more about that, $\sum_i x_i a_i = 0$ is trivially satisfied when $x_i = 0$. Closing...