API
Krotov.KrotovResult
— TypeResult object returned by optimize_krotov
.
Krotov.optimize_krotov
— MethodKrotov.print_table
— MethodPrint optimization progress as a table.
This functions serves as the default info_hook
for an optimization with Krotov's method.
QuantumControlBase.optimize
— Methodusing Krotov
result = optimize(problem; method=Krotov, kwargs...)
optimizes the given control problem
using Krotov's method, returning a KrotovResult
.
Keyword arguments that control the optimization are taken from the keyword arguments used in the instantiation of problem
; any of these can be overriden with explicit keyword arguments to optimize
.
Required problem keyword arguments
J_T
: A functionJ_T(ϕ, trajectories)
that evaluates the final time functional from a listϕ
of forward-propagated states andproblem.trajectories
.
Recommended problem keyword arguments
lambda_a=1.0
: The inverse Krotov step width λ_a for every pulse.update_shape=(t->1.0)
: A functionS(t)
for the "update shape" that scales the update for every pulse
If different controls require different lambda_a
or update_shape
, a dict pulse_options
must be given instead of a global lambda_a
and update_shape
, see below.
Optional problem keyword arguments
The following keyword arguments are supported (with default values):
pulse_options
: A dictionary that maps every control (as obtained byget_controls
from theproblem.trajectories
) to the following dict::lambda_a
: The value for inverse Krotov step width λₐ:update_shape
: A functionS(t)
for the "update shape" that scales the Krotov pulse update.
This overrides the global
lambda_a
andupdate_shape
arguments.chi
: A functionchi!(χ, ϕ, trajectories)
what receives a listϕ
of the forward propagated states and must set $|χₖ⟩ = -∂J_T/∂⟨ϕₖ|$. If not given, it will be automatically determined fromJ_T
viamake_chi
with the default parameters.sigma=nothing
: Function that calculate the second-order contribution. If not given, the first-order Krotov method is used.iter_start=0
: the initial iteration numberiter_stop=5000
: the maximum iteration numberprop_method
: The propagation method to use for each trajectory, see below.update_hook
: A function that receives the Krotov workspace, the iteration number, the list of updated pulses and the list of guess pulses as positional arguments. The function may mutate any of its arguments. This may be used e.g. to apply a spectral filter to the updated pulses or to perform similar manipulations.info_hook
: A function (or tuple of functions) that receives the same arguments asupdate_hook
, in order to write information about the current iteration to the screen or to a file. The defaultinfo_hook
prints a table with convergence information to the screen. Runs afterupdate_hook
. Theinfo_hook
function may return a tuple, which is stored in the list ofrecords
inside theKrotovResult
object.check_convergence
: a function to check whether convergence has been reached. Receives aKrotovResult
objectresult
, and should setresult.converged
totrue
andresult.message
to an appropriate string in case of convergence. Multiple convergence checks can be performed by chaining functions with∘
. The convergence check is performed after any calls toupdate_hook
andinfo_hook
.verbose=false
: Iftrue
, print information during initialization
Trajectory propagation
Krotov's method involves the forward and backward propagation for every Trajectory
in the problem
. The keyword arguments for each propagation (see propagate
) are determined from any properties of each Trajectory
that have a prop_
prefix, cf. init_prop_trajectory
.
In situations where different parameters are required for the forward and backward propagation, instead of the prop_
prefix, the fw_prop_
and bw_prop_
prefix can be used, respectively. These override any setting with the prop_
prefix. This applies both to the properties of each Trajectory
and the problem keyword arguments.
Note that the propagation method for each propagation must be specified. In most cases, it is sufficient (and recommended) to pass a global prop_method
problem keyword argument.