From c35dd8498b995b2358b6e68f0f9e22e6e5e14b1b Mon Sep 17 00:00:00 2001 From: Chris Rackauckas Date: Sat, 25 Jun 2022 04:51:44 -0400 Subject: [PATCH] remove running --- docs/src/optimal_control/SDE_control.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/src/optimal_control/SDE_control.md b/docs/src/optimal_control/SDE_control.md index d091ebba9..f08b08695 100644 --- a/docs/src/optimal_control/SDE_control.md +++ b/docs/src/optimal_control/SDE_control.md @@ -17,7 +17,7 @@ to ultimately prepare and stabilize the qubit in the excited state. Before getting to the explanation, here's some code to start with. We will follow a full explanation of the definition and training process: -```@example +```julia # load packages using DiffEqFlux using DiffEqSensitivity @@ -302,7 +302,7 @@ visualization_callback(res.u, loss(res.u); doplot=true) ## Step-by-step description ### Load packages -```@example sdecontrol +```julia using DiffEqFlux using DiffEqSensitivity using Optimization @@ -313,7 +313,7 @@ using Plots ### Parameters We define the parameters of the qubit and hyper-parameters of the training process. -```@example sdecontrol +```julia lr = 0.01f0 epochs = 100 @@ -377,7 +377,7 @@ In plain terms, the quantities that were defined are: We use a neural network to control the parameter Ω(t). Alternatively, one could also, e.g., use [tensor layers](https://diffeqflux.sciml.ai/dev/layers/TensorLayer/), Flux.jl, or Lux.jl. -```@example sdecontrol +```julia # state-aware nn = FastChain( FastDense(4, 32, relu), @@ -394,7 +394,7 @@ To avoid complex numbers in our simulations, we split the state of the qubit ``` into its real and imaginary part. -```@example sdecontrol +```julia # initial state anywhere on the Bloch sphere function prepare_initial(dt, n_par) # shape 4 x n_par @@ -422,7 +422,7 @@ package, as one possibility to simulate a 1D Brownian motion. Note that the NN is placed directly into the drift function, thus the control parameter Ω is continuously updated. -```@example sdecontrol +```julia # Define SDE function qubit_drift!(du,u,p,t) # expansion coefficients |Ψ> = ce |e> + cd |d> @@ -495,7 +495,7 @@ parallel ensemble simulation docs](https://diffeq.sciml.ai/latest/features/ensem for a description of the available ensemble algorithms. To optimize only the parameters of the neural network, we use `pars = [p; myparameters.Δ; myparameters.Ωmax; myparameters.κ]` -``` @example sdecontrol +``` julia # compute loss function g(u,p,t) ceR = @view u[1,:,:] @@ -549,7 +549,7 @@ To visualize the performance of the controller, we plot the mean value and standard deviation of the fidelity of a bunch of trajectories (`myparameters.numtrajplot`) as a function of the time steps at which loss values are computed. -```@example sdecontrol +```julia function visualize(p; alg=EM()) u0 = prepare_initial(myparameters.dt, myparameters.numtrajplot) @@ -628,7 +628,7 @@ of the neural network. sensitivity methods. The necessary correction between Ito and Stratonovich integrals is computed under the hood in the DiffEqSensitivity package. -```@example sdecontrol +```julia # optimize the parameters for a few epochs with ADAM on time span # Setup and run the optimization adtype = Optimization.AutoZygote()