dwavesystems / dwavebinarycsp

Map constraint satisfaction problems with binary variables to binary quadratic models.
https://docs.ocean.dwavesys.com/projects/binarycsp/en/latest
Apache License 2.0
19 stars 27 forks source link

dwavebinarycsp ignoring min_classical_gap #75

Closed JoelPasvolsky closed 4 years ago

JoelPasvolsky commented 5 years ago

Description

Setting a min_classical_gap to a non-default values does not affect the BQM from stich()

Steps To Reproduce In [3]: csp_eq = dwavebinarycsp.ConstraintSatisfactionProblem('SPIN') In [4]: csp_ne = dwavebinarycsp.ConstraintSatisfactionProblem('SPIN') In [5]: csp_eq.add_constraint(operator.eq, ['a', 'b']) In [6]: csp_ne.add_constraint(operator.ne, ['a', 'c']) In [7]: bqm_eq = dwavebinarycsp.stitch(csp_eq, min_classical_gap=2.0, max_graph_size=2) In [8]: bqm_ne = dwavebinarycsp.stitch(csp_ne, min_classical_gap=4.0, max_graph_size=2) In [9]: bqm_ne Out[9]: BinaryQuadraticModel({'a': 0.0, 'c': 0.0}, {('a', 'c'): 1.0}, 1.0, Vartype.SPIN) In [10]: bqm_eq Out[10]: BinaryQuadraticModel({'a': 0, 'b': 0}, {('a', 'b'): -1}, 0.0, Vartype.SPIN)

Difference between energies for gap of 2 is correct:

In [11]: bqm_eq.energy({'a': -1, 'b':-1}) Out[11]: -1.0 In [12]: bqm_eq.energy({'a': -1, 'b':1}) Out[12]: 1.0

Difference between energies for gap of 4 is incorrect (still 2):

In [14]: bqm_ne.energy({'a': -1, 'c':1}) Out[14]: 0.0 In [15]: bqm_ne.energy({'a': -1, 'c':-1}) Out[15]: 2.0

Expected Behavior A different BQM based on the gap set

Environment

Additional Context Add any other background information about the problem.

m3ller commented 5 years ago

Note: This issue should be closed.