# Optimal kidney exchange

Optimal kidney exchange (OKE) is an optimization problem faced by programs for kidney paired donations (also called Kidney Exchange Programs). Such programs have large databases of patient-donor pairs, where the donor is willing to donate a kidney in order to help the patient, but cannot do so due to medical incompatibility. The centers try to arrange exchanges between such pairs. For example, the donor in pair A donates to the patient in pair B, the donor in pair B donates to the patient in pair C, and the donor in pair C donates to the patient in pair A.
The objective of the OKE problem is to find an optimal arrangement of such exchanges. "Optimal" usually means that the number of transplants is as large as possible, but there may be other objectives. A crucial constraint in this optimization problem is that a donor gives a kidney only if his patient receives a compatible kidney, so that no pair loses a kidney from participating. This requirement is sometimes called individual rationality.
The OKE problem has many variants, which differ in the allowed size of each exchange, the objective function, and other factors.

## Definitions
### Input

An instance of OKE is usually described as a directed graph. Every node represents a patient-donor pair. A directed arc from pair A to pair B means that the donor in pair A is medically compatible with the patient in pair B (compatibility is determined based on the blood types of the donor and patient, as well as other factors such as particular antigens in their blood). A directed cycle in the compatibility graph represents a possible exchange. A directed cycle of size 2 (e.g. A -> B -> A) represents a possible pairwise exchange - an exchange between a pair of pairs.
A more general variant of OKE considers also nodes of a second type, that represent altruistic donors - donors who are not paired to a patient, and are willing to donate a kidney to any compatible patient. Altruistic donor nodes have only outgoing arcs. With altruistic donors, it is possible to arrange exchanges not only with cycles but also with chains, starting at an altruistic donor.
The arcs in the graph may have weights, representing e.g. the probability of success of the involved transplants. They may also have priorities, determined e.g. by medical urgency or by the time the patient have waited in the transplantation queue.

### Output

The output of an OKE is a set of pairwise-disjoint directed cycles (and possibly directed chains, if altruistic donors are available). The simplest objective in OKE is to maximize the number of patients who receive a kidney. Other common objectives are:
* Maximizing the weighted sum of kidney exchanges: Each edge in the graph has a weight, and the goal is to find an exchange that maximizes the sum of weights on all edges used in the exchange.
* Maximizing the life expectancy of the transplant candidates, or their quality-adjusted life expectancy.

## Unrestricted cycle length

Initially, the problem was studied without any bound on the length of the exchange cycles. Roth, Sonmez and Unver presented a mechanism, based on an extension of the top trading cycles mechanism, for finding exchange cycles in a Pareto-optimal and incentive-compatible way.
Abraham, Blum and Sandholm show that, with unbounded cycle length, a maximum-cardinality and maximum-weight exchange can be found in polynomial time. For example, to find a maximum-cardinality exchange, given the original directed graph G, construct an undirected bipartite graph H(X+Y, E) in which:
* Each pair j in G has two nodes: x$_j$ (representing the donor) and y$_j$ (representing the patient). They are connected by an edge of weight 1.
* For every edge i -> j in G, add in H an edge x$_i$ -- y$_j$ of weight 1+1/n.
* Find a maximum-weight matching in H.
Every maximum-cardinality exchange in G corresponds to a maximum-weight matching in H. Note that the weights guarantee that every maximum-weight matching in H is perfect, so that every patient is matched, either to a compatible donor, or to his own donor. So no donor gives a kidney unless his patient receives a kidney, which satisfies the requirement of individual rationality.
It is easy to extend this algorithm to maximum-weight exchanges, and to incorporate altruistic donors.

## Pairwise kidney exchange

In the discussions towards implementing a kidney exchange program in New England in 2004, it was found out that, logistically, only pairwise exchanges are possible. This is because all operations in an exchange must be done simultaneously. This requirement aims to ensure the individual rationality constraint - to avoid the risk that a donor refuses to donate after his patient has received a kidney. An exchange cycle of size k requires 2k simultaneous operations. At that time, it was not practical to arrange more than 4 simultaneous operations, so the size of cycles was limited to 2.
In this setting, it is possible to reduce the directed compatibility graph to an undirected graph, where pairs A and B are connected if and only if A->B and B->A. Finding a maximum-cardinality pairwise exchange is equivalent to finding a maximum cardinality matching in that undirected graph. Moreover, when only pairwise exchanges are allowed, a matching is Pareto-efficient if and only if it has maximum cardinality.$^{:Lem.1}$ Therefore, such an exchange can be found in polynomial time.
Roth, Sonmez and Unver study two extensions of the simple maximum-cardinality exchange:
* Given a priority ranking over the patients or the transplants, it is possible to find in polynomial time a priority matching - a matching that, among all maximum-cardinality matchings, maximizes the number of higher-priority patients. Moreover, these algorithms can be made incentive-compatible in the sense that each patient maximizes his chance of being matched by bringing as many donors as possible into the system, and by agreeing to accept as many kidneys as possible. The proofs use concepts from graph theory, such as the Gallai–Edmonds decomposition.
* It is possible to find a stochastic exchange, where a matching is selected at random from among all maximum-cardinality matchings. The egalitarian mechanism aims to maximize the smallest probability of a patient to receive a kidney. The egalitarian mechanism is incentive-compatible in the same sense as the priority mechanism.

## Cycles of length k

In later years, logistic improvements allowed the execution of larger number of simultaneous operations. Accordingly, exchange cycles involving three or more pairs were made possible. Finding a maximum-cardinality exchange is called, in graph theoretic terms, maximum cycle packing. Maximum cycle packing with cycles of length at most k, for any fixed k ≥ 3, is an NP-hard computational problem (this can be proved by reduction from the problem of 3-dimensional matching in a hypergraph).
Abraham, Blum and Sandholm present two techniques for maximum cycle packing: column generation and constraint generation. They report that column generation scales much better. Their algorithm have been implemented in the Alliance for Paired Kidney Donations.
Biro, Manlove and Rizzi suggest two approaches for solving this problem even when the edges have weights (in which case it is called maximum-weight cycle packing):
* An approximation algorithm based on known approximation algorithms for maximum-weight independent set;
* An exact algorithm, systematically checking all ways to convert the hypergraph of cycles into a graph. The algorithm runs in time $O(3^{s})$, where s is the size of a set containing one arc from each 3-cycle.

## Cycles of length k, and chains of unbounded length

Altruistic donors can be used to initiate a chain of exchanges, that is not a cycle. In such a chain, the operations need not be done simultaneously: it is possible to guarantee to each patient that he receives a kidney before his donor gives a kidney. If a donor defects, it breaks the chain, but it does not harm patients whose donor already gave a kidney, so it does not break individual rationality.
Anderson, Ashlagi, Gamarnik and Roth present two algorithms for finding a maximum-cardinality packing into cycles of length at most k and chains of unbounded length:
* One is based on integer linear programming and constraint generation;
* The other is based on a solution to the travelling salesman problem.

## Uncertain transplants

Early theoretic works in OKE assumed that, once a set of exchanges is determined, all of them will be executed. In practice, however, transplants might be cancelled. For example, the medical examination done just before the transplant might reveal that the donor is incompatible with the patient, even though in the database they are registered as compatible. Therefore, newer works aim to maximize the expected number of transplants. For example, Alvelos, Klimentova and Viana present a branch-and-price algorithm for this problem.

## Further references

* Integer-programming models for kidney exchange.