10000 qaoa.py instance is used incorrectly in max_cut example in pyqaoa · Issue #172 · rigetti/grove · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
qaoa.py instance is used incorrectly in max_cut example in pyqaoa #172
Open
@Epulsar

Description

@Epulsar

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0