Postprocess Measurement Counts
Improve sampled QUBO solutions with Haiqu’s classical post-processing.
Use this tool after a QAOA or VQE sampling run to turn noisy measured bitstrings into better solutions. It applies bit-flip local search against the QUBO objective and runs synchronously, so results come back immediately.
When to Use:
- Call this after
run_circuits_on_qpu_or_simulatorreturns counts for a QUBO problem, which is the last step of the QAOA workflow. - Call this when the user asks for the best solution or objective value rather than the raw measurement distribution.
Constraints:
- Provide exactly one of
countsorrun_job_id. Preferrun_job_idso large count dictionaries stay out of the tool call. lp_problemmust be the same objective the circuit was built from, otherwise the reported costs are meaningless.- Only the best
max_solutionssolutions are returned; the response reportstotal_solutionsand setstruncatedwhen it omits some.
Notes:
- Report
best_bitstringandbest_costfirst; the solution list is supporting detail. - Implausible costs usually mean the LP problem does not match the circuit that produced the counts, not a post-processing failure.
Args: user: Authenticated user resolved from the API key. data: Problem definition plus inline counts or a run job reference. db: Active database session.
Returns: The best solutions found, ordered by objective value, with a summary.
Raises:
HTTPException: Raised with 400 when neither or both count inputs are
given, 404 when a referenced job is unavailable, 409 when the
referenced job has no usable counts, or 500 when post-processing
fails.
Authorizations
Body
Define payload for post-processing QUBO measurement counts.
Attributes:
lp_problem: QUBO problem in LP file format.
counts: Measured bitstring counts to optimize.
run_job_id: Run job whose stored results supply counts.
params: Optional post-processing parameter overrides.
max_solutions: Cap on how many solutions are returned inline.
QUBO problem serialized in LP file format.
Measured bitstring counts, for example {'0101': 120, '1010': 87}. Provide this or run_job_id, not both.
Run job whose stored measurement results are used as counts, so large count dictionaries never have to be passed inline. Provide this or counts.
Optional overrides: method (none, bitflip_incremental, bitflip_steepest_descent), postprocess_iterations, use_fast_eval, seed.
Maximum number of solutions returned inline, best cost first.
1 <= x <= 500Response
Successful Response
Represent post-processed QUBO solutions, truncated for tool output.
Attributes:
best_bitstring: Lowest-cost solution found.
best_cost: Objective value of best_bitstring.
solutions: Best solutions as bitstring / cost / count
entries, ordered by cost.
returned_solutions: Number of entries in solutions.
total_solutions: Number of solutions the post-processor produced.
truncated: Whether solutions omits some results.
context: Summary of the outcome and how to read it.