Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

Commit

Permalink
Merge branch 'uncertainty-models-using-circuits' of github.com:Cryori…
Browse files Browse the repository at this point in the history
…s/qiskit-aqua into uncertainty-models-using-circuits
  • Loading branch information
Cryoris committed Apr 21, 2020
2 parents 5cbb3ee + 3ba7e1c commit 319f3fa
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 11 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

notifications:
email:
if: fork = false AND type = cron
recipients:
- manoel@us.ibm.com
on_success: never
Expand Down
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Changelog](http://keepachangelog.com/en/1.0.0/).
> - **Fixed**: for any bug fixes.
> - **Security**: in case of vulnerabilities.
[UNRELEASED](https://github.com/Qiskit/qiskit-aqua/compare/0.6.5...HEAD)
[UNRELEASED](https://github.com/Qiskit/qiskit-aqua/compare/0.6.6...HEAD)
========================================================================

Added
Expand All @@ -36,6 +36,8 @@ Changed
- Classical algorithms renamed, former names deprecated (#851)
- Chemistry process algorithm result returns result object, lines, dict return deprecated (#861)
- Measurement error mitigation supports different output orders on same qubits (#865)
- If ibmq-provider is used and job limit is reached, `run_circuit` now waits for a previous job
to finish before submitting the next one. (#906)

Removed
-------
Expand All @@ -55,6 +57,15 @@ Fixed
side of constraints for the DOcplex translator (#750)
- WeightedPauliOperator constructor simplification bug (#891)

[0.6.6](https://github.com/Qiskit/qiskit-aqua/compare/0.6.5...0.6.6) - 2020-04-16
=================================================================================

Removed
-------

- Remove backend and PassManager on compiler transpile calls (#882)
- Remove transpile calls and use unroller (#883)

[0.6.5](https://github.com/Qiskit/qiskit-aqua/compare/0.6.4...0.6.5) - 2020-03-16
=================================================================================

Expand Down
4 changes: 2 additions & 2 deletions qiskit/aqua/operators/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def measure_pauli_z(data, pauli):
num_shots = sum(data.values())
p_z_or_x = np.logical_or(pauli.z, pauli.x)
for key, value in data.items():
bitstr = np.asarray(list(key))[::-1].astype(np.bool)
bitstr = np.asarray(list(key))[::-1].astype(np.int).astype(np.bool)
# pylint: disable=no-member
sign = -1.0 if np.logical_xor.reduce(np.logical_and(bitstr, p_z_or_x)) else 1.0
observable += sign * value
Expand Down Expand Up @@ -107,7 +107,7 @@ def covariance(data, pauli_1, pauli_2, avg_1, avg_2):
p1_z_or_x = np.logical_or(pauli_1.z, pauli_1.x)
p2_z_or_x = np.logical_or(pauli_2.z, pauli_2.x)
for key, value in data.items():
bitstr = np.asarray(list(key))[::-1].astype(np.bool)
bitstr = np.asarray(list(key))[::-1].astype(np.int).astype(np.bool)
# pylint: disable=no-member
sign_1 = -1.0 if np.logical_xor.reduce(np.logical_and(bitstr, p1_z_or_x)) else 1.0
sign_2 = -1.0 if np.logical_xor.reduce(np.logical_and(bitstr, p2_z_or_x)) else 1.0
Expand Down
23 changes: 17 additions & 6 deletions qiskit/aqua/utils/run_circuits.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@
from qiskit.providers.jobstatus import JOB_FINAL_STATES
from qiskit.providers.basicaer import BasicAerJob
from qiskit.qobj import QasmQobj
from qiskit.exceptions import QiskitError
from qiskit.aqua.aqua_error import AquaError
from qiskit.aqua.utils.backend_utils import (is_aer_provider,
is_basicaer_provider,
is_simulator_backend,
is_local_backend)
is_local_backend,
is_ibmq_provider)

MAX_CIRCUITS_PER_JOB = os.environ.get('QISKIT_AQUA_MAX_CIRCUITS_PER_JOB', None)
MAX_GATES_PER_JOB = os.environ.get('QISKIT_AQUA_MAX_GATES_PER_JOB', None)
Expand Down Expand Up @@ -134,15 +136,24 @@ def _maybe_split_qobj_by_gates(qobjs, qobj):
def _safe_submit_qobj(qobj, backend, backend_options, noise_config, skip_qobj_validation):
# assure get job ids
while True:
job = run_on_backend(backend, qobj, backend_options=backend_options,
noise_config=noise_config,
skip_qobj_validation=skip_qobj_validation)
try:
job = run_on_backend(backend, qobj, backend_options=backend_options,
noise_config=noise_config,
skip_qobj_validation=skip_qobj_validation)
job_id = job.job_id()
break
except JobError as ex:
logger.warning("FAILURE: Can not get job id, Resubmit the qobj to get job id."
except QiskitError as ex:
logger.warning("FAILURE: Can not get job id, Resubmit the qobj to get job id. "
"Terra job error: %s ", ex)
if is_ibmq_provider(backend) and 'Error code: 3458' in str(ex):
# TODO Use IBMQBackendJobLimitError when new IBM Q provider is released.
oldest_running = backend.jobs(limit=1, descending=False,
status=['QUEUED', 'VALIDATING', 'RUNNING'])
if oldest_running:
oldest_running = oldest_running[0]
logger.warning("Job limit reached, waiting for job %s to finish "
"before submitting the next one.", oldest_running.job_id())
oldest_running.wait_for_final_state(timeout=300)
except Exception as ex: # pylint: disable=broad-except
logger.warning("FAILURE: Can not get job id, Resubmit the qobj to get job id."
"Error: %s ", ex)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
qiskit-terra>=0.11.0
qiskit-terra>=0.13.0
qiskit-ignis>=0.2.0
scipy>=1.0
sympy>=1.3
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
Qiskit Finance, Qiskit Machine Learning and Qiskit Optimization to experiment with real-world applications to quantum computing."""

requirements = [
"qiskit-terra>=0.11.0",
"qiskit-terra>=0.13.0",
"qiskit-ignis>=0.2.0",
"scipy>=1.0",
"sympy>=1.3",
Expand Down

0 comments on commit 319f3fa

Please sign in to comment.