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.
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.
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.
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.
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%.
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.
Choose exactly k relatives to maximise the expected number of at-risk couples found.
expected at-risk couples found, exact and not an approximation a small reward for single carriers found
Variables, objective, constraint
| Element | Definition |
|---|---|
| xi | 1 if relative i is tested in this visit, otherwise 0 |
| wij | probability that i and j are both carriers, computed from the family tree |
| cij | probability that the couple link is real: 1 for married or engaged, lower for a possible future match between cousins |
| pi | probability that i is a carrier |
| ri | relevance 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 |
| Constraint | exactly 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 child | Textbook | Engine |
|---|
Test instances
| Size | Relatives (qubits) | Kits k | Valid plans | Used for |
|---|---|---|---|---|
| S | 10 | 4 | 210 | brute force, noise study, the live plan below |
| M | 16 | 5 | 4,368 | main simulator results, trade-off curve |
| L | 48 in 4 linked families | 12 | about 7 × 1010 | exact integer programme, decomposition |
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.
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 piece | Quantum piece | Qiskit building block |
|---|---|---|
| Is relative i tested? | Qubit i, state |1〉 means tested | QuantumCircuit |
| Couple weight cijwij | ZZ rotation on qubits i and j | rzz, SparsePauliOp |
| Single weight λripi | Z rotation on qubit i | rz |
| Exactly k tests | Dicke start state and XY ring mixer | cx, cry, ry, XXPlusYYGate |
| Tuning the angles | Classical optimiser loop | Aer EstimatorV2 + SciPy COBYLA |
| Reading out plans | Sampling the circuit | Aer SamplerV2 |
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.
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
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.
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.
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.
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.
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".
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.
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.
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.
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.
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.
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.
- 1Tap anyone who is not at home or declines
- 2Choose how many kits you have
- 3Read the plan: who to test, and why
How the circuit found that 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.
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.
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.
Classical code prepares and checks. The quantum circuit proposes the plans.
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.
Measured against the exact answer, every time.
Every number is measured against the exact optimum. Noise-free simulation unless stated.
Is the problem trivial? No.
10 relatives, 4 kits
16 relatives, 5 kits
QAOA against random picks and the field rule
Quality, 10 qubits
Quality, 16 qubits
Chance that one shot is the best plan, 10 qubits
Chance that one shot is the best plan, 16 qubits
Where the shots land
Valid shots and circuit cost
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.
Valid shots
Quality of valid shots
Chance of the best plan
Couples against carriers
Linked families: 48 relatives, 12 kits
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.
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.
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 results | github.com/AbdulAHAD968/Qiskit-IBM |
| Live site | qiskit.sevenlabs.site |
| Report with architecture diagram | report/Kinship_QAOA_Report.docx |
| Benchmark report | DOCS/BENCHMARKS.md |
| Limitations and ethics | DOCS/LIMITATIONS.md |
References
- 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
- 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
- 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
- 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.
- 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
- Bärtschi A, Eidenbenz S. Deterministic Preparation of Dicke States. FCT 2019, LNCS, 126-139. arXiv:1904.07358
- Farhi E, Goldstone J, Gutmann S. A Quantum Approximate Optimization Algorithm. 2014. arXiv:1411.4028
- 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
- 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
- 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
- Kotil A et al. Quantum approximate multi-objective optimization. Nat Comput Sci. 2025;5:1168-1177. arXiv:2503.22797
- 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