Kinship

Planning thalassaemia cascade screening in Pakistan with a quantum circuit that cannot break the kit limit

One child is diagnosed. Four kits for the family. Who gets tested?

A synthetic family, S-16. No patient data is used anywhere.

Every relative has a carrier probability, computed exactly from the family tree.

The obvious rule tests the most likely carriers. It confirms no couple at all.

The circuit tests couples instead. Its measured plan is the exact optimum.

1The problem in Pakistan

Thalassaemia runs in families. Test kits and field visits do not stretch that far.

A child gets thalassaemia major only when both parents are carriers, so screening starts from the relatives of a patient.

0%
of people in Pakistan carry beta-thalassaemia1
0
children born with thalassaemia major each year, an estimate1
0%
of tested relatives in families with an affected child were carriers, against 0 of 397 in control families1
0%
of ever-married women are married to a first cousin3

Cascade screening finds couples

In the study that introduced it in Pakistan, 17 of 214 married couples in families with an affected child were both carriers, which is 8%. Among 350 randomly chosen pregnant women there was no at-risk couple at all.1

Field capacity is limited

The Punjab Thalassaemia Prevention Project covers all 36 districts of Punjab from nine regional centres with 48 field officers, and reports that uptake of cascade testing among relatives is low.2

The law is moving

In 2026 the National Assembly and the Senate passed a compulsory thalassaemia screening bill for the Islamabad Capital Territory. It asks for premarital screening reports and for screening and counselling of patients' blood relatives.4

Who it serves. Field officers planning one home visit, and programme managers spreading kits across families. Every family in this project is synthetic and seeded. No patient data is used anywhere.

2Why it is an optimisation problem

The value sits on couples, not on individuals.

A couple's risk is known only when both partners are tested, so the value of a plan sits on pairs.

One kit used. No at-risk couple can be confirmed.
Two kits used. At-risk couple found with probability w.

Pair risk is not a product of single risks

The father of an affected child is a carrier, so almost surely exactly one of his own parents is. Each grandparent alone is a carrier with probability 51%, yet both together only with probability 2.6%.

2.6%
exact joint probability from the pedigree engine
26%
what multiplying the two single probabilities would give

The simple rule misses the best plan

On 50 seeded families with 10 relatives and 4 kits, "test the highest carrier probabilities" missed the best plan in of them.

of the best plan's value, on average, with 10 relatives
with 16 relatives and 5 kits
3Formulation

Choose exactly k relatives to maximise the expected number of at-risk couples found.

maxx ∈ {0,1}n   ∑(i,j) ∈ C cij wij xi xj  +  λ ∑i ri pi xi subject to   ∑i xi = k

expected at-risk couples found, exact and not an approximation    a small reward for single carriers found

Variables, objective, constraint

ElementDefinition
xi1 if relative i is tested in this visit, otherwise 0
wijprobability that i and j are both carriers, computed from the family tree
cijprobability that the couple link is real: 1 for married or engaged, lower for a possible future match between cousins
piprobability that i is a carrier
rirelevance of knowing: 1.0 unmarried or engaged adult, 0.7 married, 0.5 child, 0.1 elder
λweight of the single-carrier term, 0.05 by default
Constraintexactly k people are tested; people who are absent or decline are fixed to 0

Where the weights come from

A pedigree engine applies Mendel's rules to the family tree, given the affected child and a 5% population carrier rate, and computes every probability exactly, loops from cousin marriages included. It is checked against textbook values before any optimisation runs.

Relative of the affected childTextbookEngine

Test instances

SizeRelatives (qubits)Kits kValid plansUsed for
S104210brute force, noise study, the live plan below
M1654,368main simulator results, trade-off curve
L48 in 4 linked families12about 7 × 1010exact integer programme, decomposition
4Live plan

One synthetic family, five ways to spend the kits.

Instance : relatives can be tested and there are kits. Switch between the plans. Hover a person to see the carrier probability the engine computed.

man woman affected child married engaged possible match number = carrier probability
5Quantum method

A circuit that can only output plans with exactly k kits.

One qubit per relative, one rotation per couple, and a mixer that can never change the number of kits.

Problem pieceQuantum pieceQiskit building block
Is relative i tested?Qubit i, state |1⟩ means testedQuantumCircuit
Couple weight cijwijZZ rotation on qubits i and jrzz, SparsePauliOp
Single weight λripiZ rotation on qubit irz
Exactly k testsDicke start state and XY ring mixercx, cry, ry, XXPlusYYGate
Tuning the anglesClassical optimiser loopAer EstimatorV2 + SciPy COBYLA
Reading out plansSampling the circuitAer SamplerV2
Step 1

One qubit per relative

Measuring a qubit as 1 means "test this person". A measured bitstring is a complete screening plan. Ten relatives need ten qubits.

Step 2

Start in a Dicke state

The start state is an equal superposition of every plan that uses exactly k kits and nothing else. Qiskit has no built-in Dicke state, so the circuit is built from gates with the deterministic scheme of Bärtschi and Eidenbenz: order k·n gates and no helper qubits.6

Step 3

Cost layer on the couple graph

One ZZ rotation per couple link and one Z rotation per relative. Each plan picks up a phase proportional to its objective value. A test confirms that the circuit energy equals the objective for every one of the 2n inputs.

Step 4

XY ring mixer

Each XX+YY rotation swaps a tested and an untested neighbour. The number of ones never changes, so the circuit moves amplitude between valid plans only.9 Cost and mixer are repeated p times.

Step 5

Tune, then measure

The Estimator primitive returns the expected objective, COBYLA tunes the 2p angles, and the Sampler primitive reads out plans. Deeper circuits start from the tuned angles of the previous depth.10 The best measured plan goes to the field officer.

q0q1q2q3q4q5 repeated p times, angles γ and β tuned by COBYLA Dickestate exactly k ones RZRZRZRZRZRZ cost: ZZ on couples mixer: XX+YY swaps 101001 a valid plan

Baseline: penalty QAOA

Standard QAOA starts from all 2n bitstrings and subtracts a penalty A·(∑xi − k)2 for using the wrong number of kits. That needs a ZZ rotation on every pair of qubits, and the optimiser spends its effort on the penalty. At depth 3 with 16 qubits only of its shots are valid plans.

How hard is the problem?

With equal weights it is the densest-k-subgraph problem, which is NP-hard, and the best known efficient algorithm only guarantees a factor of about n1/4.12 That is a worst-case statement about general graphs. Family graphs are sparse, and section 9 says plainly what that means for the instances here.

Our one-sentence answer to "why quantum"We do not claim a speedup. We show a problem QAOA represents directly, a circuit that cannot break the kit limit, and an honest comparison against exact answers.
Measured live

Every shot is a plan for the visit.

The depth-3 circuit, measured twice a second in your browser. A lit square means "test this relative".

0shots so far
0%were the best plan
0.48%for a random pick
The circuit, as you scroll

210 plans, all equally likely

Ten qubits, one per relative, start in the Dicke state: every way to spend exactly four kits, with the same amplitude. Each bar is one plan, from the worst on the left to the best on the right.

Cost layer

The phase turns, the heights stay

One ZZ rotation per couple link and one Z rotation per relative. No plan becomes more likely yet. Each one's phase turns by an amount set by its value, so the colours fan out from worst to best.

Mixer

Phase becomes probability

XX+YY rotations swap a tested and an untested relative, so plans one swap apart interfere. Good plans grow and bad ones shrink, and the number of kits never changes.

Layers two and three

Each layer sharpens the plan

The same two steps repeat with their own angles, tuned by COBYLA on the Qiskit Estimator. Watch the chance of the best plan rise from 0.48% at the start.

Measurement

One shot in twelve is the best plan

After three layers a single shot is the best plan 8.31% of the time, 17 times a random pick, and every shot uses exactly four kits. The best of the measured plans goes to the field officer.

Exact simulation of the depth-3 Qiskit circuit in your browser, with the trained angles. It matches Qiskit to 1e-16.

6Plan a visit

Plan a visit, then watch the circuit do it.

Tap anyone who is not at home, choose the kits, and the circuit is tuned and measured for that visit in your browser.

  1. 1Tap anyone who is not at home or declines
  2. 2Choose how many kits you have
  3. 3Read the plan: who to test, and why
tested in this plan can be tested not available today couple both tested
Kits for this visit 4
The plan below is the best of 4,096 shots from the circuit.

How the circuit found that plan

Depth p
worst plancolour = phase of the amplitudebest plan

The circuit starts in the Dicke state: every plan with exactly 4 kits, all equally likely.

Explore the circuit: tune the angles, measure shots, compare with standard QAOA

The landscape the optimiser climbs

Expected value for every pair of first-layer angles. Click or drag to move the angles; brighter is better.

β1γ1

Measure it

A measurement returns one plan, a string of bits where 1 means "test this relative". The best of the measured plans goes to the field officer.

No shots yet.

Why the kit limit is built into the circuit

Standard QAOA cannot hold a rule like "exactly 4 kits". It starts from every bitstring and has to learn the rule from a penalty term. Both circuits below are simulated exactly at the depth chosen above, with the angles tuned for this visit. Bars show where the shots land, by the number of kits a measured plan uses.

Standard QAOA with a penalty
Constrained QAOA, this project

7Architecture

Classical code prepares and checks. The quantum circuit proposes the plans.

1  Family generatorpedigree.pyseeded synthetic familiescousin and exchange marriages 2  Genetics enginegenetics.pyMendel's rules, exact inferencecarrier p and couple w 3  Problem builderproblem.pyobjective and exactly-k ruleQUBO and Ising coefficients 4  Classical referencesclassical.pybrute force, integer programmefield rule, greedy, annealing 5  Quantum module in Qiskit Circuitcircuits.pyDicke state, RZZcost, XY mixer Estimatorqaoa.pyexpected value,COBYLA tunes angles Samplerqaoa.py, noise.pymeasured plans,noise model 6  Decompositiondecompose.pysplit along couple linksone circuit per componentdynamic programme sharesout the kits 7  Evaluationevaluate.py, plots.pyquality, chance of best planvalid shots, noise sweeptrade-off curvefixed seeds, saved results 8  Outputsscreening plan on the family tree  |  results and figures  |  report and this website

Parts 1 to 4 and 6 to 7 are classical Python. Part 5 is the quantum component: the circuit is built, tuned and sampled through Qiskit primitives on the Aer simulator. The plan that reaches the field officer is a measured bitstring from that circuit.

8Results

Measured against the exact answer, every time.

Every number is measured against the exact optimum. Noise-free simulation unless stated.

quality at depth 3, 16 qubits. A random pick:
×
more often the best plan than a random pick, 16 qubits
100%
of shots keep exactly k kits. Penalty QAOA:
people
in linked families, solved exactly with circuits of at most qubits

Is the problem trivial? No.

10 relatives, 4 kits

Each dot is one family. 100% is the best plan.

16 relatives, 5 kits

Each dot is one family. 100% is the best plan.

QAOA against random picks and the field rule

Constrained QAOAPenalty QAOARandom valid planField officer's rule

Quality, 10 qubits

Mean over families; whiskers are one standard deviation.

Quality, 16 qubits

Mean over families. Penalty QAOA stays near the random line.

Chance that one shot is the best plan, 10 qubits

Percent per shot, log scale.

Chance that one shot is the best plan, 16 qubits

Percent per shot, log scale.

Where the shots land

Where the measured plans fall, worst to best.
Random valid planConstrained QAOA, p = 1Constrained QAOA, p = 3
worst planplan qualitybest plan

Valid shots and circuit cost

Shots within the kit limit, then CZ gates per circuit.

Basis RZ, SX, X, CZ with all-to-all connectivity, optimisation level 3. The constrained circuit pays for its Dicke start state.

Under noise

Aer noise model on the 10-qubit instances: a depolarising error after every CZ gate (the horizontal axis shows its probability), a tenth of that on single-qubit gates, and a readout error at twice the CZ rate. Shots without exactly k ones are discarded and the surviving share is reported. No real quantum processor was used.

Constrained, p = 1Constrained, p = 2Penalty, p = 1Penalty, p = 2

Valid shots

Percent of shots with exactly k kits.

Quality of valid shots

Dotted line: random valid plan.

Chance of the best plan

Percent per shot, all shots counted.

Couples against carriers

Each point is a plan: couples found against carriers found.
Exact trade-off frontBest plans among QAOA shotsField ruleRelevance rule

Linked families: 48 relatives, 12 kits

Share of the optimum proven by an integer programme.

Full table

Every number comes from results/benchmark.json, produced by python -m kinship.evaluate all.

Quality is computed over valid shots; "best plan per shot" counts all shots. Shots for 95%: shots needed to see the best plan with 95% probability, median over families. Returns the best plan: for classical rules, the share of families where the rule's plan is optimal; for QAOA, the share where the best of 4,096 measured plans is optimal.

9Limitations and what did not work

What the numbers do not show.

No quantum speedup

Brute force gives the exact answer for the 10- and 16-qubit instances in milliseconds, and simulated annealing found the best plan in of the 16-qubit families. At these sizes a classical solver wins. Tuning the angles for one 16-qubit family alone took about circuit evaluations, to choose among 4,368 plans. This is a method study on a new problem.

Family graphs are sparse

The couple graph splits into small pieces: the largest connected component has people on average in the 16-relative families (at most ). An exact dynamic programme over those pieces solves the problem, so worst-case hardness results do not apply to these instances.

Expected quality is modest

At depth 3 constrained QAOA reaches on 16 qubits. A classical greedy heuristic reaches . QAOA beats the field rule and random picks, not the stronger classical heuristics.

Penalty QAOA barely beats random

Its valid shots score against for a random valid plan on 16 qubits, and of its shots break the kit limit at depth 3.

A cheaper start state failed

Starting from the field officer's plan instead of the Dicke state needs only k X gates, but at depth 3 its chance of the best plan was against for the Dicke start, on small instances.

Noise costs most of the shots

The Dicke start state alone takes CZ gates on 10 qubits. At 1% two-qubit error only of constrained shots still use exactly k kits.

Simulator only

No real quantum processor was used. The noise model is generic and assumes all-to-all connectivity; on a line of qubits the depth-1 circuit grows from to CZ gates.

Sampling flatters small instances

With thousands of shots and only 210 or 4,368 valid plans, even uniform sampling usually contains the best plan. That is why the charts report the chance per shot and the expected quality, not the best of all shots.

Depth-3 numbers depend on the platform

Many depth-3 runs stop at the optimiser's iteration limit. The same code in a Linux container ended at different angles in of constrained runs. The mean gain at 16 qubits is there against here; the median is in both. Depths 1 and 2 and every classical result are identical.

Synthetic families, simple genetics

Families are generated, not observed. The average carrier share among testable relatives is against 31% in the 2002 study. The model covers one visit, one gene, a perfect test, and no step-by-step testing. The kit budget as the binding limit and the field officer's rule as the baseline are our assumptions, not programme protocol.

Ethics

A tool that ranks relatives by genetic risk can stigmatise people. This one uses synthetic data only, treats consent as an input (anyone who declines is fixed to "not tested"), publishes no individual scores, and is meant to support a counsellor's plan for one visit, not to label people or to decide who may marry.

What we would do next

Ask a thalassaemia centre whether kits, laboratory slots or officer time is the real limit; model step-by-step testing where one result updates the next choice; calibrate families against programme data; and run the smallest instance on a real IBM processor with angles trained on the simulator.

10Reproduce and credits

Run it yourself in four commands.

# Python 3.11 or later
pip install -r requirements.txt
python -m kinship.demo            # one family, one plan, about 20 s
python -m kinship.evaluate all    # the results behind this page
pytest                            # 57 checks

Versions used: Qiskit , Qiskit Aer , NumPy , SciPy , Python . Results generated . On this page the live circuit is our own JavaScript, checked against Qiskit; the scroll effects use GSAP 3.12.5 and Lenis 1.1.13 from the jsDelivr CDN, and the page works without them.

Deliverables

Code and resultsgithub.com/AbdulAHAD968/Qiskit-IBM
Live siteqiskit.sevenlabs.site
Report with architecture diagramreport/Kinship_QAOA_Report.docx
Benchmark reportDOCS/BENCHMARKS.md
Limitations and ethicsDOCS/LIMITATIONS.md
SB
Syed Muhammad Saad Bukhari
Team member
AA
Abdul Ahad
Team member
F
Faizan
Team member

References

  1. Ahmed S, Saleem M, Modell B, Petrou M. Screening extended families for genetic hemoglobin disorders in Pakistan. N Engl J Med. 2002;347(15):1162-1168. doi:10.1056/NEJMsa013234
  2. Ahmed S, Jafri H, Faran M, Ahmed WN, Rashid Y, Ehsan Y, Ahmed M. Cascade screening for beta-thalassaemia in Pakistan: relatives' experiences of a decision support intervention in routine practice. Eur J Hum Genet. 2022;30(4):406-412. doi:10.1038/s41431-021-00974-y
  3. National Institute of Population Studies and ICF. Pakistan Demographic and Health Survey 2017-18. 2019. See also Iqbal S et al. BMC Women's Health. 2022;22:118. doi:10.1186/s12905-022-01704-2
  4. Dawn, 11 March 2026, report on the National Assembly passing the Islamabad Capital Territory compulsory thalassaemia screening bill, dawn.com/news/1980653; Associated Press of Pakistan, 11 May 2026, report on its passage by the Senate.
  5. Cook J, Eidenbenz S, Bärtschi A. The Quantum Alternating Operator Ansatz on Maximum k-Vertex Cover. IEEE QCE 2020, 83-92. arXiv:1910.13483
  6. Bärtschi A, Eidenbenz S. Deterministic Preparation of Dicke States. FCT 2019, LNCS, 126-139. arXiv:1904.07358
  7. Farhi E, Goldstone J, Gutmann S. A Quantum Approximate Optimization Algorithm. 2014. arXiv:1411.4028
  8. Hadfield S et al. From the Quantum Approximate Optimization Algorithm to a Quantum Alternating Operator Ansatz. Algorithms. 2019;12(2):34. doi:10.3390/a12020034
  9. Wang Z, Rubin NC, Dominy JM, Rieffel EG. XY mixers: analytical and numerical results for the quantum alternating operator ansatz. Phys Rev A. 2020;101:012320. arXiv:1904.09314
  10. Zhou L, Wang S-T, Choi S, Pichler H, Lukin MD. Quantum Approximate Optimization Algorithm: Performance, Mechanism, and Implementation on Near-Term Devices. Phys Rev X. 2020;10:021067. arXiv:1812.01041
  11. Kotil A et al. Quantum approximate multi-objective optimization. Nat Comput Sci. 2025;5:1168-1177. arXiv:2503.22797
  12. Bhaskara A, Charikar M, Chlamtac E, Feige U, Vijayaraghavan A. Detecting high log-densities: an O(n^1/4) approximation for densest k-subgraph. STOC 2010, 201-210. arXiv:1001.2891