Giter Site home page Giter Site logo

quocs's Introduction

The optimization library

Build Status Build Status Build Status

QuOCS (Quantum Optimal Control Suite) is a python software package for model- and experiment-based optimizations of quantum processes. It uses the excellent Numpy and Scipy packages as numerical backends. QuOCS aims to provide a user-friendly interface to solve optimization problems. A variety of popular optimal control algorithms are available:

  • GRAPE (GRadient Ascent Pulse Engineering) Algorithm
  • dCRAB (dressed Chopped RAndom Basis) Algorithm
  • AD-GRAPE (Automatic Differentiation) Algorithm
  • Direct Search Algorithm, i.e. Nelder Mead, CMA-ES...

QuOCS is open source and its interface structure allows for user-friendly customizability (see customization section). It can be used on all Unix-based platforms and on Windows.

Installation

Pip Package Build Status

QuOCS is available on pip. You can install QuOCS by doing

pip install quocs-lib

The requirements are:

  • setuptools >= 44.0.0
  • numpy >= 1.19.1
  • scipy >= 1.5.1
  • If you want to use the AD Algorithm, the installation of JAX (Autograd and XLA) is required.

Editable mode

If you want to customize the algortihm and basis inside QuOCS (see customization), the package has to be installed in the editable mode. You can easily do that with the following commands:

git clone https://github.com/Quantum-OCS/QuOCS.git
cd QuOCS
pip install -e .

Documentation

The possible settings for the JSON file can be found here.

You can find the latest development documentation here.

A selection of demonstration notebooks is available, which demonstrate some of the many features of QuOCS. These are stored in the QuOCS/QuOCS-jupyternotebooks repository here on GitHub.

Example of usage

Using QuOCS is intuitive and simple. The main steps are:

  1. Create and load the optimization dictionary. This json file contains all the optimization settings (as example see this file).

    from quocslib.utils.inputoutput import readjson
    optimization_dictionary = readjson("opt_dictionary.json"))
  2. Create Figure of Merit object. This is an instance of a class that contains the physical problem to be optimized. In the following, you can see an example of how to define this class. The input and output of get_FoM should not be changed.

    from quocslib.utils.AbstractFoM import AbstractFoM
    # Define problem class
    class OneQubit(AbstractFoM):
    
        def __init__(self, args_dict:dict = None):
            """ Initialize the dynamics variables"""
            if args_dict is None:
                args_dict = {}
            ...
    
        def get_FoM(self, pulses: list = [],
                    parameters: list = [],
                    timegrids: list = []
            ) -> dict:
            # Compute the dynamics and FoM
            ...
    
            return {"FoM": fidelity}
    
    # Create Figure of Merit object
    FoM_object = OneQubit()
  3. Define the optimizer by initializing it with the uploaded optimization dictionary and FoM object. After that the execution can be run.

    from quocslib.Optimizer import Optimizer
    # Define Optimizer
    optimization_obj = Optimizer(optimization_dictionary,
                                 FoM_object)
    # Execute the optimization
    optimization_obj.execute()

Complete examples are provided in QuOCS/QuOCS-jupyternotebooks repository or in the tests folders.

Contribute

Would you like to implement a new algorithm or do you have in mind some new feature it would be cool to have in QuOCS? You are most welcome to contribute to QuOCS development! You can do it by forking this repository and sending pull requests, or filing bug reports at the issues page. All code contributions are acknowledged in the contributors section in the documentation. Thank you for your cooperation!

Citing QuOCS

If you use QuOCS in your research, please cite the original QuOCS papers that are available here.

Authors and contributors

quocs's People

Contributors

marcorossignolo avatar thomasreisser90 avatar alicepagano avatar phila-rembold avatar alastair-marshall avatar

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.