You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Application
The terms of a BinaryPolynomial are implemented with frozenset.
Python sets are unordered in a non-deterministic way. This leads to some interesting behavior that propagates to the related functions, reduce_binary_polynomial and make_quadratic_cqm.
Within a python invocation, it is possible to produce the same CQM model repeatedly, given the same BinaryPolynomial object.
This changes from run to run though, see this post on stackoverflow. This can lead to CQM models with different variables and constraints given the same BinaryPolynomial, or different reduced terms and constraints being returned from reduce_binary_polynomial.
It would be useful to be able to produce the same reduction results from run to run, rather than having to fix an environment variable to force the behavior.
Proposed Solution
Rework BinaryPolynomial and related functions to avoid sets - or possibly use something like an ordered set instead.
Alternatives Considered
Setting the environment variable PYTHONHASHSEED makes set iteration deterministic. This has to be done prior to invoking Python.
The text was updated successfully, but these errors were encountered:
Application
The terms of a
BinaryPolynomial
are implemented withfrozenset
.Python sets are unordered in a non-deterministic way. This leads to some interesting behavior that propagates to the related functions,
reduce_binary_polynomial
andmake_quadratic_cqm
.Within a python invocation, it is possible to produce the same CQM model repeatedly, given the same
BinaryPolynomial
object.This changes from run to run though, see this post on stackoverflow. This can lead to CQM models with different variables and constraints given the same
BinaryPolynomial
, or different reduced terms and constraints being returned fromreduce_binary_polynomial
.It would be useful to be able to produce the same reduction results from run to run, rather than having to fix an environment variable to force the behavior.
Proposed Solution
Rework
BinaryPolynomial
and related functions to avoid sets - or possibly use something like an ordered set instead.Alternatives Considered
Setting the environment variable
PYTHONHASHSEED
makes set iteration deterministic. This has to be done prior to invoking Python.The text was updated successfully, but these errors were encountered: