GRAPE Package

Index

$\gdef\tgt{\text{tgt}}$ $\gdef\tr{\operatorname{tr}}$ $\gdef\Re{\operatorname{Re}}$ $\gdef\Im{\operatorname{Im}}$

GRAPE

Private

GRAPE.print_tableFunction

Print optimization progress as a table.

This functions serves as the default info_hook for an optimization with GRAPE.

GRAPE.optimize_grapeFunction

Optimize a control problem using GRAPE.

result = optimize_grape(problem)

optimizes the given control problem, by minimizing the functional

\[J(\{ϵ_{ln}\}) = J_T(\{|ϕ_k(T)⟩\}) + λ_a J_a(\{ϵ_{ln}\})\]

where the final time functional $J_T$ depends explicitly on the forward-propagated states and the running cost $J_a$ depends explicitly on pulse values $ϵ_{nl}$ of the l'th control discretized on the n'th interval of the time grid.

Returns a GrapeResult.

Note

It is recommended to call optimize with method=:GRAPE instead of calling optimize_grape directly.

Keyword arguments that control the optimization are taken from the keyword arguments used in the instantiation of problem.

Required problem keyword arguments

  • J_T: A function J_T(ϕ, objectives; τ=τ) that evaluates the final time functional from a vector ϕ of forward-propagated states and problem.objectives. For all objectives that define a target_state, the element τₖ of the vector τ will contain the overlap of the state ϕₖ with the target_state of the k'th objective, or NaN otherwise.

Optional problem keyword arguments

  • chi: A function chi!(χ, ϕ, objectives) 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.
  • J_a: A function J_a(pulsevals, tlist) that evaluates running costs over the pulse values, where pulsevals are the vectorized values $ϵ_{nl}$. If not given, the optimization will not include a running cost.
  • lambda_a=1: A weight for the running cost J_a.
  • grad_J_a: A function to calculate the gradient of J_a. If not given, it will be automatically determined.
  • update_hook: Not implemented
  • info_hook: A function 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 GrapeResult object.
  • check_convergence: A function to check whether convergence has been reached. Receives a GrapeResult 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.
  • x_tol: Parameter for Optim.jl
  • f_tol: Parameter for Optim.jl
  • g_tol: Parameter for Optim.jl
  • show_trace: Parameter for Optim.jl
  • extended_trace: Parameter for Optim.jl
  • show_every: Parameter for Optim.jl
  • allow_f_increases: Parameter for Optim.jl
  • optimizer: An optional Optim.jl optimizer (Optim.AbstractOptimizer instance). If not given, an L-BFGS-B optimizer will be used.
  • prop_method/fw_prop_method/bw_prop_method: The propagation method to use for each objective, see below.
  • prop_method/fw_prop_method/grad_prop_method: The propagation method to use for the extended gradient vector for each objective, see below.
  • verbose=false: If true, print information during initialization

The propagation method for the forward propagation of each objective is determined by the first available item of the following:

  • a fw_prop_method keyword argument
  • a prop_method keyword argument
  • a property fw_prop_method of the objective
  • a property prop_method of the objective
  • the value :auto

The propagation method for the backward propagation is determined similarly, but with bw_prop_method instead of fw_prop_method. The propagation method for the forward propagation of the extended gradient vector for each objective is determined from grad_prop_method, fw_prop_method, prop_method in order of precedence.