Coder Social home page Coder Social logo

juliaquantumcontrol / krotov.jl Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 2.0 15.49 MB

Julia implementation of Krotov's method for quantum optimal control

Home Page: https://juliaquantumcontrol.github.io/Krotov.jl

License: MIT License

Makefile 3.60% Julia 96.40%
julia quantum optimal-control krotov numerical-methods

krotov.jl's Issues

Time integrated functional

I am trying to optimise the control pulse to empty an optical resonator as fast as possible by, e.g switching off a driving field and controlling its detuning from the resonance frequency.

The initial state is therefore a coherent state, and the final one, the vacuum. To maximise the speed at which the cavity is empty the cost function to minimise would be, e.g, the photon number integrated cross the dynamics. Is there a way to set this as the optimisation functional?

`optimize` mutates guess pulses

When the guess controls are actually pulses (vectors defined on the midpoint of the time grid), the optimization will mutate the original objective.generator. This happens because currently, disretize_on_midpoints simply returns the input vector instead of a copy of the input vector.

using Test
using QuantumControl
using LinearAlgebra
using StableRNGs
using QuantumControlTestUtils.DummyOptimization: dummy_control_problem
using QuantumControl.Controls: get_controls, discretize_on_midpoints
using QuantumControl.Functionals: J_T_re

rng = StableRNG(1244561944)

# The problem occurs when the controls are actually pulses (on the midpoints of
# the time grid), so that the optimization does not have to call
# `discretize_on_midpoints` internally
problem = dummy_control_problem(; pulses_as_controls=true)
nt = length(problem.tlist)
guess_pulse = QuantumControl.Controls.get_controls(problem.objectives)[1]
@test length(guess_pulse) == nt - 1
guess_pulse_copy = copy(QuantumControl.Controls.get_controls(problem.objectives)[1])

# Optimizing this should not modify the original generator in any way
res = optimize(problem; method=:krotov, J_T=J_T_re, iter_stop=2)
opt_control = res.optimized_controls[1]
@test length(opt_control) == nt  # optimized_controls are always *on* tlist
opt_pulse = discretize_on_midpoints(opt_control, problem.tlist)
post_pulse = QuantumControl.Controls.get_controls(problem.objectives)[1]

# * The generator should still have the exact same objects as controls
@test guess_pulse  post_pulse
# * These objects should not have been modified
@test norm(guess_pulse_copy - guess_pulse)  0.0  # FAILS
# * But the values of the optimized pulse should differ from the pulse in the
#   generator
@test norm(post_pulse - opt_pulse) > 0.1  # FAILS

Releases

This is an ongoing issue to trigger package registration

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.