-
Hi, I would like to expose a certain set of controls to the optimizer, say
for some constants Is it possible to define a control problem in this way in Edit: I see from this section of the documentation that I will probably need to implement a custom generator. My question then with respect to this section is whether I need to know analytically the derivative of each control amplitude |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yes, as you found, "amplitudes" are intended for exactly this use case. You don't need a custom generator, specifically, only custom amplitudes. That is, you can still initialize your generator with e.g.
You can check your implementation by calling As you can see, the required interface includes the derivative of each control amplitude with respect to each control function. There's no way around this: how else would you calculate gradients? Maybe take a step back, though, and think about whether you really need all of this: Could you use the |
Beta Was this translation helpful? Give feedback.
Yes, as you found, "amplitudes" are intended for exactly this use case. You don't need a custom generator, specifically, only custom amplitudes. That is, you can still initialize your generator with e.g.
hamiltonian(H0, (H1, F1), (H2, F2))
, but you will need custom data structure for theF1
,F2
, etc. These have to fulfill the following interface:get_controls(ampl)
must be defined and return a tupleampl
must passcheck_control
substitute(ampl, controls_replacements)
must be definedevaluate(ampl, tlist, n)
must be defined and return a Numberevaluate(ampl, tlist, n; vals_dict)
must be defined and return a Numberget_control_deriv(ampl, control)
must be defined