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

Mapper bug in version 0.5.2? #492

Closed
rraymondhp opened this issue May 22, 2018 · 4 comments
Closed

Mapper bug in version 0.5.2? #492

rraymondhp opened this issue May 22, 2018 · 4 comments
Labels
bug Something isn't working

Comments

@rraymondhp
Copy link
Contributor

rraymondhp commented May 22, 2018

When running this Grover-search tutorial to compile on ibmqx5,
https://github.com/rraymondhp/qiskit-tutorial/blob/ba1d80923fc02234f1fadda7be996bdd6fb4c712/reference/algorithms/grover_algorithm.ipynb

I encountered this error:

---------------------------------------------------------------------------
MapperError                               Traceback (most recent call last)
<ipython-input-9-3599bcf8da3e> in <module>()
     33 print(backend_coupling)
     34 
---> 35 compiled_circuit = qp.compile([circuitName], backend=backend, coupling_map=backend_coupling)
     36 compiled_qasm = qp.get_compiled_qasm(compiled_circuit, circuitName)
     37 print("Number of gates at ", circuitName, " circuit is ", len(compiled_qasm.split("\n")) - 4)

~/miniconda3/envs/QISKitenv/lib/python3.6/site-packages/qiskit/_quantumprogram.py in compile(self, name_of_circuits, backend, config, basis_gates, coupling_map, initial_layout, shots, max_credits, seed, qobj_id, hpc, skip_translation)
    990                                       config, basis_gates, coupling_map, initial_layout,
    991                                       shots, max_credits, seed, qobj_id, hpc,
--> 992                                       skip_translation)
    993         return qobj
    994 

~/miniconda3/envs/QISKitenv/lib/python3.6/site-packages/qiskit/wrapper/_wrapper.py in compile(circuits, backend, config, basis_gates, coupling_map, initial_layout, shots, max_credits, seed, qobj_id, hpc, skip_translation)
    167                                     config, basis_gates, coupling_map, initial_layout,
    168                                     shots, max_credits, seed, qobj_id, hpc,
--> 169                                     skip_translation)
    170 
    171 

~/miniconda3/envs/QISKitenv/lib/python3.6/site-packages/qiskit/_compiler.py in compile(circuits, backend, config, basis_gates, coupling_map, initial_layout, shots, max_credits, seed, qobj_id, hpc, skip_translation)
    148                 coupling_map=coupling_map,
    149                 initial_layout=initial_layout,
--> 150                 get_layout=True)
    151             # Map the layout to a format that can be json encoded
    152             list_layout = None

~/miniconda3/envs/QISKitenv/lib/python3.6/site-packages/qiskit/_compiler.py in compile_circuit(quantum_circuit, basis_gates, coupling_map, initial_layout, get_layout, format)
    228         logger.info("initial layout: %s", initial_layout)
    229         compiled_dag_circuit, final_layout = swap_mapper(
--> 230             compiled_dag_circuit, coupling, initial_layout, trials=20, seed=13)
    231         logger.info("final layout: %s", final_layout)
    232         # Expand swaps

~/miniconda3/envs/QISKitenv/lib/python3.6/site-packages/qiskit/mapper/_mapping.py in swap_mapper(circuit_graph, coupling_graph, initial_layout, basis, trials, seed)
    471             if k not in circ_qubits:
    472                 raise MapperError("initial_layout qubit %s[%d] not in input "
--> 473                                   "DAGCircuit" % (k[0], k[1]))
    474             if v not in coup_qubits:
    475                 raise MapperError("initial_layout qubit %s[%d] not in input "

MapperError: 'initial_layout qubit f_in[3] not in input DAGCircuit'

Expected Behavior

Should be no MapperError as the simulator (version 0.5.2) and all backends of version 0.4.15 can run without problem.

Current Behavior

See the error message above.

Possible Solution

Steps to Reproduce (for bugs)

Context

Your Environment

  • Version used: qiskit 0.5.2
  • Environment name and version (e.g. Python 3.6.1): Python 3.6.x
  • Operating System and version: MacOSX
@nonhermitian
Copy link
Contributor

Will look into it.

@nonhermitian
Copy link
Contributor

See #494 for a fix.

@rraymondhp
Copy link
Contributor Author

Thanks for the quick response!

diego-plan9 pushed a commit that referenced this issue May 23, 2018
* Fix mapping error for multipl qreg.

* better unittest
@diego-plan9
Copy link
Member

Fixed by #494

@diego-plan9 diego-plan9 added the bug Something isn't working label May 23, 2018
lia-approves pushed a commit to edasgupta/qiskit-terra that referenced this issue Jul 30, 2019
* Fix mapping error for multipl qreg.

* better unittest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants