Skip to content

Commit

Permalink
remove running
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Jun 25, 2022
1 parent 8148e25 commit c35dd84
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions docs/src/optimal_control/SDE_control.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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),
Expand All @@ -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
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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,:,:]
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit c35dd84

Please sign in to comment.