When a loan is approved for a person or company, the bank is subject to credit risk; the risk that the lender defaults. To mitigate this risk, a bank will require some form of security, which will be collected if the lender defaults. The bank opens a financial account for the loan, and one or more securities may be connected to it. It is also possible that a security object is connected to more than one account. Many-to-many relationships between securities and accounts rarely occur in the private market, but in the corporate market they are not uncommon.
We can model this situation by a bipartite graph. We have a set of securities and a set of accounts. Each security has a value and each account has an exposure . If a security can be used to secure an account , we have an edge from to . Let be the set of edges. The question is then how much of security ’s value should be used to secure account . Let us use to denote this value. Clearly, we cannot use a security to more than its value and we do not want to secure an account to more than its amount, i.e.,111All summations (except if a summation range is explicitly specified) with summation index are over , all summations with summation index are over and all summations with summation indices are over .
|for all securities||(1)|
|for all accounts .||(2)|
The unsecured part of the accounts is then . Clearly, we want to make the unsecured part as small as possible, i.e., we want
The surplus (unsecured part) of an account is equal to and the unsecured fraction or risk ratio of an account is equal to . It is desirable that all accounts are secured to the same fraction as much as possible. Formally, if security is used for account () and could be used for account (), then the unsecured fraction of account is at most the unsecured fraction of account (). Otherwise, we could divert some of the flow onto the edge and make the secured fractions more equal. Formally,
|if and then .||(4)|
We have now defined the ratio-balanced maximum flow problem: among the maximum flows satisfying the capacity constraints (1) and (2), find the one that satisfies the ratio-constraint (4). The following example illustrates the concept.
In the ratio-balanced maximum flow , , , and , and the ratios are and .
A related problem is to compute the flow that minimizes the squared 2-norm of the unsecured parts. This problem is known as balanced flows [DPSV08] and can be solved in polynomial time. The papers [DPSV08, DM16] suggested to us that ratio-balanced flows can be computed efficiently.
This paper is structured as follows. In Section 2, we give an alternative characterization for ratio-balanced maximum flows and show that they are the flows minimizing subject to the capacity constraints (1) and (2). In Section 3 we give a combinatorial algorithm and show that a ratio-balanced flow can be computed by at most maximum flow computation. This assumes that all values and exposures are integers bounded by . In Section 4 we give a quadratic program for ratio-balanced flows and in Section 5 we discuss generalizations.
2 Alternative Characterization
We call a flow minimizing an MWSR (minimum weighted sum of squared risk ratios) flow. Let and be two flows. We call and equivalent if the risk ratios of all accounts with respect to and are equal, i.e., for all , .
A flow is a ratio-balanced maximum flow if and only if it is MWSR. All ratio-balanced flows are equivalent.
We first show that an MWSR flow is maximum and satisfies the ratio-constraint (4). Thus an MWSR flow is ratio-balanced. We then go on to show that any two ratio-balanced flows are equivalent.
An MWSR flow subject to the capacity constraints is a maximum flow.
Assume otherwise and let be an MWSR flow. If is not a maximum flow then there is an augmenting path with respect to it, i.e., a sequence such that and for all , , and for all . We increase the flow on all edges by a small amount, decrease the flow on the edges by the same amount. We obtain a flow that obeys the capacity constraints and for which is smaller. ∎
An MWSR flow subject to the capacity constraints satisfies the ratio-constraint (4).
The derivative of the objective with respect to is equal to
Therefore decreasing the flow on by an infinitesimal amount and increasing the flow on by the same amount, will change the objective by
If , the change would be negative, a contradiction. ∎
We have shown that a MWSR flow is ratio-balanced. Now we prove that all ratio-balanced flows are equivalent. We may assume that every security node can be used for some account. Otherwise, we may simply remove the security. Let and be two ratio-balanced flows.
Our proof is by induction on the number of nodes in . If then and are equivalent. Assume and for every graph in which the number of security nodes is less than , and are equivalent. For any , let and be the risk-ratio of node under and respectively. For any and , let and be the flow from to under and respectively.
Without loss of generality we assume that the maximum risk ratio under the flow f is no smaller than the maximum risk ratio under the flow , i.e., .
If then for all and and are equivalent.
Now assume that . Let be the least secured nodes under . Let be the set of nodes is which send positive flow to nodes in under . Since is ratio-balanced, there is no edge from to nodes in and for and . Moreover, since any security node is connected to a such that , . Otherwise, more flow can be sent through contradicting being a maximum flow.
With respect to , the total outflow of the nodes in is equal to the total inflow of the nodes in :
With respect to , the total inflow of the nodes in is at most the total outflow of the nodes in (there might be flow from to ):
By definition of we have that for all . So for every , and also
which means that also in , all flow from goes into .
Now remove from the graph. The number of security nodes is reduced and according to the induction assumption, and are equivalent in the reduced graph. ∎
3 Combinatorial Algorithm
We now give the algorithm for computing a ratio-balanced flow . The algorithm works in phases. In each phase, it finds a maximum flow and subsets of and . We denote the flow determined in the -th phase by and the subsets by and . The flow agrees with on all edges from to and has flow zero on all edges from to .
Let be a rational number in and consider the following flow problem . We add a source node and an edge of capacity for every . We add a sink node and an edge of capacity for every . We set the capacity to for all edges from to .
Let be the maximum such that has a feasible solution. We discuss below how to find . Consider the residual network with respect to the maximum flow in and let and be the nodes that cannot be reached from by a path in the residual network. Remove and from the graph and recurse until either or is empty.
The flow is a maximum ratio-balanced flow.
Let and be the set of remaining securities and accounts in the beginning of -th step respectively; and . In the -th phase, the flow network has vertices on the -side and vertices on the -side. Let be the maximum such that has a feasible solution in the -th phase, let be the maximum flow in the -th phase and let and be the nodes that cannot be reached from by a path in the residual network with respect to .
Clearly for and and for and because of non-reachability in the residual network.
Also for , the security ratio is larger than because the residual network certifies that we can send more flow. Which means that if , .
So if then there exists such that and . There is no edge from to such that and for any such that , . Therefore, satisfies the ratio-constraint (4).
Next we prove that is a maximum flow.
If , then for all , . Otherwise would be reachable from .
Let be the number of steps. If , then the total flow under is . The total flow in a maximum flow cannot exceed this amount. So, is a maximum flow.
Now assume that . It means for every , . Hence, the total flow in is
Now let the total flow in a maximum flow be . Then
The last inequality holds because there is no edge from to . So any outflow from is inflow for . Therefore, is a maximum flow. ∎
We next show how to find efficiently. For this we assume that the and are integers and use to the denote their maximum. For any , let be the risk-ratio of node under .
For every , is a rational number with numerator and denominator bounded by .
If , the claim is obvious. So assume . Consider the such that . All flow into the nodes in comes from the nodes in and the total flow from to is equal to . All nodes in have the same risk-ratio. This ratio is equal to . ∎
[Pap79] Let be a fraction, both numerator and denominator of which are bounded by . Then can be determined by queries of form ”is ?”, where , and arithmetic operations on integers of size not greater than .
Instead of finding , we find which is also a fraction with both numerator and denominator bounded by . In order to answer each query, we check if has a feasible solution or not. If it does, then which means . Otherwise, or .
We need to find at most -values. For each one we need to answer queries. Each query is a maxflow-computation.
Let the ’s and ’s be integer and let be their maximum. A ratio-balanced flow can be computed with maxflow-computations.
For balanced flows (definition given in the introduction), the number of maxflow-computations can be reduced to a single parameterized flow computation [DM16]. The same improvement might be possible here.
4 Solution by Formulation as a Quadratic Program
The task “minimize subject to (1) and (2)” is a quadratic program. As such it can be (approximately) solved by any QP-package, e.g., CVXOPT[cvx]. For concreteness, we give the formulation as a standard QP problem in the notation used in CVXOPT.
for the all-ones column vector andfor the -th unit vector. We number the edges of the graph arbitrarily and use for the vector of flows. The matrices and connect the flow variables to the securities and accounts:
Figure 1 shows an example. We are now ready to formulate the objective function and the constraints as a QP.
In standard form, the exposure-weighted sum-of-squares error function can be written as follows:
so that and in Equation (5).
The goal is to write in the form . To do so, we expand the square by writing
We used the fact that since for every column . The diagonal matrix has in position . ∎
In matrix notation, the constraints are and and .
For the example in Figure 1, the CVXOPT package solves the QP in 10 milliseconds and the algorithm uses 5 iterations. The reported solution is
which gives (almost) equal risk ratios
We discuss some extensions.
Some accounts will be fully covered, meaning that their ’s will be zero. Let be the set of accounts that are fully covered and let be the securities sending flow to them. We restrict the flow problem to these accounts and securities and then proceed as in Section 3. Let be the maximum such that has a feasible solution. Consider the residual network with respect to the maximum flow in and let and be the nodes that cannot be reached from by a path in the residual network. Remove and from the graph and recurse until either and are empty. In the example below, , , , and . Next, we have , , , and and .
[column sep=8em, row sep=2em] v_1 = 1 [swap]ddr0 r1 & e_1 = 1, λ_1 = 1
v_2 = 2 dr2 &
v_3 = 3 r3 & e_2 = 1, λ_2 = 5
Limits to a Claim:
An account might contractually only have claim to parts of the security value. This is easily modeled by introducing an upper bound on the flow from a security to an account. The QP-algorithm and the combinatorial algorithm can handle such bounds.
In the real world, accounts are often arranged by their priority to a security object. If two accounts have prioritized claims to a security object, the account with highest priority (lowest priority number) gets its demand covered first. Remaining value goes to lower priority accounts. In the following example, we use parenthesized superscripts to denote priorities; account 2 has a lower priority (higher priority number) than account 3 on security 2. In other words, account 3 has “first rights.”
Assume we have different priority classes. The desired solution is a maximum flow on the edges of priority 1. Subject to this, it should be a maximum flow on the edges of priority 2, and so on. Subject to this, it should be a maximum flow on the edges of priority . Subject to this, the flow should be ratio-balanced.
In the example above, the desired solution is . The flow on the edges of priority 1 is 25 and the flow on the edges of priority 2 is 15. Subject to this the flow balances the uncovered fractions of accounts 1 and 2.
Frederic Dorn (Sparebanken Vest) suggested the use of minimum cost flows for modeling the priorities in combination with the objective for a balanced flow. Let be the priorities, let be the set of edges with priority and a small number. Consider now the following optimization problem, which is a QP.
subject to and (1) and (2). The first term in the objective sends as much flow as possible through the graph, but prioritizing first priority much stronger than second, the second much stronger than third, and so forth. The second term states that everything else being equal, a ratio-balanced flow is preferable.
- [cvx] CVXOPT: Python software for convex optimization.
- [DM16] Omar Darwish and Kurt Mehlhorn. Improved Balanced Flow Computation Using Parametric Flow. Information Processing Letters, pages 560–563, 2016.
- [DPSV08] Nikhil R. Devanur, Christos H. Papadimitriou, Amin Saberi, and Vijay V. Vazirani. Market equilibrium via a primal–dual algorithm for a convex program. J. ACM, 55(5):22:1–22:18, November 2008.
- [Pap79] Christos H. Papadimitriou. Efficient search for rationals. Information Processing Letters, 8(1):1 – 4, 1979.