API

Krotov.print_tableMethod

Print optimization progress as a table.

This functions serves as the default info_hook for an optimization with Krotov's method.

source
QuantumControlBase.optimizeMethod
using 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 function J_T(ϕ, trajectories) that evaluates the final time functional from a list ϕ of forward-propagated states and problem.trajectories.

Recommended problem keyword arguments

  • lambda_a=1.0: The inverse Krotov step width λ_a for every pulse.
  • update_shape=(t->1.0): A function S(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 by get_controls from the problem.trajectories) to the following dict:

    • :lambda_a: The value for inverse Krotov step width λₐ
    • :update_shape: A function S(t) for the "update shape" that scales the Krotov pulse update.

    This overrides the global lambda_a and update_shape arguments.

  • chi: A function chi!(χ, ϕ, trajectories) what receives a list ϕ of the forward propagated states and must set $|χₖ⟩ = -∂J_T/∂⟨ϕₖ|$. If not given, it will be automatically determined from J_T via make_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 number

  • iter_stop=5000: the maximum iteration number

  • prop_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 as update_hook, in order to write information about the current iteration to the screen or to a file. The default info_hook prints a table with convergence information to the screen. Runs after update_hook. The info_hook function may return a tuple, which is stored in the list of records inside the KrotovResult object.

  • check_convergence: a function to check whether convergence has been reached. Receives a KrotovResult object result, and should set result.converged to true and result.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 to update_hook and info_hook.

  • verbose=false: If true, 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.

source