Hackathon Qiskit IBM 2019
MIT License
Clone or download repo
Go to the repo and use conda to create a virtual environment:
conda env create -f environment.yml
then, activate your environment
conda activate Qiskitenv
This software is prepared to minimize functions like θo x + θ1y, applying the inequality x + y ≤ β, where you can choose your θ0, θ1 and β
A function called wrapper_optimiza_f will launch the optimization process, you need to provide:
- precision -> the number of qbits used for each variable
- coefs_param -> A list with the coeficients of each variable
- beta -> β for the inequality constraint
You will get a dictionary with the value of each variable
from qplex_core import *
precision = 6
coefs_param = [2, -3]
beta = 7
a = wrapper_optimiza_f(precision, coefs_param, beta)
print(a)
You will get the desired value this way
{0: 0, 1: 7}
-
URL
http://127.0.0.1:3333/api/optimize
-
Method:
POST
-
Data:
application/json
{
"variables": [2, -3],
"restriction": 7,
"precision": 6
}
-
Success Response:
Code: 200
{
"results": {
"x": 0,
"y": 7
},
"status": "OK"
}