dwavesystems / dwave-system

An API for easily incorporating the D-Wave system as a sampler, either directly or through Leap's cloud-based hybrid samplers
https://docs.ocean.dwavesys.com/
Apache License 2.0
87 stars 61 forks source link

ReverseBatchStatesComposite error on num_reads #516

Closed JoelPasvolsky closed 1 month ago

JoelPasvolsky commented 2 months ago

Description Using the ReverseBatchStatesComposite produces an error,

SolverFailureError: The parameter num_reads must be a positive integer.

To Reproduce Use this example.

Environment:

Additional context Raised by @axel-GHB for a user.

The unit tests for ReverseBatchStateComposite use a MockReverseSampler() that uses dimod.ExactSolver() under the hood, and ExactSolver() ignores the num_reads parameter so this problem will not get caught by dwave_system's unit testing. When I run the unit tests using EmbeddingComposite(DWaveSampler()) instead of ExactSolver I get the same error

Line 334 produces an array,

>>> aggreg.record.num_occurrences
array([1, 1])

that goes into num_reads and the child sampler does not handle.

arcondello commented 2 months ago

I think it might actually be better to just remove that entire if branch https://github.com/dwavesystems/dwave-system/blob/e8946dd7a12f0c73a3a1e5d2043e287174d90c40/dwave/system/composites/reversecomposite.py#L330-L334 I am not sure that it's providing much value.