How to retrieve rescaled h and J values after auto_scale on D-Wave QPU?
Hi,
I'm working on a problem that I solve using a D-Wave QPU, and I have a question regarding auto-scaling of the problem's h
(linear coefficients) and J
(quadratic coefficients) values.
According to the documentation, if the auto_scale parameter is enabled (which it is by default), the h
and J
values of the problem are rescaled to fit the QPU's h_range
and extended_j_range
. I would like to retrieve the rescaled h and J values but have not been able to find a way to accomplish this.
Here is a small example code which I would like to extend to be able to retrieve the rescaled values:
import dimod
import dwave.inspector
from dwave.system import DWaveSampler, EmbeddingComposite
# define problem
bqm = dimod.BQM.from_ising({'a': 0.1, 'b': 0.2, 'c': 0.3}, {'ab': 0.4, 'bc': 0.5, 'ca': 0.6})
# get sampler
sampler = EmbeddingComposite(DWaveSampler())
# sample
sampleset = sampler.sample(bqm, num_reads=100)
One thought that came to my mind was that I might be able to see the rescaled values in the embedded problem using the Problem Inspector:
dwave.inspector.show(bqm, sampleset)
However, it only shows the h and J values that I originally defined, not the rescaled ones. I find this quite strange, as the embedded problem on the Target - QPU should reflect the actual values of the physical problem.
Despite these attempts, I haven't been able to retrieve the actual post-scaling h
and J
values that are used on the physical qubits.
In summary, I have two questions:
- I would like to find a way to retrieve the actual rescaled h and J values that are used on the physical qubits.
- Is there an explanation as to why the Problem Inspector on the Target - QPU only shows the unscaled values, rather than the rescaled ones?
Any help would be greatly appreciated!
Thanks in advance!
Comments
Hello,
There currently exists a feature request to include the scalar used for auto-scaling in the SampleSet returned by the SAPI endpoint.
For the time being, running the following code will calculate the default scalar value for a given BQM:
Hopefully this was helpful.
Please let us know if you have any questions.
Please sign in to leave a comment.