diff --git a/requirements.txt b/requirements.txt index 244fc92a..03abc804 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/test/algorithms/qrao/test_quantum_random_access_optimizer.py b/test/algorithms/qrao/test_quantum_random_access_optimizer.py index 6dda3a31..30d0cbbf 100644 --- a/test/algorithms/qrao/test_quantum_random_access_optimizer.py +++ b/test/algorithms/qrao/test_quantum_random_access_optimizer.py @@ -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 @@ -70,7 +70,7 @@ 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) @@ -78,9 +78,13 @@ def test_solve_relaxed_vqe(self): 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)