GRAPE Package
Index
$\gdef\tgt{\text{tgt}}$ $\gdef\tr{\operatorname{tr}}$ $\gdef\Re{\operatorname{Re}}$ $\gdef\Im{\operatorname{Im}}$
GRAPE
Private
GRAPE.print_table
— FunctionPrint optimization progress as a table.
This functions serves as the default info_hook
for an optimization with GRAPE.
GRAPE.optimize_grape
— FunctionOptimize 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
.
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 functionJ_T(ϕ, objectives; τ=τ)
that evaluates the final time functional from a vectorϕ
of forward-propagated states andproblem.objectives
. For allobjectives
that define atarget_state
, the elementτₖ
of the vectorτ
will contain the overlap of the stateϕₖ
with thetarget_state
of thek
'th objective, orNaN
otherwise.
Optional problem keyword arguments
chi
: A functionchi!(χ, ϕ, objectives)
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.J_a
: A functionJ_a(pulsevals, tlist)
that evaluates running costs over the pulse values, wherepulsevals
are the vectorized values $ϵ_{nl}$. If not given, the optimization will not include a running cost.lambda_a=1
: A weight for the running costJ_a
.grad_J_a
: A function to calculate the gradient ofJ_a
. If not given, it will be automatically determined.update_hook
: Not implementedinfo_hook
: A function 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 theGrapeResult
object.check_convergence
: A function to check whether convergence has been reached. Receives aGrapeResult
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
.x_tol
: Parameter for Optim.jlf_tol
: Parameter for Optim.jlg_tol
: Parameter for Optim.jlshow_trace
: Parameter for Optim.jlextended_trace
: Parameter for Optim.jlshow_every
: Parameter for Optim.jlallow_f_increases
: Parameter for Optim.jloptimizer
: 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
: Iftrue
, 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.
GRAPE.GrapeResult
— TypeResult object returned by optimize_grape
.