Skip to content

Commit f8bcd0f

Browse files
committed
Deleted cost estimation unit tests
1 parent d3e350d commit f8bcd0f

File tree

6 files changed

+0
-235
lines changed

6 files changed

+0
-235
lines changed

azure-quantum/azure/quantum/qiskit/backends/ionq.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -241,17 +241,6 @@ def _translate_input(self, circuit):
241241
def gateset(self):
242242
return self.configuration().gateset
243243

244-
def estimate_cost(self, circuit, shots):
245-
"""Estimate the cost for the given circuit."""
246-
ionq_circ, _, _ = qiskit_circ_to_ionq_circ(circuit, gateset=self.gateset())
247-
input_data = {
248-
"qubits": circuit.num_qubits,
249-
"circuit": ionq_circ,
250-
}
251-
workspace = self.provider().get_workspace()
252-
target = workspace.get_targets(self.name())
253-
return target.estimate_cost(input_data, shots=shots)
254-
255244

256245
class IonQSimulatorBackend(IonQBackend):
257246
backend_names = ("ionq.simulator",)

azure-quantum/azure/quantum/qiskit/backends/quantinuum.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -264,33 +264,6 @@ def _translate_input(self, circuit):
264264
"""Translates the input values to the format expected by the AzureBackend."""
265265
return dumps(circuit)
266266

267-
def estimate_cost(
268-
self, circuit: QuantumCircuit, shots: int = None, count: int = None
269-
):
270-
"""Estimate cost for running this circuit
271-
272-
:param circuit: Qiskit quantum circuit
273-
:type circuit: QuantumCircuit
274-
:param shots: Shot count
275-
:type shots: int
276-
:param count: Shot count (alternative to 'shots')
277-
:type count: int
278-
"""
279-
if count is not None:
280-
warnings.warn(
281-
"The 'count' parameter will be deprecated. Please, use 'shots' parameter instead.",
282-
category=DeprecationWarning,
283-
)
284-
shots = count
285-
286-
if shots is None:
287-
raise ValueError("Missing input argument 'shots'.")
288-
289-
input_data = dumps(circuit)
290-
workspace = self.provider().get_workspace()
291-
target = workspace.get_targets(self.name())
292-
return target.estimate_cost(input_data, shots=shots)
293-
294267
def _get_n_qubits(self, name):
295268
return _get_n_qubits(name)
296269

azure-quantum/tests/unit/test_cirq.py

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -121,30 +121,6 @@ def test_plugins_cirq_get_targets(self):
121121
self.assertIn("ionq.simulator", target_names)
122122
self.assertIn("quantinuum.sim.h1-1sc", target_names)
123123

124-
def test_plugins_estimate_cost_cirq_ionq(self):
125-
workspace = self.create_workspace()
126-
service = AzureQuantumService(workspace=workspace)
127-
cost = service.estimate_cost(
128-
program=self._3_qubit_ghz_cirq(),
129-
repetitions=100e3,
130-
target="ionq.simulator"
131-
)
132-
self.assertEqual(cost.estimated_total, 0.0)
133-
134-
cost = service.estimate_cost(
135-
program=self._3_qubit_ghz_cirq(),
136-
repetitions=1024,
137-
target="ionq.qpu.aria-1"
138-
)
139-
self.assertEqual(np.round(cost.estimated_total), 98.0)
140-
141-
cost = service.estimate_cost(
142-
program=self._3_qubit_ghz_cirq(),
143-
repetitions=100e3,
144-
target="ionq.qpu.aria-1"
145-
)
146-
self.assertEqual(np.round(cost.estimated_total), 218.0)
147-
148124
@pytest.mark.live_test
149125
def test_plugins_cirq_nonexistent_target(self):
150126
workspace = self.create_workspace()
@@ -185,38 +161,6 @@ def test_plugins_ionq_cirq(self):
185161
self.assertEqual(result.measurements["q0"].sum(), result.measurements["q1"].sum())
186162
self.assertEqual(result.measurements["q1"].sum(), result.measurements["q2"].sum())
187163

188-
@pytest.mark.quantinuum
189-
def test_plugins_estimate_cost_cirq_quantinuum(self):
190-
workspace = self.create_workspace()
191-
service = AzureQuantumService(workspace=workspace)
192-
cost = service.estimate_cost(
193-
program=self._3_qubit_ghz_cirq(),
194-
repetitions=100e3,
195-
target="quantinuum.sim.h1-1sc"
196-
)
197-
self.assertEqual(cost.estimated_total, 0.0)
198-
199-
cost = service.estimate_cost(
200-
program=self._3_qubit_ghz_cirq(),
201-
repetitions=100e3,
202-
target="quantinuum.sim.h1-1sc"
203-
)
204-
self.assertEqual(cost.estimated_total, 0.0)
205-
206-
cost = service.estimate_cost(
207-
program=self._3_qubit_ghz_cirq(),
208-
repetitions=100e3,
209-
target="quantinuum.sim.h1-1e"
210-
)
211-
self.assertEqual(np.round(cost.estimated_total), 725.0)
212-
213-
cost = service.estimate_cost(
214-
program=self._3_qubit_ghz_cirq(),
215-
repetitions=100e3,
216-
target="quantinuum.qpu.h1-1"
217-
)
218-
self.assertEqual(np.round(cost.estimated_total), 725.0)
219-
220164
@pytest.mark.quantinuum
221165
@pytest.mark.live_test
222166
def test_plugins_quantinuum_cirq(self):

azure-quantum/tests/unit/test_ionq.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,6 @@ def _3_qubit_ghz(self):
3333
]
3434
}
3535

36-
@pytest.mark.ionq
37-
def test_estimate_cost_ionq(self):
38-
workspace = self.create_workspace()
39-
circuit = self._3_qubit_ghz()
40-
target = IonQ(workspace=workspace, name="ionq.simulator")
41-
cost = target.estimate_cost(circuit, shots=100e3)
42-
self.assertEqual(cost.estimated_total, 0.0)
43-
44-
target = IonQ(workspace=workspace, name="ionq.qpu.aria-1")
45-
cost = target.estimate_cost(circuit, shots=100e3)
46-
self.assertEqual(np.round(cost.estimated_total), 218.0)
47-
4836

4937
@pytest.mark.ionq
5038
@pytest.mark.live_test

azure-quantum/tests/unit/test_qiskit.py

Lines changed: 0 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -411,45 +411,6 @@ def test_qiskit_provider_init_without_workspace_raises_deprecation(self):
411411
assert len(warns) == 1
412412
assert issubclass(warns[0].category, DeprecationWarning)
413413

414-
@pytest.mark.ionq
415-
def test_plugins_estimate_cost_qiskit_ionq(self):
416-
circuit = self._3_qubit_ghz()
417-
workspace = self.create_workspace()
418-
provider = AzureQuantumProvider(workspace=workspace)
419-
self.assertIn("azure-quantum-qiskit", provider._workspace.user_agent)
420-
backend = provider.get_backend("ionq.simulator")
421-
self.assertIsInstance(backend, IonQSimulatorQirBackend)
422-
cost = backend.estimate_cost(circuit, shots=100e3)
423-
self.assertEqual(cost.estimated_total, 0.0)
424-
425-
backend = provider.get_backend("ionq.qpu.aria-1")
426-
self.assertIsInstance(backend, IonQAriaQirBackend)
427-
cost = backend.estimate_cost(circuit, shots=1024)
428-
self.assertEqual(np.round(cost.estimated_total), 98.0)
429-
430-
backend = provider.get_backend("ionq.qpu.aria-1")
431-
self.assertIsInstance(backend, IonQAriaQirBackend)
432-
cost = backend.estimate_cost(circuit, shots=100e3)
433-
self.assertEqual(np.round(cost.estimated_total), 240.0)
434-
435-
@pytest.mark.ionq
436-
def test_plugins_estimate_cost_qiskit_ionq_passthrough(self):
437-
circuit = self._3_qubit_ghz()
438-
workspace = self.create_workspace()
439-
provider = AzureQuantumProvider(workspace=workspace)
440-
self.assertIn("azure-quantum-qiskit", provider._workspace.user_agent)
441-
backend = provider.get_backend("ionq.simulator", input_data_format="ionq.circuit.v1", gateset="qis")
442-
cost = backend.estimate_cost(circuit, shots=100e3)
443-
self.assertEqual(cost.estimated_total, 0.0)
444-
445-
backend = provider.get_backend("ionq.qpu.aria-1", input_data_format="ionq.circuit.v1", gateset="qis")
446-
cost = backend.estimate_cost(circuit, shots=1024)
447-
self.assertEqual(np.round(cost.estimated_total), 98.0)
448-
449-
backend = provider.get_backend("ionq.qpu.aria-1", input_data_format="ionq.circuit.v1", gateset="qis")
450-
cost = backend.estimate_cost(circuit, shots=100e3)
451-
self.assertEqual(np.round(cost.estimated_total), 240.0)
452-
453414
@pytest.mark.ionq
454415
@pytest.mark.live_test
455416
def test_plugins_submit_qiskit_to_ionq(self):
@@ -1022,75 +983,6 @@ def test_plugins_retrieve_job(self):
1022983
self.assertAlmostEqual(result.data()["counts"]["000"], 50, delta=20)
1023984
self.assertAlmostEqual(result.data()["counts"]["111"], 50, delta=20)
1024985

1025-
@pytest.mark.quantinuum
1026-
def test_plugins_estimate_cost_qiskit_quantinuum(self):
1027-
circuit = self._3_qubit_ghz()
1028-
workspace = self.create_workspace()
1029-
provider = AzureQuantumProvider(workspace=workspace)
1030-
self.assertIn("azure-quantum-qiskit", provider._workspace.user_agent)
1031-
1032-
backend = provider.get_backend("quantinuum.sim.h1-1sc")
1033-
self.assertIsInstance(backend, QuantinuumQirBackendBase)
1034-
1035-
cost = backend.estimate_cost(circuit, shots=100e3)
1036-
self.assertEqual(cost.estimated_total, 0.0)
1037-
1038-
backend = provider.get_backend("quantinuum.sim.h1-1e")
1039-
self.assertIsInstance(backend, QuantinuumQirBackendBase)
1040-
cost = backend.estimate_cost(circuit, shots=100e3)
1041-
self.assertEqual(cost.estimated_total, 745.0)
1042-
1043-
backend = provider.get_backend("quantinuum.qpu.h1-1")
1044-
self.assertIsInstance(backend, QuantinuumQirBackendBase)
1045-
cost = backend.estimate_cost(circuit, shots=100e3)
1046-
self.assertEqual(cost.estimated_total, 745.0)
1047-
1048-
backend = provider.get_backend("quantinuum.sim.h2-1sc")
1049-
self.assertIsInstance(backend, QuantinuumQirBackendBase)
1050-
cost = backend.estimate_cost(circuit, shots=100e3)
1051-
self.assertEqual(cost.estimated_total, 0.0)
1052-
1053-
backend = provider.get_backend("quantinuum.sim.h2-1e")
1054-
self.assertIsInstance(backend, QuantinuumQirBackendBase)
1055-
cost = backend.estimate_cost(circuit, shots=100e3)
1056-
self.assertEqual(cost.estimated_total, 745.0)
1057-
1058-
backend = provider.get_backend("quantinuum.qpu.h2-1")
1059-
self.assertIsInstance(backend, QuantinuumQirBackendBase)
1060-
cost = backend.estimate_cost(circuit, shots=100e3)
1061-
self.assertEqual(cost.estimated_total, 745.0)
1062-
1063-
@pytest.mark.quantinuum
1064-
def test_plugins_estimate_cost_qiskit_quantinuum_passthrough(self):
1065-
circuit = self._3_qubit_ghz()
1066-
workspace = self.create_workspace()
1067-
provider = AzureQuantumProvider(workspace=workspace)
1068-
self.assertIn("azure-quantum-qiskit", provider._workspace.user_agent)
1069-
1070-
backend = provider.get_backend("quantinuum.sim.h1-1sc", input_data_format="honeywell.openqasm.v1")
1071-
cost = backend.estimate_cost(circuit, shots=100e3)
1072-
self.assertEqual(cost.estimated_total, 0.0)
1073-
1074-
backend = provider.get_backend("quantinuum.sim.h1-1e", input_data_format="honeywell.openqasm.v1")
1075-
cost = backend.estimate_cost(circuit, shots=100e3)
1076-
self.assertEqual(cost.estimated_total, 745.0)
1077-
1078-
backend = provider.get_backend("quantinuum.qpu.h1-1", input_data_format="honeywell.openqasm.v1")
1079-
cost = backend.estimate_cost(circuit, shots=100e3)
1080-
self.assertEqual(cost.estimated_total, 745.0)
1081-
1082-
backend = provider.get_backend("quantinuum.sim.h2-1sc", input_data_format="honeywell.openqasm.v1")
1083-
cost = backend.estimate_cost(circuit, shots=100e3)
1084-
self.assertEqual(cost.estimated_total, 0.0)
1085-
1086-
backend = provider.get_backend("quantinuum.sim.h2-1e", input_data_format="honeywell.openqasm.v1")
1087-
cost = backend.estimate_cost(circuit, shots=100e3)
1088-
self.assertEqual(cost.estimated_total, 745.0)
1089-
1090-
backend = provider.get_backend("quantinuum.qpu.h2-1", input_data_format="honeywell.openqasm.v1")
1091-
cost = backend.estimate_cost(circuit, shots=100e3)
1092-
self.assertEqual(cost.estimated_total, 745.0)
1093-
1094986
@pytest.mark.live_test
1095987
def test_plugins_submit_qiskit_noexistent_target(self):
1096988
workspace = self.create_workspace()

azure-quantum/tests/unit/test_quantinuum.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,27 +34,6 @@ def _teleport(self):
3434
measure q[1] -> c2[0];
3535
"""
3636

37-
@pytest.mark.quantinuum
38-
def test_job_estimate_cost_quantinuum(self):
39-
workspace = self.create_workspace()
40-
circuit = self._teleport()
41-
42-
target = Quantinuum(workspace=workspace, name="quantinuum.sim.h1-1sc")
43-
cost = target.estimate_cost(circuit, shots=100e3)
44-
self.assertEqual(cost.estimated_total, 0.0)
45-
46-
target = Quantinuum(workspace=workspace, name="quantinuum.qpu.h1-1")
47-
cost = target.estimate_cost(circuit, shots=100e3)
48-
self.assertEqual(cost.estimated_total, 845.0)
49-
50-
target = Quantinuum(workspace=workspace, name="quantinuum.sim.h2-1sc")
51-
cost = target.estimate_cost(circuit, shots=100e3)
52-
self.assertEqual(cost.estimated_total, 0.0)
53-
54-
target = Quantinuum(workspace=workspace, name="quantinuum.qpu.h2-1")
55-
cost = target.estimate_cost(circuit, shots=100e3)
56-
self.assertEqual(cost.estimated_total, 845.0)
57-
5837
@pytest.mark.quantinuum
5938
@pytest.mark.live_test
6039
def test_job_submit_quantinuum(self):

0 commit comments

Comments
 (0)