Skip to content

Commit

Permalink
Fix environment
Browse files Browse the repository at this point in the history
  • Loading branch information
Gistbatch committed Mar 20, 2024
1 parent b69eac1 commit f652a48
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/scheduling/common/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ def convert_to_proxy(
n_shots=n_shots,
noise=noise,
)
preference = predict_device(tmp_circuit, [str(acc.uuid) for acc in accelerators])
preference = predict_device(
tmp_circuit, [str(acc.uuid) for acc in accelerators if acc is not None]
)
if isinstance(circuit, QuantumCircuit):
proxy.preselection = processing_time
return proxy
Expand Down
6 changes: 3 additions & 3 deletions src/scheduling/learning/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ def reset(
],
np.inf,
)
for proxy in self.circuits:
assert isinstance(proxy, CircuitProxy)
for circuit in self.circuits:
proxy = convert_circuits([circuit], self.accelerators)[0]
choice = next(
(
idx
Expand Down Expand Up @@ -216,7 +216,7 @@ def _get_info(self) -> dict[str, Any]:
for bucket in machine.buckets
]
for machine in self._schedule.machines
} + {"schedule": self._schedule}
} | {"schedule": self._schedule}

def _calculate_reward(self, completion_time: float, expected_noise: float) -> float:
# Calculate the reward based on the completion time and expected noise
Expand Down

0 comments on commit f652a48

Please sign in to comment.