Skip to content
This repository has been archived by the owner on Jan 26, 2023. It is now read-only.

Documentation example needs clarification or is incorrect. #133

Open
richardkmichael opened this issue Oct 10, 2018 · 1 comment
Open

Documentation example needs clarification or is incorrect. #133

richardkmichael opened this issue Oct 10, 2018 · 1 comment

Comments

@richardkmichael
Copy link

richardkmichael commented Oct 10, 2018

While simplifying code trying to understand a different issue, I tried to run the trivial example here:

https://github.com/dwavesystems/qbsolv/blob/0.2.9/python/dwave_qbsolv/dimod_wrapper.py#L75-L81

However, the response has no energies attribute.

I don't actually use this code in my project, but I would like to understand what I've done wrong; or, perhaps the example is incorrect.

(If it helps, looking at the history, the example went in at 11745cd back when the response was a dimod BinaryResponse. It is now a Response. I'm using qbsolv 0.2.9, but I don't see any thing since then on master which might be related.)

Including the qbsolv import, my entire code is:

from dwave_qbsolv import QBSolv

Q = {(0, 0): 1, (1, 1): 1, (0, 1): 1}
r = QBSolv().sample_qubo(Q)

s = list(r.samples())
print(s)

e = list(r.energies()) # ==> AttributeError
print(e)

Apologies for by-passing your issues template. :) If I should ask about this elsewhere, please let me know.

@arcondello
Copy link
Member

Hi, thanks for the bug report! We'll update the example. For now, the instead of e = list(r.energies()) try e = list(r.record.energy)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants