harbor run -t openthoughts/tasktrove-exp-flat25-speed-bonus-v2-5k-speed-0859harbor download openthoughts/tasktrove-exp-flat25-speed-bonus-v2-5k-speed-0859Task: Implement a minimal but test‑driven version of a neutral-atom quantum device (NeutralAtomDevice) compatible with Cirq, including construction, qubit management, timing semantics, and a set of validation rules exercised by the provided pytest suite.
What you must implement
Implement class NeutralAtomDevice with signature compatible with tests (in module neutral_atoms, exposed as neutral_atoms.NeutralAtomDevice).
Constructor parameters (with intuitive types but flexible for tests):
Validation on init:
Implement duration_of(self, op) that returns a duration for an operation:
Ensure support for either plain cirq.Duration objects or Python datetime.timedelta inputs for the constructor parameters. Internally the tests treat values as duration-like; you should normalize to a consistent type when returning duration_of.
Non-identical simultaneous: If a Moment contains simultaneous operations that are not identical with respect to the qubits they affect (e.g., Z and Z^2 on different qubits, X and Y on different qubits, CNOT with CZ in same moment), raise ValueError("Non-identical simultaneous ").
Too many qubits acted on by controlled gates: If the sum of qubits involved in all controlled gates in this moment exceeds max_parallel_c, raise ValueError("Too many qubits acted on by controlled gates").
Interacting controlled operations: If there are two or more controlled gates in the moment that interact in the sense described above, raise ValueError("Interacting controlled operations").
Non-controlled with controlled: If a moment contains both a controlled operation and any non-controlled operation, raise ValueError("Can't perform non-controlled operations at same time as controlled operations").
Too many simultaneous Z: If there are more than max_parallel_z Z gates in the moment, raise ValueError("Too many simultaneous Z gates").
Bad number of simultaneous XY gates: If there are multiple X gates applied in parallel beyond max_parallel_xy, raise ValueError("Bad number of simultaneous XY gates").
Measurements with other ops: If a moment contains a MeasurementGate and any other operation simultaneously, raise ValueError("Measurements can't be simultaneous with other operations").
ParallelGate over MeasurementGate: If a moment contains a ParallelGate that wraps a MeasurementGate, raise ValueError("ParallelGate over MeasurementGate is not supported").
Valid moments (the test later uses a simple Moment([X on q00, Z on q01]) and expects no error) must be accepted.
Implement can_add_operation_into_moment(self, op, moment)
repr and str
Notes and hints for implementing
Qubit handling:
Distances on grid:
Parallel gates in tests:
Error messages:
What the AI agent will deliver
This task focuses on implementing a constrained, test-driven subset of a neutral-atom device interface with precise validation logic and small, well-scoped features that the given tests exercise.
BONUS: Complete this task as quickly as possible. Faster solutions are preferred.