Browse documentation
Guided tutorials
Your first tracked experimentUnderstand what changedCompile and compare with WeylatticeQuantum Workflow
Workflow overviewCircuitsCircuit processingJobs & resultsWhat Spinorio capturesHow observation worksQiskit coverage referenceProjects
Projects & collaborationHilvarian
Optimization solverHelp
TroubleshootingDocs / Hilvarian / Optimization solver
Hilvarian Optimization Solver
Plan and run QAOA jobs from a Spinorio notebook and inspect the best solution found.
Plan a weighted MaxCut run
In an authenticated Spinorio Lab notebook, define the graph using one entry per undirected edge. Each edge contains two variable names and a weight. The local Aer executor runs the quantum circuits on a simulator.
from spinorio import Spinorio
client = Spinorio()
problem = {
"schema": "spinorio.solver.model.v1",
"problem_type": "maxcut",
"variables": ["a", "b", "c"],
"edges": [["a", "b", 2.0], ["b", "c", 3.0], ["a", "c", 1.0]],
}
plan = client.solver.plan(
problem=problem,
executor="local_aer",
strategy="auto",
budget={"max_total_shots": 100000},
)
plan.result(wait=True)Run the plan and retrieve the solution
After reviewing the plan, submit it in a new cell. Save the run ID so you can retrieve the result from a later session.
run = plan.run()
run_id = run.run_id
print(run_id)
result = run.result(wait=True, timeout=600)
resultInspect the returned solution for its assignment and objective. For this graph the maximum cut weight is 5, which gives you a reference for the result returned by the search.
run = client.solvers.get(run_id) # Set run_id to the ID you saved.
run.status()Choose a model and strategy
Hilvarian accepts weighted MaxCut, QUBO, and Ising models. Direct execution is limited by the capacity of the selected executor. For larger weighted MaxCut graphs, the multilevel strategy breaks the problem into smaller subproblems.