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

fixed qubit overflow error by placing error catching mechanism before… #264

Merged
merged 4 commits into from
Jul 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/openqaoa-core/openqaoa/algorithms/baseworkflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,13 @@ def compile(self, problem: QUBO):
assert isinstance(problem, QUBO), "The problem must be converted into QUBO form"
self.problem = problem

if hasattr(self.device, "n_qubits"):
if self.device.n_qubits < self.problem.n:
raise Exception(
f"The number of qubits {self.problem.n} is more than the number of qubits available on the device."
f"{self.device.name} features f{self.device.n_qubits} qubits"
)

# the atomic id is generated every time that it is compiled
self.header["atomic_id"] = generate_uuid()

Expand Down