The GRAPE Optimization scope refers to a gradient-based optimization algorithm known as Gradient Ascent Pulse Engineering (GRAPE), and is relevant for quantum optimal control problems. It is an optimization loop which optimizes the control path based on the inputs provided. The simulation is started by clicking the green Run button.
The node has the following inputs:
The node has two checkboxes: H1 and BFGS, which enable the choice of search direction. The search direction is based on the gradient information, which are the gradients calulated in iterations 1,2....N. It also has fields to specify the bounds of each control.
In the example below, the frequency ($u_0$) and trap center ($u_1$) of a harmonic oscillator potential is controlled to transfer a ground state at $u_1=-3$ to translated ground state at $u_1 = 3$. The states are supplied to the Control Problem node, which itself defines the potential expression. The problem is input along initial control curves (a seed defined in a Control node) and optimization parameters to the Grape Optimization. The initial cruve (blue) and the optimized path (red) are plotted together in the Control Comparison Plot. As the simulation runs, the fidelity is plotted against the iteration number in Scalar Time Trace Plot, the optimized control is re-plotted, and the probability density is shown for all $t$ in State Evolution Plot.
The initial fidelity is very low ($F=0.017$), but after optimizing it reaches $F=0.99$. After reaching this fidelity, the optimization stops and outputs the optimized control which is then used input to a For Each Control Value scope, plotting the time evolution in real time.