The command line gains gradient, optimize, vqe, qaoa and build, and run, plan and submit take --param; verify checks an optimisation's chain and runs any of these answers again to the same bytes. Both MCP servers serve gradient_qasm, optimize_qasm, vqe_ground_state, qaoa_maxcut and build_algorithm in one wording, and a job's params on run_quantum_circuit. The job service answers POST /v1/gradient, /v1/optimize, /v1/vqe, /v1/qaoa and /v1/build within its own bounds (J031 past them, naming the local command). The page engine gains variational(op, args), its gradient the native build's pinned bytes in wasm32. Every answer follows the new schema wai.quantum.algorithms/1; the agent docs are regenerated. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1464 lines
38 KiB
JSON
1464 lines
38 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://git.transaction.science/Transaction-Science/open-standards/raw/branch/main/wai/wai-quantum/schemas/algorithms.v1.json",
|
|
"title": "wai.quantum.algorithms/1",
|
|
"description": "An answer of the variational and algorithm library as every host gives it (engine::variational and engine::algorithms: gradient_qasm, optimize_qasm, vqe_ground_state, qaoa_maxcut and build_algorithm on both servers, wai-quantum gradient, optimize, vqe, qaoa and build, POST /v1/gradient, /v1/optimize, /v1/vqe, /v1/qaoa and /v1/build, and the Studio): the request, and the result sealed in a job's form. A result names the engine that made it and this schema (engine and schema) and the call that made it. docs/variational.md explains each.",
|
|
"type": "object",
|
|
"required": [
|
|
"request",
|
|
"result"
|
|
],
|
|
"properties": {
|
|
"request": {
|
|
"type": "object",
|
|
"description": "The call's request, as given."
|
|
},
|
|
"result": {
|
|
"$ref": "#/$defs/result"
|
|
}
|
|
},
|
|
"$defs": {
|
|
"result": {
|
|
"description": "A gradient, an optimisation, a VQE, a QAOA run or a built program, with its receipt.",
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/$defs/gradient"
|
|
},
|
|
{
|
|
"$ref": "#/$defs/optimize"
|
|
},
|
|
{
|
|
"$ref": "#/$defs/vqe"
|
|
},
|
|
{
|
|
"$ref": "#/$defs/qaoa"
|
|
},
|
|
{
|
|
"$ref": "#/$defs/build"
|
|
}
|
|
]
|
|
},
|
|
"gradient": {
|
|
"type": "object",
|
|
"description": "A Hamiltonian's expectation at the request's params and its exact gradient by each parameter (engine::variational::gradient).",
|
|
"required": [
|
|
"call",
|
|
"value",
|
|
"gradient",
|
|
"params",
|
|
"method",
|
|
"how",
|
|
"evaluations",
|
|
"qubits",
|
|
"gates",
|
|
"moved_gates",
|
|
"parameters",
|
|
"terms",
|
|
"precision"
|
|
],
|
|
"properties": {
|
|
"engine": {
|
|
"type": "object",
|
|
"description": "The engine that made the result: the wai-quantum crate's name and version.",
|
|
"required": [
|
|
"name",
|
|
"version"
|
|
],
|
|
"properties": {
|
|
"name": {
|
|
"const": "wai-quantum"
|
|
},
|
|
"version": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"schema": {
|
|
"const": "wai.quantum.algorithms/1"
|
|
},
|
|
"call": {
|
|
"const": "gradient"
|
|
},
|
|
"receipt": {
|
|
"$ref": "receipt.v2.json"
|
|
},
|
|
"value": {
|
|
"type": "number",
|
|
"description": "⟨ψ|H|ψ⟩ at the params."
|
|
},
|
|
"gradient": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "number"
|
|
},
|
|
"description": "∂E/∂p for each parameter p, by name."
|
|
},
|
|
"params": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "number"
|
|
},
|
|
"description": "The point, by name."
|
|
},
|
|
"method": {
|
|
"enum": [
|
|
"adjoint",
|
|
"parameter_shift"
|
|
]
|
|
},
|
|
"how": {
|
|
"type": "string"
|
|
},
|
|
"evaluations": {
|
|
"type": "integer",
|
|
"minimum": 0,
|
|
"description": "Circuit evaluations (adjoint: the forward run and each gate derivative applied; parameter shift: each shifted run)."
|
|
},
|
|
"qubits": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"gates": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"moved_gates": {
|
|
"type": "integer",
|
|
"minimum": 0,
|
|
"description": "Gates a parameter moves."
|
|
},
|
|
"parameters": {
|
|
"type": "array",
|
|
"description": "The program's parameters, in the order it declares them.",
|
|
"items": {
|
|
"type": "object",
|
|
"required": [
|
|
"name",
|
|
"type"
|
|
],
|
|
"properties": {
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"type": {
|
|
"enum": [
|
|
"float",
|
|
"angle",
|
|
"float[64]"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"terms": {
|
|
"type": "integer",
|
|
"minimum": 0,
|
|
"description": "The Hamiltonian's Pauli terms."
|
|
},
|
|
"precision": {
|
|
"type": "object",
|
|
"description": "What the arithmetic is: IEEE-754 double precision, approximate, and an a priori bound on each reported number's rounding (first order in 2^-53, doubled), from the value the same circuit has in exact arithmetic.",
|
|
"required": [
|
|
"arithmetic",
|
|
"exact",
|
|
"rounding_bound",
|
|
"reading"
|
|
],
|
|
"properties": {
|
|
"arithmetic": {
|
|
"const": "f64"
|
|
},
|
|
"exact": {
|
|
"const": false
|
|
},
|
|
"rounding_bound": {
|
|
"type": "object",
|
|
"required": [
|
|
"value"
|
|
],
|
|
"properties": {
|
|
"value": {
|
|
"type": "number",
|
|
"minimum": 0
|
|
},
|
|
"gradient": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "number",
|
|
"minimum": 0
|
|
},
|
|
"description": "Each component's bound, by parameter."
|
|
}
|
|
}
|
|
},
|
|
"reading": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"optimize": {
|
|
"type": "object",
|
|
"description": "An optimisation of a Hamiltonian's expectation over the program's parameters, every step a link of a digest chain from the request (engine::variational::optimize).",
|
|
"required": [
|
|
"call",
|
|
"optimizer",
|
|
"qubits",
|
|
"gates",
|
|
"parameters",
|
|
"terms",
|
|
"start",
|
|
"steps",
|
|
"chain",
|
|
"best",
|
|
"final",
|
|
"evaluations",
|
|
"precision"
|
|
],
|
|
"properties": {
|
|
"engine": {
|
|
"type": "object",
|
|
"description": "The engine that made the result: the wai-quantum crate's name and version.",
|
|
"required": [
|
|
"name",
|
|
"version"
|
|
],
|
|
"properties": {
|
|
"name": {
|
|
"const": "wai-quantum"
|
|
},
|
|
"version": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"schema": {
|
|
"const": "wai.quantum.algorithms/1"
|
|
},
|
|
"call": {
|
|
"const": "optimize"
|
|
},
|
|
"receipt": {
|
|
"$ref": "receipt.v2.json"
|
|
},
|
|
"optimizer": {
|
|
"type": "object",
|
|
"required": [
|
|
"name",
|
|
"steps",
|
|
"step_size"
|
|
],
|
|
"properties": {
|
|
"name": {
|
|
"enum": [
|
|
"gradient_descent",
|
|
"adam",
|
|
"spsa"
|
|
]
|
|
},
|
|
"steps": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"step_size": {
|
|
"type": "number"
|
|
},
|
|
"gradient": {
|
|
"enum": [
|
|
"adjoint",
|
|
"parameter_shift"
|
|
]
|
|
},
|
|
"beta1": {
|
|
"type": "number"
|
|
},
|
|
"beta2": {
|
|
"type": "number"
|
|
},
|
|
"epsilon": {
|
|
"type": "number"
|
|
},
|
|
"c": {
|
|
"type": "number"
|
|
},
|
|
"A": {
|
|
"type": "number"
|
|
},
|
|
"alpha": {
|
|
"type": "number"
|
|
},
|
|
"gamma": {
|
|
"type": "number"
|
|
},
|
|
"seed": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
}
|
|
}
|
|
},
|
|
"qubits": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"gates": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"parameters": {
|
|
"type": "array",
|
|
"description": "The program's parameters, in the order it declares them.",
|
|
"items": {
|
|
"type": "object",
|
|
"required": [
|
|
"name",
|
|
"type"
|
|
],
|
|
"properties": {
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"type": {
|
|
"enum": [
|
|
"float",
|
|
"angle",
|
|
"float[64]"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"terms": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"start": {
|
|
"type": "string",
|
|
"minLength": 64,
|
|
"maxLength": 64,
|
|
"description": "The chain's first link: BLAKE3 of the domain wai.quantum.trace/1 and the request's canonical text."
|
|
},
|
|
"steps": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"required": [
|
|
"step",
|
|
"params",
|
|
"value",
|
|
"digest"
|
|
],
|
|
"properties": {
|
|
"step": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"params": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "number"
|
|
}
|
|
},
|
|
"value": {
|
|
"type": "number"
|
|
},
|
|
"gradient": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "number"
|
|
},
|
|
"description": "Gradient descent and Adam: the gradient at the step's params."
|
|
},
|
|
"perturbation": {
|
|
"type": "array",
|
|
"items": {
|
|
"enum": [
|
|
1.0,
|
|
-1.0
|
|
]
|
|
},
|
|
"description": "SPSA: the step's perturbation, from the seeded stream."
|
|
},
|
|
"estimate": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "number"
|
|
},
|
|
"description": "SPSA: the gradient's estimate."
|
|
},
|
|
"gains": {
|
|
"type": "object",
|
|
"required": [
|
|
"a",
|
|
"c"
|
|
],
|
|
"properties": {
|
|
"a": {
|
|
"type": "number"
|
|
},
|
|
"c": {
|
|
"type": "number"
|
|
}
|
|
},
|
|
"description": "SPSA: the step's gains a_k and c_k."
|
|
},
|
|
"digest": {
|
|
"type": "string",
|
|
"minLength": 64,
|
|
"maxLength": 64,
|
|
"description": "This step's link of the chain: BLAKE3 of the previous link and the step's canonical text without its digest."
|
|
}
|
|
}
|
|
},
|
|
"minItems": 2
|
|
},
|
|
"chain": {
|
|
"type": "string",
|
|
"minLength": 64,
|
|
"maxLength": 64,
|
|
"description": "The chain's last link."
|
|
},
|
|
"best": {
|
|
"type": "object",
|
|
"required": [
|
|
"step",
|
|
"params",
|
|
"value"
|
|
],
|
|
"properties": {
|
|
"step": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"params": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "number"
|
|
}
|
|
},
|
|
"value": {
|
|
"type": "number"
|
|
}
|
|
}
|
|
},
|
|
"final": {
|
|
"type": "object",
|
|
"required": [
|
|
"step",
|
|
"params",
|
|
"value"
|
|
],
|
|
"properties": {
|
|
"step": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"params": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "number"
|
|
}
|
|
},
|
|
"value": {
|
|
"type": "number"
|
|
}
|
|
}
|
|
},
|
|
"evaluations": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"precision": {
|
|
"type": "object",
|
|
"description": "What the arithmetic is: IEEE-754 double precision, approximate, and an a priori bound on each reported number's rounding (first order in 2^-53, doubled), from the value the same circuit has in exact arithmetic.",
|
|
"required": [
|
|
"arithmetic",
|
|
"exact",
|
|
"rounding_bound",
|
|
"reading"
|
|
],
|
|
"properties": {
|
|
"arithmetic": {
|
|
"const": "f64"
|
|
},
|
|
"exact": {
|
|
"const": false
|
|
},
|
|
"rounding_bound": {
|
|
"type": "object",
|
|
"required": [
|
|
"value"
|
|
],
|
|
"properties": {
|
|
"value": {
|
|
"type": "number",
|
|
"minimum": 0
|
|
},
|
|
"gradient": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "number",
|
|
"minimum": 0
|
|
},
|
|
"description": "Each component's bound, by parameter."
|
|
}
|
|
}
|
|
},
|
|
"reading": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"note": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"vqe": {
|
|
"type": "object",
|
|
"description": "The variational eigensolver: an optimisation, and the exact ground energy by diagonalisation beside the energy found (engine::variational::vqe).",
|
|
"required": [
|
|
"call",
|
|
"optimizer",
|
|
"qubits",
|
|
"gates",
|
|
"parameters",
|
|
"terms",
|
|
"start",
|
|
"steps",
|
|
"chain",
|
|
"best",
|
|
"final",
|
|
"evaluations",
|
|
"precision",
|
|
"reference"
|
|
],
|
|
"properties": {
|
|
"engine": {
|
|
"type": "object",
|
|
"description": "The engine that made the result: the wai-quantum crate's name and version.",
|
|
"required": [
|
|
"name",
|
|
"version"
|
|
],
|
|
"properties": {
|
|
"name": {
|
|
"const": "wai-quantum"
|
|
},
|
|
"version": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"schema": {
|
|
"const": "wai.quantum.algorithms/1"
|
|
},
|
|
"call": {
|
|
"const": "vqe"
|
|
},
|
|
"receipt": {
|
|
"$ref": "receipt.v2.json"
|
|
},
|
|
"optimizer": {
|
|
"type": "object",
|
|
"required": [
|
|
"name",
|
|
"steps",
|
|
"step_size"
|
|
],
|
|
"properties": {
|
|
"name": {
|
|
"enum": [
|
|
"gradient_descent",
|
|
"adam",
|
|
"spsa"
|
|
]
|
|
},
|
|
"steps": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"step_size": {
|
|
"type": "number"
|
|
},
|
|
"gradient": {
|
|
"enum": [
|
|
"adjoint",
|
|
"parameter_shift"
|
|
]
|
|
},
|
|
"beta1": {
|
|
"type": "number"
|
|
},
|
|
"beta2": {
|
|
"type": "number"
|
|
},
|
|
"epsilon": {
|
|
"type": "number"
|
|
},
|
|
"c": {
|
|
"type": "number"
|
|
},
|
|
"A": {
|
|
"type": "number"
|
|
},
|
|
"alpha": {
|
|
"type": "number"
|
|
},
|
|
"gamma": {
|
|
"type": "number"
|
|
},
|
|
"seed": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
}
|
|
}
|
|
},
|
|
"qubits": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"gates": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"parameters": {
|
|
"type": "array",
|
|
"description": "The program's parameters, in the order it declares them.",
|
|
"items": {
|
|
"type": "object",
|
|
"required": [
|
|
"name",
|
|
"type"
|
|
],
|
|
"properties": {
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"type": {
|
|
"enum": [
|
|
"float",
|
|
"angle",
|
|
"float[64]"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"terms": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"start": {
|
|
"type": "string",
|
|
"minLength": 64,
|
|
"maxLength": 64,
|
|
"description": "The chain's first link: BLAKE3 of the domain wai.quantum.trace/1 and the request's canonical text."
|
|
},
|
|
"steps": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"required": [
|
|
"step",
|
|
"params",
|
|
"value",
|
|
"digest"
|
|
],
|
|
"properties": {
|
|
"step": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"params": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "number"
|
|
}
|
|
},
|
|
"value": {
|
|
"type": "number"
|
|
},
|
|
"gradient": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "number"
|
|
},
|
|
"description": "Gradient descent and Adam: the gradient at the step's params."
|
|
},
|
|
"perturbation": {
|
|
"type": "array",
|
|
"items": {
|
|
"enum": [
|
|
1.0,
|
|
-1.0
|
|
]
|
|
},
|
|
"description": "SPSA: the step's perturbation, from the seeded stream."
|
|
},
|
|
"estimate": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "number"
|
|
},
|
|
"description": "SPSA: the gradient's estimate."
|
|
},
|
|
"gains": {
|
|
"type": "object",
|
|
"required": [
|
|
"a",
|
|
"c"
|
|
],
|
|
"properties": {
|
|
"a": {
|
|
"type": "number"
|
|
},
|
|
"c": {
|
|
"type": "number"
|
|
}
|
|
},
|
|
"description": "SPSA: the step's gains a_k and c_k."
|
|
},
|
|
"digest": {
|
|
"type": "string",
|
|
"minLength": 64,
|
|
"maxLength": 64,
|
|
"description": "This step's link of the chain: BLAKE3 of the previous link and the step's canonical text without its digest."
|
|
}
|
|
}
|
|
},
|
|
"minItems": 2
|
|
},
|
|
"chain": {
|
|
"type": "string",
|
|
"minLength": 64,
|
|
"maxLength": 64,
|
|
"description": "The chain's last link."
|
|
},
|
|
"best": {
|
|
"type": "object",
|
|
"required": [
|
|
"step",
|
|
"params",
|
|
"value"
|
|
],
|
|
"properties": {
|
|
"step": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"params": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "number"
|
|
}
|
|
},
|
|
"value": {
|
|
"type": "number"
|
|
}
|
|
}
|
|
},
|
|
"final": {
|
|
"type": "object",
|
|
"required": [
|
|
"step",
|
|
"params",
|
|
"value"
|
|
],
|
|
"properties": {
|
|
"step": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"params": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "number"
|
|
}
|
|
},
|
|
"value": {
|
|
"type": "number"
|
|
}
|
|
}
|
|
},
|
|
"evaluations": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"precision": {
|
|
"type": "object",
|
|
"description": "What the arithmetic is: IEEE-754 double precision, approximate, and an a priori bound on each reported number's rounding (first order in 2^-53, doubled), from the value the same circuit has in exact arithmetic.",
|
|
"required": [
|
|
"arithmetic",
|
|
"exact",
|
|
"rounding_bound",
|
|
"reading"
|
|
],
|
|
"properties": {
|
|
"arithmetic": {
|
|
"const": "f64"
|
|
},
|
|
"exact": {
|
|
"const": false
|
|
},
|
|
"rounding_bound": {
|
|
"type": "object",
|
|
"required": [
|
|
"value"
|
|
],
|
|
"properties": {
|
|
"value": {
|
|
"type": "number",
|
|
"minimum": 0
|
|
},
|
|
"gradient": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "number",
|
|
"minimum": 0
|
|
},
|
|
"description": "Each component's bound, by parameter."
|
|
}
|
|
}
|
|
},
|
|
"reading": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"note": {
|
|
"type": "string"
|
|
},
|
|
"reference": {
|
|
"anyOf": [
|
|
{
|
|
"type": "object",
|
|
"required": [
|
|
"ground_energy",
|
|
"how",
|
|
"gap"
|
|
],
|
|
"properties": {
|
|
"ground_energy": {
|
|
"type": "number"
|
|
},
|
|
"first_excited": {
|
|
"anyOf": [
|
|
{
|
|
"type": "number"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"how": {
|
|
"type": "string"
|
|
},
|
|
"gap": {
|
|
"type": "number",
|
|
"description": "The best energy found above the ground energy."
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "object",
|
|
"required": [
|
|
"unchecked"
|
|
],
|
|
"properties": {
|
|
"unchecked": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"ansatz": {
|
|
"type": "object",
|
|
"required": [
|
|
"qasm",
|
|
"params",
|
|
"kind"
|
|
],
|
|
"properties": {
|
|
"qasm": {
|
|
"type": "string"
|
|
},
|
|
"params": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "number"
|
|
}
|
|
},
|
|
"kind": {
|
|
"const": "hardware_efficient"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"qaoa": {
|
|
"type": "object",
|
|
"description": "Max-Cut by QAOA: the program and Hamiltonian built from the graph, optimised, and the cut set beside the maximum cut by brute force (engine::variational::qaoa).",
|
|
"required": [
|
|
"call",
|
|
"optimizer",
|
|
"qubits",
|
|
"gates",
|
|
"parameters",
|
|
"terms",
|
|
"start",
|
|
"steps",
|
|
"chain",
|
|
"best",
|
|
"final",
|
|
"evaluations",
|
|
"precision",
|
|
"graph",
|
|
"layers",
|
|
"program",
|
|
"hamiltonian",
|
|
"maxcut"
|
|
],
|
|
"properties": {
|
|
"engine": {
|
|
"type": "object",
|
|
"description": "The engine that made the result: the wai-quantum crate's name and version.",
|
|
"required": [
|
|
"name",
|
|
"version"
|
|
],
|
|
"properties": {
|
|
"name": {
|
|
"const": "wai-quantum"
|
|
},
|
|
"version": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"schema": {
|
|
"const": "wai.quantum.algorithms/1"
|
|
},
|
|
"call": {
|
|
"const": "qaoa"
|
|
},
|
|
"receipt": {
|
|
"$ref": "receipt.v2.json"
|
|
},
|
|
"optimizer": {
|
|
"type": "object",
|
|
"required": [
|
|
"name",
|
|
"steps",
|
|
"step_size"
|
|
],
|
|
"properties": {
|
|
"name": {
|
|
"enum": [
|
|
"gradient_descent",
|
|
"adam",
|
|
"spsa"
|
|
]
|
|
},
|
|
"steps": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"step_size": {
|
|
"type": "number"
|
|
},
|
|
"gradient": {
|
|
"enum": [
|
|
"adjoint",
|
|
"parameter_shift"
|
|
]
|
|
},
|
|
"beta1": {
|
|
"type": "number"
|
|
},
|
|
"beta2": {
|
|
"type": "number"
|
|
},
|
|
"epsilon": {
|
|
"type": "number"
|
|
},
|
|
"c": {
|
|
"type": "number"
|
|
},
|
|
"A": {
|
|
"type": "number"
|
|
},
|
|
"alpha": {
|
|
"type": "number"
|
|
},
|
|
"gamma": {
|
|
"type": "number"
|
|
},
|
|
"seed": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
}
|
|
}
|
|
},
|
|
"qubits": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"gates": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"parameters": {
|
|
"type": "array",
|
|
"description": "The program's parameters, in the order it declares them.",
|
|
"items": {
|
|
"type": "object",
|
|
"required": [
|
|
"name",
|
|
"type"
|
|
],
|
|
"properties": {
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"type": {
|
|
"enum": [
|
|
"float",
|
|
"angle",
|
|
"float[64]"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"terms": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"start": {
|
|
"type": "string",
|
|
"minLength": 64,
|
|
"maxLength": 64,
|
|
"description": "The chain's first link: BLAKE3 of the domain wai.quantum.trace/1 and the request's canonical text."
|
|
},
|
|
"steps": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"required": [
|
|
"step",
|
|
"params",
|
|
"value",
|
|
"digest"
|
|
],
|
|
"properties": {
|
|
"step": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"params": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "number"
|
|
}
|
|
},
|
|
"value": {
|
|
"type": "number"
|
|
},
|
|
"gradient": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "number"
|
|
},
|
|
"description": "Gradient descent and Adam: the gradient at the step's params."
|
|
},
|
|
"perturbation": {
|
|
"type": "array",
|
|
"items": {
|
|
"enum": [
|
|
1.0,
|
|
-1.0
|
|
]
|
|
},
|
|
"description": "SPSA: the step's perturbation, from the seeded stream."
|
|
},
|
|
"estimate": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "number"
|
|
},
|
|
"description": "SPSA: the gradient's estimate."
|
|
},
|
|
"gains": {
|
|
"type": "object",
|
|
"required": [
|
|
"a",
|
|
"c"
|
|
],
|
|
"properties": {
|
|
"a": {
|
|
"type": "number"
|
|
},
|
|
"c": {
|
|
"type": "number"
|
|
}
|
|
},
|
|
"description": "SPSA: the step's gains a_k and c_k."
|
|
},
|
|
"digest": {
|
|
"type": "string",
|
|
"minLength": 64,
|
|
"maxLength": 64,
|
|
"description": "This step's link of the chain: BLAKE3 of the previous link and the step's canonical text without its digest."
|
|
}
|
|
}
|
|
},
|
|
"minItems": 2
|
|
},
|
|
"chain": {
|
|
"type": "string",
|
|
"minLength": 64,
|
|
"maxLength": 64,
|
|
"description": "The chain's last link."
|
|
},
|
|
"best": {
|
|
"type": "object",
|
|
"required": [
|
|
"step",
|
|
"params",
|
|
"value"
|
|
],
|
|
"properties": {
|
|
"step": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"params": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "number"
|
|
}
|
|
},
|
|
"value": {
|
|
"type": "number"
|
|
}
|
|
}
|
|
},
|
|
"final": {
|
|
"type": "object",
|
|
"required": [
|
|
"step",
|
|
"params",
|
|
"value"
|
|
],
|
|
"properties": {
|
|
"step": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"params": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "number"
|
|
}
|
|
},
|
|
"value": {
|
|
"type": "number"
|
|
}
|
|
}
|
|
},
|
|
"evaluations": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"precision": {
|
|
"type": "object",
|
|
"description": "What the arithmetic is: IEEE-754 double precision, approximate, and an a priori bound on each reported number's rounding (first order in 2^-53, doubled), from the value the same circuit has in exact arithmetic.",
|
|
"required": [
|
|
"arithmetic",
|
|
"exact",
|
|
"rounding_bound",
|
|
"reading"
|
|
],
|
|
"properties": {
|
|
"arithmetic": {
|
|
"const": "f64"
|
|
},
|
|
"exact": {
|
|
"const": false
|
|
},
|
|
"rounding_bound": {
|
|
"type": "object",
|
|
"required": [
|
|
"value"
|
|
],
|
|
"properties": {
|
|
"value": {
|
|
"type": "number",
|
|
"minimum": 0
|
|
},
|
|
"gradient": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "number",
|
|
"minimum": 0
|
|
},
|
|
"description": "Each component's bound, by parameter."
|
|
}
|
|
}
|
|
},
|
|
"reading": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"note": {
|
|
"type": "string"
|
|
},
|
|
"graph": {
|
|
"type": "object",
|
|
"required": [
|
|
"nodes",
|
|
"edges"
|
|
],
|
|
"properties": {
|
|
"nodes": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"edges": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "array",
|
|
"minItems": 3,
|
|
"maxItems": 3
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"layers": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"program": {
|
|
"type": "string"
|
|
},
|
|
"hamiltonian": {
|
|
"type": "array"
|
|
},
|
|
"maxcut": {
|
|
"type": "object",
|
|
"required": [
|
|
"max_cut",
|
|
"optimal",
|
|
"optimal_count",
|
|
"how",
|
|
"expected_cut",
|
|
"ratio",
|
|
"most_likely",
|
|
"p_optimal",
|
|
"bits"
|
|
],
|
|
"properties": {
|
|
"max_cut": {
|
|
"type": "number"
|
|
},
|
|
"optimal": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"optimal_count": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"how": {
|
|
"type": "string"
|
|
},
|
|
"expected_cut": {
|
|
"type": "number"
|
|
},
|
|
"ratio": {
|
|
"type": "number"
|
|
},
|
|
"most_likely": {
|
|
"type": "object",
|
|
"required": [
|
|
"bits",
|
|
"probability",
|
|
"cut",
|
|
"optimal"
|
|
],
|
|
"properties": {
|
|
"bits": {
|
|
"type": "string"
|
|
},
|
|
"probability": {
|
|
"type": "number"
|
|
},
|
|
"cut": {
|
|
"type": "number"
|
|
},
|
|
"optimal": {
|
|
"type": "boolean"
|
|
}
|
|
}
|
|
},
|
|
"p_optimal": {
|
|
"type": "number"
|
|
},
|
|
"bits": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"build": {
|
|
"type": "object",
|
|
"description": "A program an algorithm builder writes (engine::algorithms): its text, how to read it, what it gives, and the equivalence ladder's verdict against a reference built from the definitions.",
|
|
"required": [
|
|
"call",
|
|
"algorithm",
|
|
"qasm",
|
|
"qubits",
|
|
"gates",
|
|
"reads",
|
|
"expected",
|
|
"check"
|
|
],
|
|
"properties": {
|
|
"engine": {
|
|
"type": "object",
|
|
"description": "The engine that made the result: the wai-quantum crate's name and version.",
|
|
"required": [
|
|
"name",
|
|
"version"
|
|
],
|
|
"properties": {
|
|
"name": {
|
|
"const": "wai-quantum"
|
|
},
|
|
"version": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"schema": {
|
|
"const": "wai.quantum.algorithms/1"
|
|
},
|
|
"call": {
|
|
"const": "build"
|
|
},
|
|
"receipt": {
|
|
"$ref": "receipt.v2.json"
|
|
},
|
|
"algorithm": {
|
|
"enum": [
|
|
"qpe",
|
|
"amplitude_estimation",
|
|
"adder",
|
|
"qsvt"
|
|
]
|
|
},
|
|
"qasm": {
|
|
"type": "string"
|
|
},
|
|
"qubits": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"gates": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"reads": {
|
|
"type": "object",
|
|
"description": "How to read the program's result."
|
|
},
|
|
"expected": {
|
|
"type": "object",
|
|
"description": "What it gives: a distribution's likeliest outcomes, a sum, or a polynomial's value."
|
|
},
|
|
"check": {
|
|
"type": "object",
|
|
"required": [
|
|
"verdict",
|
|
"how",
|
|
"why"
|
|
],
|
|
"properties": {
|
|
"verdict": {
|
|
"enum": [
|
|
"equivalent",
|
|
"different",
|
|
"unchecked"
|
|
]
|
|
},
|
|
"how": {
|
|
"enum": [
|
|
"exact",
|
|
"random",
|
|
"none"
|
|
]
|
|
},
|
|
"why": {
|
|
"type": "string"
|
|
},
|
|
"global_phase": {
|
|
"type": "number"
|
|
},
|
|
"reference": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"verify": {
|
|
"type": "object",
|
|
"description": "Whether a sealed answer of the library holds: its receipt over the request and the result, an optimisation's digest chain, and the answer run again to the same bytes (every call is deterministic and carries no clock).",
|
|
"required": [
|
|
"valid",
|
|
"signed",
|
|
"chain",
|
|
"rerun",
|
|
"key"
|
|
],
|
|
"properties": {
|
|
"valid": {
|
|
"type": "boolean"
|
|
},
|
|
"signed": {
|
|
"type": "boolean"
|
|
},
|
|
"chain": {
|
|
"type": [
|
|
"boolean",
|
|
"null"
|
|
],
|
|
"description": "An optimisation's chain: every step's digest the link over that step, from the request; null for an answer with no steps."
|
|
},
|
|
"rerun": {
|
|
"type": "boolean"
|
|
},
|
|
"rerun_error": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"key": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"description": "The signing key, 32 bytes in hex."
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|