Qiskit is an open-source framework for working with noisy intermediate-scale quantum computers (NISQ) at the level of pulses, circuits, algorithms, and applications.
Qiskit is made up elements that work together to enable quantum computing. This element is Aqua. Aqua provides a library of cross-domain algorithms upon which domain-specific applications can be built. Qiskit Chemistry has been created to utilize Aqua for quantum chemistry computations. Aqua is also showcased for other domains, such as Optimization, Artificial Intelligence, and Finance, with both code and notebook examples available in the qiskit/aqua and community/aqua folders of the qiskit-tutorials GitHub Repository.
Aqua was designed to be extensible, and uses a pluggable framework where algorithms and support objects used by algorithms—such as optimizers, variational forms, and oracles—are derived from a defined base class for the type and discovered dynamically at run time.
We encourage installing Qiskit Aqua via the pip tool (a python package manager):
pip install qiskit-aqua
pip will handle all dependencies automatically for you, including the other Qiskit elements on which Aqua is built, such as Qiskit Terra, and you will always install the latest (and well-tested) version.
To install from source, follow the instructions in the contribution guidelines.
Creating Your First Quantum Program in Qiskit Aqua
Now that Qiskit Aqua is installed, it's time to begin working with it. We are ready to try out an experiment using Qiskit Aqua:
>>> from qiskit import Aer >>> from qiskit_aqua.components.oracles import SAT >>> from qiskit_aqua.algorithms import Grover >>> sat_cnf = """ >>> c Example DIMACS 3-sat >>> p cnf 3 5 >>> -1 -2 -3 0 >>> 1 -2 3 0 >>> 1 2 -3 0 >>> 1 -2 -3 0 >>> -1 2 3 0 >>> """ >>> backend = Aer.get_backend('qasm_simulator') >>> oracle = SAT(sat_cnf) >>> algorithm = Grover(oracle) >>> result = algorithm.run(backend) >>> print(result["result"])
The code above demonstrates how Grover’s search algorithm can be used in conjunction with the
Satisfiability (SAT) oracle to compute one of the many possible solutions of a Conjunctive Normal
Form (CNF). Variable
sat_cnf corresponds to the following CNF:
(¬x1 ∨ ¬x2 ∨ ¬x3) ∧ (x1 ∨ ¬x2 ∨ x3) ∧ (x1 ∨ x2 ∨ ¬x3) ∧ (x1 ∨ ¬x2 ∨ ¬x3) ∧ (¬x1 ∨ x2 ∨ x3)
The Python code above prints out one possible solution for this CNF. For example, output
1, -2, 3 indicates
that logical expression (x1 ∨ ¬x2 ∨ x3)
satisfies the given CNF.
You can also use Qiskit to execute your code on a real quantum chip. In order to do so, you need to configure Qiskit to use the credentials in your IBM Q account. Please consult the relevant instructions in the Qiskit Terra GitHub repository for more details.
We use GitHub issues for tracking requests and bugs. Please join the Qiskit Slack community and use the Aqua Slack channel for discussion and simple questions. For questions that are more suited for a forum, we use the Qiskit tag in Stack Overflow.
Aqua was inspired, authored and brought about by the collective work of a team of researchers. Aqua continues to grow with the help and work of many people, who contribute to the project at different levels.