Parametrize PulseTuningProblem on the wrapped problem type - #19
Merged
Merged
Conversation
`qcp` was annotated with the concrete `QuantumControlProblem`. Piccolo's typed-templates work turns `SamplingProblem` from a function returning a `QuantumControlProblem` into its own wrapper type (`AbstractProblemWrapper <: AbstractQuantumControlProblem`), which that annotation would reject — so robust/sampling pulses could no longer be tuned. Add a `TunableProblem` alias that resolves at load to `AbstractQuantumControlProblem` when Piccolo defines it and `QuantumControlProblem` otherwise, and carry the problem as a third type parameter bound by it. Works unchanged on Piccolo 1.15 through the typed templates, so it needs no upgrade ordering. Also makes the field concrete: the old bare `QuantumControlProblem` was a UnionAll, i.e. a boxed field on the tuning loop's hot struct.
This was referenced Aug 29, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PulseTuningProblem.qcpis annotated with the concreteQuantumControlProblem. Piccolo's typed-templates work (Piccolo.jl#259) turnsSamplingProblemfrom a function returning aQuantumControlProbleminto its own wrapper type —SamplingProblem{P,QT} <: AbstractProblemWrapper, andAbstractProblemWrapper <: AbstractQuantumControlProblem. That annotation would reject it, so robust/sampling pulses could no longer be tuned.Nothing in this repo references
SamplingProblem, so no test catches either state today. The regression would be a silent capability loss on the robust-pulse → hardware-tuning path.Approach
A
TunableProblemalias resolved once at load:…and the problem carried as a third type parameter bound by it (
P<:TunableProblem,qcp::P).Hardcoding either arm breaks one side: concrete
QuantumControlProblemrejects the wrapper once it lands, andAbstractQuantumControlProblemis not a name that can be written until then. The alias means this needs no upgrade ordering — it compiles against Piccolo 1.15 through the typed templates, so it can land before, after, or independently of #259, and #259 carries no downstream Intonato break.Field is now concrete
The old
qcp::QuantumControlProblemwas aUnionAll(Piccolo already parametrizes it on the trajectory), i.e. an abstract — boxed — field on the struct the tuning loop reads every iteration. Parametrizing makes it concrete:Verification
TunableProblemresolves toQuantumControlProblem, field concrete as above.AbstractQuantumControlProblemis defined and exported (src/control/problems.jl:52) andAbstractProblemWrapper <: AbstractQuantumControlProblem(:310), soSamplingProblem <: TunableProblemthere. Worth re-confirming by dev-pinning once #259 lands.PulseTuningProblem{S,M}instantiations exist outside the definition, so the added parameter breaks no call site.