Objective functionevaluation service
The objective functionevaluation service enables a service-based evaluation of quantum execution results for variational quantum algorithms (VQA).
It implements multiple cost and objective functions commonly employed in current quantum applications.
- Cost functions are used to determine the quality of a bitstring measured on a quantum computer. These functions are problem-specific, e.g., Traveling
Sales PersonSalesman Problem (TSP) or Maximum Cut (MaxCut), and are required to further process the quantum measurement. - Objective functions are used for the parameter optimization of VQAs. They summarize the overall quality of all measured solutions in one single number, the so-called objective value. The objective values is used by optimizers (see here) to determine new parameter values that aim to improve the objective value and thus the overall solution quality. Therefore, objective functions heavily influence the optimization process (see here for more details). Examples are: expectation value, CVaR, or Gibbs
Additionally, the objective functionevaluation service contains a visualization module, enabling generation of an image representing the visualization of the execution result's most occurring bitstring. For example, for the TSP problem, the route taken by the solution is highlighted in the graph.
Running the Application
The easiest way to get start is using a pre-built Docker image:
docker run -p 5072:5072 planqk/objective-function-service
docker run -p 5072:5072 planqk/objective-evaluation-service
Alternatively, the application can be built manually:
- Clone the repository using
git clone https://github.com/UST-QuAntiL/objective-function-service.git
git clone https://github.com/UST-QuAntiL/objective-evaluation-service.git
- Navigate to the repository
cd objective-function-service
cd objective-evaluation-service
- Build the Docker container:
docker build -t objective-function-service:0.1 .
docker build -t objective-evaluation-service .
- Run the Docker container:
docker run -p 5072:5072 objective-function-service:0.1
docker run -p 5072:5072 objective-evaluation-service
Then the application can be accessed via: http://127.0.0.1:5072.
API Documentation
The objective functionevaluation service provides a Swagger UI, specifying the request schemas and showcasing exemplary requests for all API endpoints.
- Swagger UI: http://127.0.0.1:5072/app/swagger-ui.
Setup (exemplary for ubuntu 18.04):
git clone https://github.com/UST-QuAntiL/objective-evaluation-service.git cd objective-evaluation-servicegit clone https://github.com/UST-QuAntiL/objective-function-service.gitcd objective-function-service# if virtualenv is not installed sudo -H pip install virtualenv # create new virtualenv called 'venv' virtualenv venv # activate virtualenv; in Windows systems activate might be in 'venv/Scripts' source venv/bin/activate #install application requirements. pip install -r requirements.txt
Execution:
- Run the application with:
flask run --port=5072
- Test with:
python -m unittest discover
- Coverage with:
coverage run --branch --include 'app/*' -m unittest discover; coverage report
Haftungsausschluss
Dies ist ein Forschungsprototyp. Die Haftung für entgangenen Gewinn, Produktionsausfall, Betriebsunterbrechung, entgangene Nutzungen, Verlust von Daten und Informationen, Finanzierungsaufwendungen sowie sonstige Vermögens- und Folgeschäden ist, außer in Fällen von grober Fahrlässigkeit, Vorsatz und Personenschäden, ausgeschlossen.
Acknowledgements
The initial code contribution has been supported by the project SEQUOIA funded by the Baden-Wuerttemberg Ministry of the Economy, Labour and Housing.