Skip to content
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

qaoa.py instance is used incorrectly in max_cut example in pyqaoa #172

Open
Epulsar opened this issue Jul 24, 2018 · 0 comments
Open

qaoa.py instance is used incorrectly in max_cut example in pyqaoa #172

Epulsar opened this issue Jul 24, 2018 · 0 comments

Comments

@Epulsar
Copy link

Epulsar commented Jul 24, 2018

The example max cut optimization problem given at https://github.com/rigetticomputing/grove/tree/master/grove/pyqaoa gives this error when I run it:
Traceback (most recent call last):
File "pyquil_optimization_test.py", line 24, in
for state_index in range(2**inst.n_qubits):
AttributeError: 'QAOA' object has no attribute 'n_qubits'

This makes sense because the instance used in qaoa.py is actually qubits, not n_qubits.
Then I would get this error after that correction:
Traceback (most recent call last):
File "pyquil_optimization_test.py", line 24, in
for state_index in range(2**inst.qubits):
TypeError: unsupported operand type(s) for ** or pow(): 'int' and 'list'

If I am not mistaken, the example under the directory pyqaoa should have this modification:
for state_index in range(2**len(inst.qubits)):
print inst.states[state_index], np.conj(wf[state_index])*wf[state_index]

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

No branches or pull requests

1 participant