Skip to content

alu0101119137/quantum-solver

 
 

Repository files navigation

QuantumSolver

Quantum Solver Logo

QuantumSolver

A little quantum toolset developed using Qiskit
Explore the docs »

Table of Contents

Getting started

Warning

The toolset uses your personal IBM Quantum Experience token to access to the IBM hardware. You can access to your API token or generate another one here.

You can also use the Guest Mode which only allows you to run quantum circuits in a local simulator ("aer_simulator").

Download and install

This installation has been tested in the Linux distribution environment: Ubuntu 22.04.1.

# Update and install
sudo apt update && sudo apt upgrade

sudo apt install -y make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python3-openssl \
git

# Pyenv installation
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init --path)"' >> ~/.bashrc

It is now important to restart the terminal

reset

Python 3.8.12 installation

pyenv install 3.8.12
pyenv global 3.8.12

NVM installation

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
exec bash -l

Node 19.0.1 installation

nvm install node
nvm install 19.0.1
nvm use 19.0.1

QuantumSolver Installation

git clone https://github.com/alu0101238944/quantum-solver.git
cd quantum-solver
python -m pip install -e .
cd quantum_solver_web
npm install

Command Line Interface

QuantumSolver Basic

This main program allows the execution of the circuits corresponding to the basic quantum algorithms: Radom Generation Number, Deutsch-Jozsa, Bernstein-Vazirani, Grover (2-qubits), Quantum Teleportation and Superdense Coding.

python3 src/main_quantum_solver.py [optional IBMQ_TOKEN]

QuantumSolver Crypto

This main program gives the option to run a simulation of the following quantum cryptographic protocols: BB84, E91, B92, Six-State, a Quantum Substitute for RSA and Quantum Elgamal.

python3 src/main_crypto.py [optional IBMQ_TOKEN]

Web Interface

Backend

cd quantum_solver_web
python3 src/flask-server/server.py

Frontend

cd quantum_solver_web
npm start

Screenshots

Home Page
Home Page
Token Page
Token Page
Main Menu Page
Main Menu Page
Run Page
Run Page
Run Experimental Mode Page
Run Experimental Mode Page

How to contribute to QuantumSolver?

QuantumSolver Basic

Creates a derived class (whose name is the name of the algorithm in upper camel case format) in the src/algorithms directory from the abstract class QAlgorithm. To do this, you can copy and paste the simplest algorithm file found in the QRand library, changing the data to suit the circuit you want to implement. The data you must change, besides the name of the file itself (which should be the name of the class in snake case format):

  • Algorithm name
  • Brief description of the problem to be solved
  • List of parameter objects, indicating for each of them the type, a brief description and a warning about the allowed values
  • A method that given a counts result of the execution of the circuit extracts the result
  • A lambda function that parses the entered parameters
  • A method that checks the validity of the entered parameters
  • A method that returns the parameterized circuit itself based on the parameters

It may seem an exahusive list, but following the QAlgorithm template (and especially its simpler implementation in QRand) it is quite simple. If you have any questions in this regard, follow the examples intuitively, open an issue or contact the developers.

Once the derived class has been created, to add it to QuantumSolver just add it to the QAlgorithmManager in the src/algorithms/qalgorithmm_manager.py directory. In the imported libraries add a line:

from algorithms.algorithm_file_name import AlgorithmClass

Finally, add to the array of available algorithms your contribution:

self.algorithms = [
      QRand(),
      DeutschJozsa(),
      BernsteinVazirani(),
      Grover(),
      QuantumTeleportation(),
      SuperdenseCoding(),
      AlgorithmClass()
    ]

In this way, the protocol will be available both in the QuantumSolver Basic command line interface and in the web interface. Consider making a Pull Request for the changes to be made publicly effective.

QuantumSolver Crypto

Follow the example implementation of any of the previously defined protocols (we recommend the use of BB84 as an initial template). To add your quantum cryptography protocol to QuantumSolver just add your created class to the protocols array of the CyrptoManager class of the srcrypto_manager.py file.

  1. Add the import of your protocol
from crypto.name_dir.name_file import CryptoProtocol
  1. Adds the protocol class to the array
self.protocols = [
  BB84(token),
  E91(token),
  B92(token),
  SixState(token),
  RsaSubstitute(token),
  ElGamal(token),
  CryptoProtocol(token)
]

With these steps, your protocol can be simulated from the main program src/main_crypto.py. Consider making a Pull Request for the changes to be made publicly effective.

Documentation

QuantumSolver documentation is available at https://alu0101238944.github.io/quantum-solver/.

About

QuantumSolver: A little quantum toolset developed using Qiskit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 86.6%
  • TypeScript 10.9%
  • CSS 1.5%
  • HTML 1.0%