Skip to content

Commit

Permalink
Merge branch 'main' into fix-magic-rounding
Browse files Browse the repository at this point in the history
  • Loading branch information
t-imamichi authored Aug 7, 2024
2 parents 2ea65a8 + 65702ea commit fdb4af0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ jobs:
pip install pyenchant
echo "earliest_version: 0.1.0" >> releasenotes/config.yaml
shell: bash
- run: pip check
- name: Run pip check
run: |
pip install "pip<24.2"
pip check
if: ${{ !cancelled() }}
shell: bash
- name: Copyright Check
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
qiskit>=0.44
qiskit-algorithms>=0.2.0
scipy>=1.9.0,<1.14
numpy>=1.17,<2
numpy>=1.17
docplex>=2.21.207,!=2.24.231
setuptools>=40.1.0
networkx>=2.6.3
14 changes: 9 additions & 5 deletions test/algorithms/qrao/test_quantum_random_access_optimizer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of a Qiskit project.
#
# (C) Copyright IBM 2023.
# (C) Copyright IBM 2023, 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand Down Expand Up @@ -70,17 +70,21 @@ def test_solve_relaxed_vqe(self):
"""Test QuantumRandomAccessOptimizer with VQE."""
vqe = VQE(
ansatz=self.ansatz,
optimizer=COBYLA(),
optimizer=COBYLA(tol=1e-6),
estimator=Estimator(),
)
qrao = QuantumRandomAccessOptimizer(min_eigen_solver=vqe)
relaxed_results, rounding_context = qrao.solve_relaxed(encoding=self.encoding)
self.assertIsInstance(relaxed_results, VQEResult)
self.assertAlmostEqual(relaxed_results.eigenvalue, -2.73861, delta=1e-4)
self.assertEqual(len(relaxed_results.aux_operators_evaluated), 3)
self.assertAlmostEqual(relaxed_results.aux_operators_evaluated[0][0], 0.31632, delta=1e-4)
self.assertAlmostEqual(relaxed_results.aux_operators_evaluated[1][0], 0, delta=1e-4)
self.assertAlmostEqual(relaxed_results.aux_operators_evaluated[2][0], 0.94865, delta=1e-4)
self.assertAlmostEqual(
relaxed_results.aux_operators_evaluated[0][0].item(), 0.31632, delta=1e-4
)
self.assertAlmostEqual(relaxed_results.aux_operators_evaluated[1][0].item(), 0, delta=1e-4)
self.assertAlmostEqual(
relaxed_results.aux_operators_evaluated[2][0].item(), 0.94865, delta=1e-4
)
self.assertIsInstance(rounding_context, RoundingContext)
self.assertEqual(rounding_context.circuit.num_qubits, self.ansatz.num_qubits)
self.assertEqual(rounding_context.encoding, self.encoding)
Expand Down

0 comments on commit fdb4af0

Please sign in to comment.