One home visit.
Four test kits.
Which relatives do we test?
A planning tool for beta-thalassaemia cascade screening in Pakistan. It picks the relatives whose tests are expected to reveal the most at-risk couples, using a QAOA circuit in Qiskit that cannot break the kit limit, and it checks every answer against the exact optimum.
Thalassaemia runs in families. Test kits and field visits do not stretch that far.
Thalassaemia major appears when both parents are carriers. Screening teams start from a family that already has an affected child and test the relatives. This is cascade screening. Kits, laboratory capacity and home visits are limited, so on every visit someone has to choose who gets tested.
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.
An at-risk couple can only be confirmed when both partners are tested. One test can rule a couple out, but it can never confirm one. So the best choice depends on pairs of people, and the obvious rule, test whoever is most likely to be a carrier, spends kits on people whose partners go untested.
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.
The objective is a sum over pairs of yes-or-no decisions, which is the native form of the Quantum Approximate Optimization Algorithm.7 The kit limit is enforced by the structure of the circuit, as in the quantum alternating operator ansatz, so it needs no penalty term.8, 5
| 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 8 says plainly what that means for the instances here.
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.
All runs are noise-free statevector simulations unless stated, with fixed seeds. Quality is the expected value of a measured valid plan, scaled so that the worst valid plan is 0 and the best is 1; shots that break the kit limit are discarded first.
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.
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 # every number on this page pytest # 57 checks
Versions used: Qiskit , Qiskit Aer , NumPy , SciPy , Python . Results generated .
Deliverables
| Code and results | github.com/AbdulAHAD968/Qiskit-IBM |
| 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