Skip to content

Optimal Control Toy Problems

This notebook guide specifies a reproducible toy problem in open-system quantum control. The baseline task is to drive a single qubit toward a target rotation or target state while pure dephasing acts during the pulse. The notebook should compare simple pulse families, optimize a small number of parameters, and report fidelity as the dephasing strength is varied. For the conceptual page on objectives, constraints, gradients, and robustness, see Optimal Control.

As of this review, no executable notebook under notebooks/density-open-systems/optimal-control-toy-problems/ is promoted as a reproduced artifact. This page is the admission contract for that notebook: it states the model, objective functions, optimization rules, robustness checks, validation tests, and accepted outputs required before pulse-optimization results should be cited.

The notebook should demonstrate how to:

  • build a driven two-level Hamiltonian with declared rotating-frame conventions;
  • include Markovian pure dephasing during the control pulse;
  • compare an analytic square-pulse baseline with shaped or piecewise-constant pulses;
  • optimize pulse parameters under amplitude and smoothness constraints;
  • evaluate final-state and gate-style fidelities;
  • sweep dephasing strength and detuning to test robustness;
  • distinguish physical limitations from optimizer failure;
  • record enough numerical metadata that another reader can reproduce the result.

The first version should use a single qubit. Multi-qubit gates, leakage levels, hardware transfer functions, closed-loop laboratory calibration, and gradient-based high-dimensional optimal control should wait until this toy problem is validated.

Use a dedicated directory:

notebooks/density-open-systems/optimal-control-toy-problems/
optimal-control-toy-problems.ipynb
README.md

The opening notebook cell or README.md should state:

  • Python and package versions;
  • basis ordering and Pauli convention;
  • rotating-frame Hamiltonian convention;
  • whether angular frequencies or ordinary frequencies are used;
  • pulse parametrization and amplitude bounds;
  • solver method, time grid, and tolerances;
  • optimizer, stopping criteria, random seed, and initial guesses;
  • fidelity definition and validation cases;
  • date and commit identifier when the notebook is promoted.

Use a rotating-frame Hamiltonian

H(t)ℏ=Δ2σz+Ωx(t)2σx+Ωy(t)2σy.\frac{H(t)}{\hbar} = \frac{\Delta}{2}\sigma_z + \frac{\Omega_x(t)}{2}\sigma_x + \frac{\Omega_y(t)}{2}\sigma_y .

Here Δ\Delta is the detuning and Ωx(t)\Omega_x(t), Ωy(t)\Omega_y(t) are quadrature controls. With pure dephasing, the density matrix evolves as

dρdt=−iℏ[H(t),ρ]+Γϕ2(σzρσz−ρ).\frac{d\rho}{dt} = - \frac{i}{\hbar} [H(t),\rho] + \frac{\Gamma_\phi}{2} \left( \sigma_z\rho\sigma_z-\rho \right).

This convention makes the off-diagonal element decay as

ρ01(t)=e−Γϕtρ01(0)\rho_{01}(t) = e^{-\Gamma_\phi t} \rho_{01}(0)

when the Hamiltonian is absent. The notebook should verify this limit before any pulse optimization is trusted.

Implement two target tasks.

Prepare

ρ0=∣0⟩⟨0∣\rho_0 = \lvert0\rangle\langle0\rvert

and maximize population in ∣1⟩\lvert1\rangle at final time TT:

Fst=⟨1∣ρ(T)∣1⟩.F_{\mathrm{st}} = \langle1\rvert\rho(T)\lvert1\rangle .

This is the simplest objective because it can be checked directly from the final density matrix. It does not certify a full gate, but it is an excellent first test of solver and pulse conventions.

For a more demanding test, compare the noisy final channel ET\mathcal E_T with the target unitary rotation

Utgt=Rx(π)=e−iπσx/2.U_{\mathrm{tgt}} = R_x(\pi) = e^{-i\pi\sigma_x/2}.

The notebook may compute an average gate fidelity from Choi matrices or from a standard finite-dimensional formula, but it must state the convention. A lower-risk first implementation is to average state fidelities over the six Pauli-axis pure states:

S6={I±σx2,I±σy2,I±σz2}.\mathcal S_6 = \left\{ \frac{I\pm\sigma_x}{2}, \frac{I\pm\sigma_y}{2}, \frac{I\pm\sigma_z}{2} \right\}.

Define

F6=16∑ρj∈S6Tr⁡[UtgtρjUtgt† ET(ρj)].F_6 = \frac{1}{6} \sum_{\rho_j\in\mathcal S_6} \operatorname{Tr} \left[ U_{\mathrm{tgt}}\rho_jU_{\mathrm{tgt}}^\dagger \, \mathcal E_T(\rho_j) \right].

This six-state score is not a substitute for a carefully conventioned process fidelity, but it gives a reproducible gate-style diagnostic that is harder to game than one input state.

Start with pulse families whose parameters can be printed in a table.

For a resonant square pulse, set Δ=0\Delta=0, Ωy(t)=0\Omega_y(t)=0, and Ωx(t)=Ω0\Omega_x(t)=\Omega_0. A noiseless π\pi pulse satisfies

Ω0T=π.\Omega_0T=\pi .

This baseline should reach Fst=1F_{\mathrm{st}}=1 in the noiseless state-transfer problem, up to numerical tolerance. If it does not, the sign, basis, time unit, or Hamiltonian normalization is wrong.

Use a smooth envelope such as

Ωx(t)=Ωmax⁡sin⁡2(πtT),Ωy(t)=0.\Omega_x(t) = \Omega_{\max} \sin^2 \left( \frac{\pi t}{T} \right), \qquad \Omega_y(t)=0.

The parameter Ωmax⁡\Omega_{\max} can be adjusted so that the pulse area is near π\pi. This tests whether the optimizer can improve a physically smoother pulse without hiding area mistakes.

Divide the pulse into KK equal time bins and use

Ωx(t)=ak,Ωy(t)=bk,t∈[tk,tk+1).\Omega_x(t)=a_k, \qquad \Omega_y(t)=b_k, \qquad t\in[t_k,t_{k+1}).

The controls should obey

ak2+bk2≤Ωmax⁡2.a_k^2+b_k^2 \le \Omega_{\max}^2 .

For the first notebook, use small KK, such as K=4K=4 or K=8K=8. A toy problem with too many free parameters can produce impressive-looking overfitting before the validation logic is in place.

Convert fidelity maximization into a minimization problem:

J(θ)=1−F(θ)+λA∫0TΩx(t)2+Ωy(t)2Ωmax⁡2 dt+λS∫0T[Ω˙x(t)2+Ω˙y(t)2] dt.J(\boldsymbol\theta) = 1-F(\boldsymbol\theta) + \lambda_A \int_0^T \frac{ \Omega_x(t)^2+\Omega_y(t)^2 }{ \Omega_{\max}^2 } \,dt + \lambda_S \int_0^T \left[ \dot\Omega_x(t)^2+\dot\Omega_y(t)^2 \right] \,dt .

Here θ\boldsymbol\theta denotes the pulse parameters. The amplitude penalty discourages unnecessarily strong controls, while the smoothness penalty discourages rapid oscillations. If the notebook uses hard amplitude clipping instead of penalties, it should say so and should report how often the optimizer hits the bound.

The notebook should always report both the penalized objective JJ and the physical fidelity FF. A pulse with lower JJ may have lower fidelity if it is deliberately smoother or weaker.

Use an optimization protocol that is easy to reproduce:

  1. evaluate the square-pulse baseline;
  2. run a coarse grid or Latin-hypercube search over a small parameter domain;
  3. refine the best points with a gradient-free optimizer such as Nelder–Mead, Powell, or COBYLA;
  4. repeat from several seeds or initial guesses;
  5. validate the best pulse on parameter values that were not used in the objective.

For each run, store:

  • initial parameters;
  • final parameters;
  • number of function evaluations;
  • optimizer status message;
  • best objective value;
  • best fidelity;
  • wall-clock time;
  • random seed, if randomness was used.

Gradient-based methods, GRAPE-style updates, and automatic differentiation are valuable later, but they are not required for the first toy notebook. The priority is a small, auditable optimization where every convention is visible.

Optimize at a declared training point, for example

Δ=0,ΓϕT=0.05.\Delta=0, \qquad \Gamma_\phi T=0.05 .

Then evaluate the same optimized pulse over a grid such as

−0.2≤ΔT≤0.2,0≤ΓϕT≤0.5.-0.2 \le \Delta T \le 0.2, \qquad 0 \le \Gamma_\phi T \le 0.5 .

The notebook should plot or tabulate:

  • square-pulse fidelity on the grid;
  • optimized-pulse fidelity on the grid;
  • difference between optimized and baseline fidelity;
  • regions where the optimized pulse is worse than the baseline;
  • sensitivity to the time-step and solver tolerance.

Robustness must be evaluated out of sample. Optimizing separately at every grid point can be useful for exploration, but it does not show that one pulse is robust.

Pure dephasing during a finite control pulse is not merely a numerical nuisance. If the target operation requires superpositions in the σz\sigma_z basis, dephasing removes precisely the phase information that the control is trying to organize. Faster pulses can reduce exposure time, but amplitude bounds and detuning errors limit how far that strategy can go.

The notebook should therefore interpret optimized pulses conservatively:

  • an improvement over a square pulse may mean better detuning robustness, not magic cancellation of Markovian dephasing;
  • a pulse trained at one dephasing rate may overfit that rate;
  • a higher state-transfer fidelity may not imply a higher gate fidelity;
  • a pulse that uses both quadratures may depend on phase calibration not included in the toy model;
  • dephasing noise that commutes with σz\sigma_z is not equivalent to amplitude damping or leakage.

For pulse sequences that suppress low-frequency noise by sign reversal and filtering, see Dynamical Decoupling. This notebook instead tests driven control in a small Markovian model.

The promoted notebook should pass all of the following checks.

For Δ=0\Delta=0, Γϕ=0\Gamma_\phi=0, Ωy=0\Omega_y=0, and Ωx=π/T\Omega_x=\pi/T,

ρ(0)=∣0⟩⟨0∣⟹Fst=1.\rho(0) = \lvert0\rangle\langle0\rvert \quad\Longrightarrow\quad F_{\mathrm{st}}=1 .

The numerical error should decrease when the time step and solver tolerance are tightened.

With controls off, the populations in the σz\sigma_z basis should remain fixed and the coherence should decay as

ρ01(t)=e−Γϕtρ01(0).\rho_{01}(t) = e^{-\Gamma_\phi t}\rho_{01}(0).

This checks the factor of 1/21/2 in the dissipator convention.

At every saved time point, compute

∣Tr⁡ρ−1∣,∥ρ−ρ†∥,λmin⁡(ρ).\left| \operatorname{Tr}\rho-1 \right|, \qquad \left\| \rho-\rho^\dagger \right\|, \qquad \lambda_{\min}(\rho).

Small negative eigenvalues at roundoff level should be reported separately from genuine positivity failures.

If the notebook reports a gate-style score, it should propagate a basis of input density matrices and reconstruct the finite-time map. The corresponding Choi matrix should be positive within tolerance and should have the trace-preserving partial-trace condition used in Simulating Quantum Channels.

The optimizer should rediscover the square-pulse area rule in the noiseless one-parameter case. If the notebook optimizes Ω0\Omega_0 for a resonant square pulse and does not find

Ω0T≈π,\Omega_0T\approx\pi ,

the optimization pipeline is not ready for higher-dimensional pulses.

A promoted version should save:

  • pulse-parameter tables in a machine-readable file;
  • plots of baseline and optimized pulse envelopes;
  • fidelity versus dephasing strength;
  • fidelity versus detuning;
  • optimization convergence history;
  • validation residuals for trace, Hermiticity, positivity, and channel checks;
  • a short text summary of the model and conventions.

Exploratory plots may be included, but accepted outputs should be clearly separated from scratch calculations. A reader should be able to regenerate the accepted figures from a clean run.

  • Optimizing one input state and then calling the result a gate.
  • Forgetting that a global phase is irrelevant for unitary comparison but not for raw matrix subtraction.
  • Mixing angular frequency and ordinary frequency in ΩT=π\Omega T=\pi.
  • Reporting the penalized objective without reporting the physical fidelity.
  • Comparing an optimized pulse with a poorly calibrated square-pulse baseline.
  • Allowing unconstrained amplitudes, then interpreting the result as realistic control.
  • Training and testing on the same noise and detuning point.
  • Ignoring solver tolerance when differences in fidelity are small.

For

H=ℏΩ2σx,H = \frac{\hbar\Omega}{2}\sigma_x,

show that the pulse duration for ∣0⟩→∣1⟩\lvert0\rangle\to\lvert1\rangle is T=π/ΩT=\pi/\Omega.

Solution

The unitary is

U(T)=e−iΩTσx/2=cos⁡(ΩT2)I−isin⁡(ΩT2)σx.U(T) = e^{-i\Omega T\sigma_x/2} = \cos \left( \frac{\Omega T}{2} \right)I - i\sin \left( \frac{\Omega T}{2} \right)\sigma_x .

Acting on ∣0⟩\lvert0\rangle gives full population transfer when the cosine term vanishes and the sine has unit magnitude. Thus

ΩT2=π2,T=πΩ.\frac{\Omega T}{2} = \frac{\pi}{2}, \qquad T=\frac{\pi}{\Omega}.

Show that the dissipator

Γϕ2(σzρσz−ρ)\frac{\Gamma_\phi}{2} \left( \sigma_z\rho\sigma_z-\rho \right)

does not change the σz\sigma_z-basis populations.

Solution

Write

ρ=(ρ00ρ01ρ10ρ11).\rho = \begin{pmatrix} \rho_{00}&\rho_{01}\\ \rho_{10}&\rho_{11} \end{pmatrix}.

Then

σzρσz=(ρ00−ρ01−ρ10ρ11).\sigma_z\rho\sigma_z = \begin{pmatrix} \rho_{00}&-\rho_{01}\\ -\rho_{10}&\rho_{11} \end{pmatrix}.

Therefore

σzρσz−ρ=(0−2ρ01−2ρ100).\sigma_z\rho\sigma_z-\rho = \begin{pmatrix} 0&-2\rho_{01}\\ -2\rho_{10}&0 \end{pmatrix}.

The diagonal entries vanish, so the populations are unchanged. The coherences decay at rate Γϕ\Gamma_\phi.

Why should the notebook report both JJ and FF when it uses amplitude or smoothness penalties?

Solution

The objective JJ mixes physical infidelity with design preferences such as weaker or smoother pulses. A pulse can have a lower JJ because it uses less power while also having a lower physical fidelity. Reporting both JJ and FF lets readers see the tradeoff instead of mistaking the optimizer’s bookkeeping score for the experimental success probability.

A pulse is optimized at Δ=0\Delta=0 and ΓϕT=0.05\Gamma_\phi T=0.05. Why is evaluating it at the same point insufficient evidence of robustness?

Solution

Robustness means performance persists when model parameters move away from the training point. A pulse can overfit one detuning and dephasing rate. It should be tested on a grid of detunings and dephasing strengths that were not separately optimized. Only then can one compare whether it is broadly better than the square-pulse baseline.

  • D. D’Alessandro, Introduction to Quantum Control and Dynamics, Chapman and Hall/CRC (2007).
  • C. Brif, R. Chakrabarti, and H. Rabitz, “Control of quantum phenomena: Past, present and future,” New Journal of Physics 12, 075008 (2010).
  • N. Khaneja, T. Reiss, C. Kehlet, T. Schulte-Herbruggen, and S. J. Glaser, “Optimal control of coupled spin dynamics: Design of NMR pulse sequences by gradient ascent algorithms,” Journal of Magnetic Resonance 172, 296-305 (2005).
  • S. J. Glaser, U. Boscain, T. Calarco, C. P. Koch, W. Kockenberger, R. Kosloff, I. Kuprov, B. Luy, S. Schirmer, T. Schulte-Herbruggen, D. Sugny, and F. K. Wilhelm, “Training Schrödinger’s cat: Quantum optimal control,” European Physical Journal D 69, 279 (2015).
  • H. M. Wiseman and G. J. Milburn, Quantum Measurement and Control, Cambridge University Press (2010).
  • M. A. Nielsen and I. L. Chuang, Quantum Computation and Quantum Information, Cambridge University Press (2010).