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

CompleteMeasFitter leads to error in QuantumInstance #6774

Closed
lasys opened this issue Jul 20, 2021 · 0 comments · Fixed by #6782
Closed

CompleteMeasFitter leads to error in QuantumInstance #6774

lasys opened this issue Jul 20, 2021 · 0 comments · Fixed by #6782
Assignees
Labels
bug Something isn't working mod: algorithms Related to the Algorithms module priority: high stable backport potential The bug might be minimal and/or import enough to be port to stable
Milestone

Comments

@lasys
Copy link

lasys commented Jul 20, 2021

Information

  • Qiskit Terra version: 0.18.0
  • Qiskit version: 0.28.0
  • Python version: 3.6.9
  • Operating system: Linux

What is the current behavior?

quantum_instance = QuantumInstance( 
                                        backend=Aer.get_backend('qasm_simulator'), 
                                        shots=8000,
                                        noise_model=noise_model,
                                        coupling_map=coupling_map,
                                        basis_gates=basis_gates,
                                        measurement_error_mitigation_cls=CompleteMeasFitter,
                                        measurement_error_mitigation_shots=8000
                                      )         
 

leads to:

~/.local/lib/python3.6/site-packages/qiskit/utils/quantum_instance.py in execute(self, circuits, had_transpiled)
    608                     if curr_qubit_index == qubit_index:
    609                         tmp_fitter = meas_error_mitigation_fitter
--> 610                     elif isinstance(meas_error_mitigation_fitter, CompleteMeasFitter):
    611                         tmp_fitter = meas_error_mitigation_fitter.subset_fitter(curr_qubit_index)
    612                     else:

UnboundLocalError: local variable 'CompleteMeasFitter' referenced before assignment

Steps to reproduce the problem

    quantum_instance = QuantumInstance( 
                                        backend=Aer.get_backend('qasm_simulator'), 
                                        shots=8000,
                                        noise_model=noise_model,
                                        coupling_map=coupling_map,
                                        basis_gates=basis_gates,
                                        measurement_error_mitigation_cls=CompleteMeasFitter,
                                        measurement_error_mitigation_shots=8000
                                      )                 
    
    qaoa = QAOA(optimizer=optimizer, 
                quantum_instance=quantum_instance, 
                reps=reps,
                initial_point=init_parameters) 

    algorithm = MinimumEigenOptimizer(qaoa)
    result = algorithm.solve(problem)

What is the expected behavior?

No error message.
Same code is working fine with terra version 0.17.4 on Qiskit version 0.27.0.

Suggested solutions

None, but error only occurs when coupling_map and/or basis_gates are set.

@lasys lasys added the bug Something isn't working label Jul 20, 2021
@mtreinish mtreinish added the stable backport potential The bug might be minimal and/or import enough to be port to stable label Jul 20, 2021
@mtreinish mtreinish added this to the 0.19 milestone Jul 20, 2021
@woodsp-ibm woodsp-ibm added the mod: algorithms Related to the Algorithms module label Jul 20, 2021
@manoelmarques manoelmarques self-assigned this Jul 20, 2021
@mergify mergify bot closed this as completed in #6782 Jul 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mod: algorithms Related to the Algorithms module priority: high stable backport potential The bug might be minimal and/or import enough to be port to stable
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants