-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose submitted problem ID from LeapHybridNLSampler
#528
Comments
Is the Problem ID referred in this issue, the problem_data_id from here in line 945?
If that's the case, one still slightly ugly but backwards compatible way might be to have a simple wrapper for the SampleResult class:
The updated code would be:
and then slightly update the collect function:
Right now it returns LeapHybridNLSampler.SampleResult(model, timing). The update would need to be:
This method doesn't effect any past uses and introduces no changes to existing fields or variables. |
No, it's the problem ID as returned by SAPI on sampling job submit. We refer to |
I see, hope I'm not hogging up the comments of this issue - would we be able to do sampler.properties['problem_id'] and then pass that to the SampleResult wrapper from the previous comment to still maintain all current uses of SampleResult and its fields? |
No,
To retrieve it, you can use dwave-system/dwave/system/samplers/leap_hybrid_sampler.py Lines 955 to 961 in 1bb84c6
to look like: def collect():
timing = future.timing
problem_id = future.wait_id()
...
# store problem_id in the result |
I see, thank you! In that case, could we get the problem_id in collect as shown above and then rather than returning 'LeapHybridNLSampler.SampleResult(model, timing)', return using the SampleResult wrapper? All code changes would look like this:
|
Unfortunately, a
is a valid assignment. That's why adding a third attribute would break backwards compatibility. But looks like we'll have to break it in the end if we want to return problem metadata like the id, label, etc. |
I see, that makes sense. |
Problem ID is available in
SampleSet.info
for other solver/samplers, but not in theLeapHybridNLSampler.SampleResult
named tuple.One option is to expand the
SampleResult
tuple with a third field,info
, but that breaks backward compatibility.Another option is to generalize the
timing
field, but that again breaks compatibility if the field is renamed.So the only "safe" option is to tuck
problem_id
in thetiming
dict, but that's too ugly.The text was updated successfully, but these errors were encountered: