Skip to content

Latest commit

 

History

History
127 lines (96 loc) · 6.47 KB

README.md

File metadata and controls

127 lines (96 loc) · 6.47 KB

Qiskit Aqua

LicenseBuild Status

Qiskit is an open-source framework for working with noisy intermediate-scale quantum (NISQ) computers 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.

Installation

Qiskit Aqua is part of the Qiskit software framework. We encourage installing Qiskit Aqua as part of Qiskit via the pip tool (a python package manager):

pip install qiskit

pip will handle all dependencies automatically for you, including the other Qiskit elements upon 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.

Please note that one of Aqua's dependencies, PyEDA, which is used in Aqua's LogicalExpressionOracle and TruthTableOracle implementations, will not be automatically installed on the Windows platform. You can follow these notes to manually install PyEDA on Windows if necessary.

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:

$ python
from qiskit import Aer
from qiskit.aqua.components.oracles import LogicalExpressionOracle
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 = LogicalExpressionOracle(sat_cnf)
algorithm = Grover(oracle)
result = algorithm.run(backend)
print(result["result"])

The code above demonstrates how Grover’s search algorithm can be used with the LogicalExpressionOracle to find one satisfying assignment for the Satisfiability (SAT) problem instance encoded in the DIMACS CNF format. The input string sat_cnf corresponds to the following Conjunctive Normal Form (CNF):

x1 ∨ ¬x2 ∨ ¬x3) ∧ (x1 ∨ ¬x2x3) ∧ (x1x2 ∨ ¬x3) ∧ (x1 ∨ ¬x2 ∨ ¬x3) ∧ (¬x1x2x3)

The Python code above prints out one possible solution for this CNF. For example, output 1, -2, 3 indicates that logical expression (x1 ∨ ¬x2x3) 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.

Contribution Guidelines

If you'd like to contribute to Qiskit, please take a look at our contribution guidelines. This project adheres to Qiskit's code of conduct. By participating, you are expected to uphold to this code.

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.

Next Steps

Now you're set up and ready to check out some of the other examples from the qiskit/aqua and community/aqua folders of the qiskit-tutorials GitHub Repository.

Authors and Citation

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. If you use Qiskit, please cite as per the included BibTeX file.

License

Apache License 2.0