AI Permutation methods
Get available backends
Code samples
GET
/permutations/backendscurl -X GET \
https://cloud-transpiler.quantum.ibm.com/permutations/backends \
-H 'Authorization: Bearer YOUR-TOKEN' \
-H 'Accept: application/json'
import requests
response = requests.request(
"GET",
"https://cloud-transpiler.quantum.ibm.com/permutations/backends",
headers={
"Accept": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN_HERE"
},
)
print(response.json())
Responses
[
"example"
]
{
"type": "array",
"items": {
"type": "string"
},
"title": "Response Backends Permutations Backends Get"
}
Benchmark AI-powered Permutation pass
Returns a task ID; use the '/permutations/benchmark/{taskId}' endpoint to get the result.
Query Parameters
Name, Type | Description |
---|---|
model string | |
backend string | The name of the backend. Refer to https://docs.quantum.ibm.com/run/get-backend-information. Example: "ibm_kyoto" |
topology string | |
n_steps integer | The number of attempts (aka steps) that the RL model should perform to find the best synthesized circuit |
Body Parameters (application/json)
Name, Type | Description |
---|---|
permutation Required integer[] | Example: [0,1,2,3,4] |
coupling_map integer[][] | null | Example: [[0,1],[1,0],[1,2],[2,1]] |
HTTP Response Status Codes
Status code | Description |
---|---|
200 | Successful Response |
422 | Validation Error |
Code samples
POST
/permutations/benchmarkcurl -X POST \
https://cloud-transpiler.quantum.ibm.com/permutations/benchmark \
-H 'Authorization: Bearer YOUR-TOKEN' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{"permutation":[0,1,2,3,4]}'
import requests
response = requests.request(
"POST",
"https://cloud-transpiler.quantum.ibm.com/permutations/benchmark",
headers={
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN_HERE"
},
data="{\"permutation\":[0,1,2,3,4]}"
)
print(response.json())
Responses
{
"task_id": "example"
}
{
"properties": {
"task_id": {
"type": "string",
"title": "Task Id"
}
},
"type": "object",
"required": [
"task_id"
],
"title": "TaskIdResponse"
}
Get benchmark result
Code samples
GET
/permutations/benchmark/{task_id}curl -X GET \
https://cloud-transpiler.quantum.ibm.com/permutations/benchmark/{task_id} \
-H 'Authorization: Bearer YOUR-TOKEN' \
-H 'Accept: application/json'
import requests
response = requests.request(
"GET",
"https://cloud-transpiler.quantum.ibm.com/permutations/benchmark/{task_id}",
headers={
"Accept": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN_HERE"
},
)
print(response.json())
Responses
{
"state": "example",
"result": null
}
{
"properties": {
"state": {
"type": "string",
"title": "State"
},
"result": {
"anyOf": [
{
"items": {
"properties": {
"algorithm_name": {
"type": "string",
"title": "Algorithm Name"
},
"algorithm_name_compact": {
"type": "string",
"title": "Algorithm Name Compact"
},
"qasm": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Qasm"
},
"success": {
"type": "boolean",
"title": "Success"
},
"metrics": {
"anyOf": [
{
"properties": {
"n_gates": {
"type": "integer",
"title": "N Gates"
},
"n_layers": {
"type": "integer",
"title": "N Layers"
},
"n_cnots": {
"type": "integer",
"title": "N Cnots"
},
"n_layers_cnots": {
"type": "integer",
"title": "N Layers Cnots"
},
"synthesize_time": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"title": "Synthesize Time"
}
},
"type": "object",
"required": [
"n_gates",
"n_layers",
"n_cnots",
"n_layers_cnots"
],
"title": "BaseMetrics"
},
{
"type": "null"
}
]
}
},
"type": "object",
"required": [
"algorithm_name",
"algorithm_name_compact",
"success"
],
"title": "BenchmarkResult"
},
"type": "array"
},
{
"type": "null"
}
],
"title": "Result"
}
},
"type": "object",
"required": [
"state"
],
"title": "TaskBenchmarkResultResponse"
}
Synthesize Permutation circuit
Returns a task ID; use the '/permutations/synthesize/{taskId}' endpoint to get the result.
Query Parameters
Name, Type | Description |
---|---|
model string | |
backend string | The name of the backend. Refer to https://docs.quantum.ibm.com/run/get-backend-information. |
topology string | |
qubits integer | |
check_result boolean | If true, the RL model will check the result before returning a response Default value: false |
n_steps integer | The number of attempts (aka steps) that the RL model should perform to find the best synthesized circuit |
keep_layout boolean |
Body Parameters (application/json)
Name, Type | Description |
---|---|
permutation Required integer[] | Example: [0,1,2,3,4] |
coupling_map integer[][] | null | Example: [[0,1],[1,0],[1,2],[2,1]] |
HTTP Response Status Codes
Status code | Description |
---|---|
200 | Successful Response |
422 | Validation Error |
Code samples
POST
/permutations/synthesizecurl -X POST \
https://cloud-transpiler.quantum.ibm.com/permutations/synthesize \
-H 'Authorization: Bearer YOUR-TOKEN' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{"permutation":[0,1,2,3,4]}'
import requests
response = requests.request(
"POST",
"https://cloud-transpiler.quantum.ibm.com/permutations/synthesize",
headers={
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN_HERE"
},
data="{\"permutation\":[0,1,2,3,4]}"
)
print(response.json())
Responses
{
"task_id": "example"
}
{
"properties": {
"task_id": {
"type": "string",
"title": "Task Id"
}
},
"type": "object",
"required": [
"task_id"
],
"title": "TaskIdResponse"
}
Get synthesis result
Code samples
GET
/permutations/synthesize/{task_id}curl -X GET \
https://cloud-transpiler.quantum.ibm.com/permutations/synthesize/{task_id} \
-H 'Authorization: Bearer YOUR-TOKEN' \
-H 'Accept: application/json'
import requests
response = requests.request(
"GET",
"https://cloud-transpiler.quantum.ibm.com/permutations/synthesize/{task_id}",
headers={
"Accept": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN_HERE"
},
)
print(response.json())
Responses
{
"state": "example",
"result": null
}
{
"properties": {
"state": {
"type": "string",
"title": "State"
},
"result": {
"anyOf": [
{
"properties": {
"qasm": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Qasm"
},
"success": {
"type": "boolean",
"title": "Success"
},
"layout": {
"anyOf": [
{
"properties": {
"initial": {
"items": {
"type": "integer"
},
"type": "array",
"title": "Initial"
},
"final": {
"items": {
"type": "integer"
},
"type": "array",
"title": "Final"
}
},
"type": "object",
"required": [
"initial",
"final"
],
"title": "LayoutResult",
"description": "Enum for layout result"
},
{
"type": "null"
}
]
},
"error": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Error"
}
},
"type": "object",
"required": [
"success"
],
"title": "RlResult",
"description": "Enum for Rl Result information"
},
{
"items": {
"properties": {
"qasm": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Qasm"
},
"success": {
"type": "boolean",
"title": "Success"
},
"layout": {
"anyOf": [
{
"properties": {
"initial": {
"items": {
"type": "integer"
},
"type": "array",
"title": "Initial"
},
"final": {
"items": {
"type": "integer"
},
"type": "array",
"title": "Final"
}
},
"type": "object",
"required": [
"initial",
"final"
],
"title": "LayoutResult",
"description": "Enum for layout result"
},
{
"type": "null"
}
]
},
"error": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Error"
}
},
"type": "object",
"required": [
"success"
],
"title": "RlResult",
"description": "Enum for Rl Result information"
},
"type": "array"
},
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Result"
}
},
"type": "object",
"required": [
"state"
],
"title": "TaskResultResponse"
}
Get available topologies
Code samples
GET
/permutations/topologiescurl -X GET \
https://cloud-transpiler.quantum.ibm.com/permutations/topologies \
-H 'Authorization: Bearer YOUR-TOKEN' \
-H 'Accept: application/json'
import requests
response = requests.request(
"GET",
"https://cloud-transpiler.quantum.ibm.com/permutations/topologies",
headers={
"Accept": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN_HERE"
},
)
print(response.json())
Responses
[
"example"
]
{
"type": "array",
"items": {
"type": "string"
},
"title": "Response Topologies Permutations Topologies Get"
}
Transpile Permutation circuit(s)
Returns a task ID; use the '/permutations/transpile/{taskId}' endpoint to get the result.
Body Parameters (application/json)
Name, Type | Description |
---|---|
permutation Required integer[][] | integer[] | Example: [[0,1,3,4,2],[1,0,3,4,2]] Example: [1,0,2,3,4] |
qargs Required integer[][] | integer[] | Example: [[0,1,2,3,4],[0,1,2,3,4]] Example: [0,1,2,3,4] |
backend_coupling_map integer[][] | null | Example: [[1,2],[2,1]] |
HTTP Response Status Codes
Status code | Description |
---|---|
200 | Successful Response |
422 | Validation Error |
Code samples
POST
/permutations/transpilecurl -X POST \
https://cloud-transpiler.quantum.ibm.com/permutations/transpile \
-H 'Authorization: Bearer YOUR-TOKEN' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{"permutation":[[0,1,3,4,2],[1,0,3,4,2]],"qargs":[[0,1,2,3,4],[0,1,2,3,4]]}'
import requests
response = requests.request(
"POST",
"https://cloud-transpiler.quantum.ibm.com/permutations/transpile",
headers={
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN_HERE"
},
data="{\"permutation\":[[0,1,3,4,2],[1,0,3,4,2]],\"qargs\":[[0,1,2,3,4],[0,1,2,3,4]]}"
)
print(response.json())
Responses
{
"task_id": "example"
}
{
"properties": {
"task_id": {
"type": "string",
"title": "Task Id"
}
},
"type": "object",
"required": [
"task_id"
],
"title": "TaskIdResponse"
}
Get transpilation result
Code samples
GET
/permutations/transpile/{task_id}curl -X GET \
https://cloud-transpiler.quantum.ibm.com/permutations/transpile/{task_id} \
-H 'Authorization: Bearer YOUR-TOKEN' \
-H 'Accept: application/json'
import requests
response = requests.request(
"GET",
"https://cloud-transpiler.quantum.ibm.com/permutations/transpile/{task_id}",
headers={
"Accept": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN_HERE"
},
)
print(response.json())
Responses
{
"state": "example",
"result": null
}
{
"properties": {
"state": {
"type": "string",
"title": "State"
},
"result": {
"anyOf": [
{
"properties": {
"qasm": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Qasm"
},
"success": {
"type": "boolean",
"title": "Success"
},
"layout": {
"anyOf": [
{
"properties": {
"initial": {
"items": {
"type": "integer"
},
"type": "array",
"title": "Initial"
},
"final": {
"items": {
"type": "integer"
},
"type": "array",
"title": "Final"
}
},
"type": "object",
"required": [
"initial",
"final"
],
"title": "LayoutResult",
"description": "Enum for layout result"
},
{
"type": "null"
}
]
},
"error": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Error"
}
},
"type": "object",
"required": [
"success"
],
"title": "RlResult",
"description": "Enum for Rl Result information"
},
{
"items": {
"properties": {
"qasm": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Qasm"
},
"success": {
"type": "boolean",
"title": "Success"
},
"layout": {
"anyOf": [
{
"properties": {
"initial": {
"items": {
"type": "integer"
},
"type": "array",
"title": "Initial"
},
"final": {
"items": {
"type": "integer"
},
"type": "array",
"title": "Final"
}
},
"type": "object",
"required": [
"initial",
"final"
],
"title": "LayoutResult",
"description": "Enum for layout result"
},
{
"type": "null"
}
]
},
"error": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Error"
}
},
"type": "object",
"required": [
"success"
],
"title": "RlResult",
"description": "Enum for Rl Result information"
},
"type": "array"
},
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Result"
}
},
"type": "object",
"required": [
"state"
],
"title": "TaskResultResponse"
}
Was this page helpful?
Report a bug or request content on GitHub.