Pillar B · State as of 2026-08-18

What is a "Hamiltonian" and why does it appear in optimization?

A Hamiltonian, in the optimization context, is not quantum magic: it is your cost function translated into the format quantum machines minimize — energy. The chain is mechanical: business problem → cost function → QUBO → Ising → Hamiltonian; the minimum-energy configuration spells out the best solution. Two honest footnotes: constraints get encoded as penalty terms that can distort the landscape (a miscalibrated weight makes an infeasible answer win — we show it in four lines of arithmetic), and the fact that every NP problem can be written this way (Lucas, 2014) does not mean a quantum machine solves it better. Status as of: August 2026.
→ Leer en español
State as of: 2026-08-18

Status as of: August 2026. This is a definition post: it explains a term, works one example with visible arithmetic, and makes no new claims about who beats whom. Our measured verdicts on optimization are linked where relevant.

What does "Hamiltonian" actually mean?

In quantum mechanics, the Hamiltonian is the operator that represents the total energy of a system: feed it a state, and it tells you that state's energy (Nielsen & Chuang, Quantum Computation and Quantum Information, 2010). Physical systems tend to settle toward low-energy states — a ball rolls downhill.

Quantum optimization borrows exactly one idea from that: if a machine is good at finding low-energy states, then rewrite your cost function as an energy function, and "lowest energy" becomes "best solution." D-Wave's own documentation states it plainly: "when the solver finds its minimum, it is finding solutions to your problem" (D-Wave docs, QUBOs and Ising Models, accessed Aug 2026).

That is the entire trick. A Hamiltonian in an optimization pipeline is not new physics you need to learn — it is your cost function with different units. What deserves attention is the translation chain, because that is where the honest fine print lives.

How does a business problem become a Hamiltonian?

The chain has five mechanical steps. We will walk a deliberately tiny portfolio problem through all of them: pick exactly 2 of 3 assets to maximize expected return. Toy numbers, chosen so every step is checkable by hand: expected returns A = 8, B = 6, C = 5 (illustrative units, not market data).

FROM PROBLEM TO HAMILTONIAN1 · BUSINESS PROBLEMpick 2 of 3 assets, maximize expected return2 · COST FUNCTIONcost(x) = −return(x) + λ·(picked − 2)²3 · QUBObits x ∈ {0,1} — minimize a quadratic in x4 · ISINGspins s ∈ {−1,+1} — substitute s = 2x − 15 · HAMILTONIANsame coefficients, promoted to an operatorbookkeeping, not magic — the difficulty survives every step

Step 1 → 2 (cost function). Give each asset a bit: x_A, x_B, x_C, each 0 or 1 ("skip" or "pick"). Reward return, punish breaking the pick-exactly-2 rule with a penalty weight λ: cost(x) = −(8·x_A + 6·x_B + 5·x_C) + λ·(x_A + x_B + x_C − 2)². Minimizing cost now means "maximize return without breaking the rule" — if λ is set right. Hold that thought.

Step 2 → 3 (QUBO). Expand the square and the expression becomes a quadratic in binary variables — a QUBO, "Quadratic Unconstrained Binary Optimization": minimize x^T·Q·x for a matrix Q of numbers (D-Wave docs, accessed Aug 2026). No physics yet; this is bookkeeping.

Step 3 → 4 (Ising). Substitute s = 2x − 1, so bits {0,1} become spins {−1,+1}. The same function is now written as an Ising model — the format from magnetism: E(s) = Σ h_i·s_i + Σ J_ij·s_i·s_j, with "field" terms h and "coupling" terms J. D-Wave's docs call the conversion between QUBO and Ising "trivial" — it is a change of variables, nothing more (accessed Aug 2026).

Step 4 → 5 (Hamiltonian). Replace each spin s_i by the quantum operator Z_i acting on qubit i. The resulting operator is the cost Hamiltonian: its eigenstates are the 2^N possible portfolios, and each one's energy is exactly the cost your spreadsheet would compute. The lowest-energy state — the ground state — is the best portfolio. This is precisely the pipeline the standard tooling automates: Qiskit's optimization module converts a constrained problem to a QUBO and then to an Ising Hamiltonian in two documented calls (Qiskit Optimization, Converters for Quadratic Programs, accessed Aug 2026).

Here is the full enumeration for our toy problem — 8 portfolios, all checkable by hand:

Portfolio (bits) Return Violation (picked−2)² Cost at λ=10 Cost at λ=3
none (000) 0 4 40 12
A (100) 8 1 2 −5
B (010) 6 1 4 −3
C (001) 5 1 5 −2
A+B (110) 14 0 −14 — feasible winner −14
A+C (101) 13 0 −13 −13
B+C (011) 11 0 −11 −11
A+B+C (111) 19 1 −9 −16 — infeasible, wins

At λ = 10 the minimum is A+B: the two best assets, rule respected. The translation works.

Where does it appear in quantum algorithms?

Everywhere, under different names — which is why the word feels ubiquitous:

Where What the Hamiltonian is Who supplies it Source
QAOA the "cost Hamiltonian" — your objective, spin-encoded you (manufactured) Farhi, Goldstone & Gutmann, arXiv:1411.4028 (2014)
Quantum annealing the Ising energy the hardware relaxes toward you (manufactured) Kadowaki & Nishimori, Phys. Rev. E 58, 5355 (1998); D-Wave docs (Aug 2026)
VQE in chemistry the molecule's own energy operator nature (inherited) see our VQE explainer
Classical solvers (CP-SAT, Gurobi) none — constraints are consumed natively Qiskit converters tutorial (Aug 2026): the translation exists for the quantum side

QAOA alternates between your cost Hamiltonian and a "mixing" Hamiltonian, steering amplitude toward low-cost bitstrings (Farhi et al., 2014). Quantum annealing starts in the ground state of an easy Hamiltonian and slowly deforms it into yours, hoping the system stays in the ground state (Kadowaki & Nishimori, 1998). One distinction worth keeping: in optimization you manufacture the Hamiltonian out of a spreadsheet; in chemistry, VQE inherits it from nature — the molecule's energy operator exists whether or not you write it down. Same word, opposite provenance. And note the last table row: classical solvers never need this translation — it is the price of admission to quantum hardware, not a general improvement to your problem.

The fine print: what does the translation not buy you?

Footnote 1 — the penalty knob can silently change the problem. Real problems have constraints; the standard move is to encode them as squared penalty terms weighted by λ, exactly as we did. But λ is a knob you must choose, and the 2026 literature is blunt about both failure modes: "if λ are too small, the quantum solver may favor an infeasible state that yields a low value of the objective function," while too-large values mean "the energy landscape becomes dominated by the penalty terms, which mask the original objective function and can create a rugged optimization surface" — and "finding optimal values of λ is generally NP-hard" (Ferrari et al., arXiv:2606.25117, 2026). Our toy table shows the first failure concretely: drop λ from 10 to 3 and the infeasible buy-everything portfolio scores −16, beating every legal answer. The machine would return it confidently. Nothing broke — the formulation quietly stopped meaning what you meant. Published benchmarks of quantum portfolio optimization run into exactly this class of formulation trap; in the 2025 benchmark we cite in our portfolio verdict, QAOA and annealing variants failed to reach Gurobi's solutions on the same instances (arXiv:2509.17876, 2025).

ONE KNOB DECIDES THE WINNERcost of all 8 portfolios at λ = 10 (lower = better)none+40A+2B+4C+5A+B−14 ✓A+C−13B+C−11A+B+C−9drop λ to 3: A+B+C scores −16 and beats A+B (−14)an infeasible answer wins — the penalty decides, not the physics

Footnote 2 — formulable ≠ advantageous. In 2014, Andrew Lucas published Ising formulations for "many NP-complete and NP-hard problems, including all of Karp's 21 NP-complete problems," using at most a cubic number of spins in the problem size (Lucas, Front. Phys. 2:5, 2014; arXiv:1302.5843). It is a genuinely useful catalog — and it is routinely misread as a promise. That every one of these problems can be written as a Hamiltonian tells you nothing about whether a quantum machine minimizes that Hamiltonian faster than CP-SAT minimizes the original. The difficulty is conserved: finding the ground state of a general Ising model is itself NP-hard (Barahona, J. Phys. A 15, 3241, 1982). The translation relocates the hardness; it does not dissolve it. Whether the quantum side ever wins is a crossover question — and as of August 2026, the measured end-to-end scoreboard on useful problems stands at zero. One constructive corollary: a well-posed Hamiltonian over a named instance is exactly the "specific, bounded claim" that serious prize juries ask for — the formulation is where rigor starts, on both sides of the aisle.

Our own data, declared. Rosetta's sealed series V-0012 is a working instance of this exact chain: portfolio selection encoded as a QUBO with the budget constraint as a penalty term, solved by QAOA (p=2) against CP-SAT on the same instances — 20 sealed runs at n = 12/16/20 assets. CP-SAT found the proven optimum 20/20; QAOA landed 25–48% away, with the quantum side simulated noise-free (which favors it). Small problem class, declared as such; the classical baseline remains unbeaten in our ledger. See the portfolio verdict. We have no measurements suggesting the Hamiltonian route beats a strong classical solver in this class, and we claim none.

What we know / what we don't know

What we know. The Hamiltonian in optimization is a renamed cost function; the problem→QUBO→Ising→Hamiltonian chain is mechanical and documented by vendors and toolkits (D-Wave docs; Qiskit converters, accessed Aug 2026). Every problem in Karp's 21 admits such a formulation with at most cubic spin overhead (Lucas, 2014). Penalty encoding has two failure modes, quotable from the 2026 literature, and choosing the weight optimally is itself NP-hard (Ferrari et al., 2026). Ground-state finding for general Ising models is NP-hard (Barahona, 1982). In our own small measured class, the formulated-and-quantum-solved route lost to CP-SAT 20/20 (V-0012).

What we don't know. Whether smarter constraint handling (feasibility-preserving mixers, penalty scheduling, qubit-efficient encodings) closes the infeasibility trap in practice at useful scale — the 2026 proposals are young and benchmarked on narrow problem families. Whether any manufactured-Hamiltonian pipeline reaches a measured crossover on a commercially relevant instance — no such measurement exists as of August 2026, ours included. And whether the formulation overhead (cubic spins in the worst case, plus penalty calibration) leaves room for advantage even if hardware improves — that arithmetic has not been settled publicly for any named business problem.

Rosetta Q publishes verdicts with reproducible raw data. This is educational content, not a product claim.

Sources:
· Lucas — Ising formulations of many NP problems (Front. Phys. 2:5, 2014; arXiv:1302.5843)
· D-Wave documentation — QUBOs and Ising Models (accessed Aug 2026)
· Qiskit Optimization — Converters for Quadratic Programs (accessed Aug 2026)
· Ferrari et al. — Feasibility-driven QAOA with penalty scheduling (arXiv:2606.25117, 2026)
· Farhi, Goldstone & Gutmann — A Quantum Approximate Optimization Algorithm (arXiv:1411.4028, 2014)
· Kadowaki & Nishimori — Quantum annealing in the transverse Ising model (Phys. Rev. E 58, 5355, 1998)
· Barahona — On the computational complexity of Ising spin glass models (J. Phys. A 15, 3241, 1982)
· Portfolio optimization benchmark — QAOA/annealing vs Gurobi (arXiv:2509.17876, 2025)
· Nielsen & Chuang — Quantum Computation and Quantum Information (Cambridge, 2010)