Build Lr Qaoa Circuit Mcp
Build and store a linear-ramp QAOA circuit for a QUBO problem.
Use this tool to turn a combinatorial optimization problem into a runnable circuit without writing QASM. Generation is synchronous: the circuit is stored and returned immediately, with core analytics already computed.
When to Use:
- Call this when the user has a QUBO or MaxCut-style problem in LP format and wants to run QAOA on it.
- Call this instead of
submit_circuit_for_analyticswhen Haiqu should construct the ansatz rather than the caller.
Constraints:
lp_problemmust parse as an LP-format QUBO with binary variables.alphasandbetasmust each have lengthpwhen supplied. Omit both to use the linear ramp defined bydelta.- Nothing is executed here. Run the returned
idwithrun_circuits_on_qpu_or_simulator.
Notes:
- The linear-ramp schedule needs no classical outer loop, which is what makes LR-QAOA cheap compared with parameter-optimized QAOA.
- Keep the same
lp_problemstring forpostprocess_measurement_countsso the objective matches.
Args: user: Authenticated user resolved from the API key. data: Problem definition, layer count, and optional schedule. db: Active database session.
Returns: The stored circuit enriched with MCP context text.
Raises:
HTTPException: Raised with 404 when the experiment is not available to
the caller, or 500 when circuit generation fails.
Authorizations
Body
Define payload for building an LR-QAOA circuit from a QUBO problem.
Attributes: experiment_id: Parent experiment identifier for the generated circuit. lp_problem: QUBO problem in LP file format. p: Number of QAOA layers. name: Circuit name. alphas: Optional per-layer cost-Hamiltonian schedule. betas: Optional per-layer mixer schedule. delta: Linear-ramp slope used when no explicit schedule is given.
QUBO problem serialized in LP file format, the same format accepted by postprocess_measurement_counts.
Number of QAOA layers (circuit depth multiplier).
x >= 1Optional explicit per-layer cost-Hamiltonian angles. Length must equal p.
Optional explicit per-layer mixer angles. Length must equal p.
Linear-ramp slope used to derive the schedule when alphas/betas are omitted.
Response
Successful Response
Extend a stored circuit model with MCP context text.
Attributes: context: ai summary describing the circuit role in the workflow.
Class for circuit analytics calculation job status.
Submitted, Running analytics computation, Core metrics computation is done, Advanced metrics computation is done, Parameterized QML metrics computation is done, Evolution computation is done, Done, Error Data model for circuit metrics.