# Ratio-Balanced Maximum Flows

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. Accounts can be secured by several securities and a security can be used for several accounts. The goal is to fractionally assign the securities to the accounts so as to balance the risk. This situation can be modelled by a bipartite graph. We have a set S of securities and a set A of accounts. Each security has a value v_i and each account has an exposure e_j. If a security i can be used to secure an account j, we have an edge from i to j. Let f_ij be part of security i's value used to secure account j. We are searching for a maximum flow that send at most v_i units out of node i ∈ S and at most e_j units into node j ∈ A. Then s_j = e_j - ∑_i f_ij is the unsecured part of account j. We are searching for the maximum flow that minimizes ∑_j s_j^2/e_j.

## Authors

• 3 publications
• 16 publications
• 1 publication
• ### Mining Bad Credit Card Accounts from OLAP and OLTP

Credit card companies classify accounts as a good or bad based on histor...
07/02/2018 ∙ by Sheikh Rabiul Islam, et al. ∙ 0

• ### Towards Fortifying the Multi-Factor-Based Online Account Ecosystem

With the rapid growth of online services, the number of online accounts ...
04/17/2021 ∙ by Weizhao Jin, et al. ∙ 0

• ### Zombie Account Detection Based on Community Detection and Uneven Assignation PageRank

In the social media, there are a large amount of potential zombie accoun...
01/04/2021 ∙ by Qiu Yaowen, et al. ∙ 9

• ### Pwned: How Often Are Americans' Online Accounts Breached?

News about large online breaches is increasingly common. But there has b...
07/30/2018 ∙ by Ken Cor, et al. ∙ 1

• ### Measuring Financial Advice: aligning client elicited and revealed risk

Financial advisors use questionnaires and discussions with clients to de...
05/25/2021 ∙ by John R. J. Thompson, et al. ∙ 0

• ### Connecting The Dots To Combat Collective Fraud

Modern fraudsters write malicious programs to coordinate a group of acco...
01/06/2021 ∙ by Mingxi Wu, et al. ∙ 0

• ### A Novel Approach for Protection of Accounts' Names against Hackers Combining Cluster Analysis and Chaotic Theory

The last years of the 20 th century and the beginning of the 21 th mark ...
03/08/2019 ∙ by Desislav Andreev, et al. ∙ 0

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

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 .

 ∑jfij ≤vi for all securities i∈S (1) ∑ifij ≤ej for all accounts j∈A. (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

 ∑ijfijto be maximum. (3)

In other words, we want a maximum flow from securities to accounts obeying the capacity constraints (1) and (2).

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 fij>0 and iℓ∈E then rj≥rℓ. (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 , .

###### Theorem 1.

A flow is a ratio-balanced maximum flow if and only if it is MWSR. All ratio-balanced flows are equivalent.

###### Proof.

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.

###### Claim 1.

An MWSR flow subject to the capacity constraints is a maximum flow.

###### Proof.

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. ∎

###### Claim 2.

An MWSR flow subject to the capacity constraints satisfies the ratio-constraint (4).

###### Proof.

The derivative of the objective with respect to is equal to

 −2ejrj1ej=−2rj.

Therefore decreasing the flow on by an infinitesimal amount and increasing the flow on by the same amount, will change the objective by

 (2rj−2rℓ)ε=2(rj−rℓ)ε.

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 :

 ∑i∈S′vi=(1−R)∑j∈A′ej.

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 ):

 ∑j∈A′(1−rgj)ej≤∑i∈S′vi.

Therefore,

 (1−R)∑j∈A′ej ≥∑j∈A′(1−rgj)ej and hence ∑j∈A′rgj⋅ej ≥∑j∈A′R⋅ej.

By definition of we have that for all . So for every , and also

 ∑j∈A′(1−rgj)ej=∑i∈S′vi,

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.

###### Theorem 2.

The flow is a maximum ratio-balanced flow.

###### Proof.

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

 ∑i∉S′hvi+∑j∈A′hej.

Now let the total flow in a maximum flow be . Then

 F=∑i∈S∑j∈AFij=∑i∉S′h∑j∈AFij+∑i∈S′h∑j∈AFij≤∑i∉S′hvi+∑j∈A′hej.

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 .

###### Lemma 1.

For every , is a rational number with numerator and denominator bounded by .

###### Proof.

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 . ∎

###### Theorem 3.

[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.

###### Theorem 4.

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.

 minimizex 12xTPx+qTx subject to Gx≤h (5) Ax=b

We use

for the all-ones column vector and

for 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:

 Kij={1if xj is incident to ei0elseVij={1if xj is % incident to vi0else

Figure 1 shows an example. We are now ready to formulate the objective function and the constraints as a QP.

###### Lemma 2.

In standard form, the exposure-weighted sum-of-squares error function can be written as follows:

 ∑jejr2j=∑j(ej−^eTjKx)2ej=∑jej+12xT(2KTdiag((ej)−1)K)x−2⋅1Tx,

so that and in Equation (5).

###### Proof.

The goal is to write in the form . To do so, we expand the square by writing

 ∑j(ej)−1(ej−^eTjKx)2 =∑j(ej)−1(e2j−2eTj^eTjKx+xTKT^ej^eTjKx)

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

 x=(x1,x2,x3,x4,x5)=(4.88,3.12,0.46,0.43,7.11),

which gives (almost) equal risk ratios

 4.88+0.4612≈3.12+0.438≈7.1116≈0.444.

## 5 Extensions

We discuss some extensions.

### Over-Coverage:

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.

### Priorities:

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.

 minimizef−P∑p=1ϵp∑(i,j)∈E(p)fij+ϵP+1∑jejr2j (6)

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.

The combinatorial approach of Section 3 works too. We only have to replace the use of a maximum flow algorithm by the use of a minimum cost flow algorithm which minimizes the linear part of the objective in (6).

## References

• [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.