Balancing Breach Probability, Latency, and Cost with Mixed-Integer Programming
Where should each dataset live? Putting everything in the cheapest cloud region is tempting. Putting everything in the on-premises vault feels safe. In practice, every placement decision trades three quantities against each other: expected loss from a breach, access latency for users, and storage cost. This article builds a concrete placement problem, solves it exactly, and visualizes the trade-off surface.
1. The Scenario
A company holds $N = 12$ datasets and can place each one in exactly one of $M = 5$ locations.
| Location | Annual breach probability $p_j$ | Cost (USD/TB-month) | Capacity (TB) |
|---|---|---|---|
| On-prem Tokyo | 0.006 | 40 | 150 |
| On-prem Osaka | 0.008 | 36 | 150 |
| Cloud Tokyo | 0.020 | 23 | 400 |
| Cloud Singapore | 0.018 | 21 | 400 |
| Cloud Oregon | 0.025 | 18 | 400 |
Users access the data from three regions: Japan, Southeast Asia, and North America. Each dataset $i$ has a size $s_i$ (TB), a loss $v_i$ (million USD) if it leaks, and an access volume $a_{ik}$ (thousand requests per day) from each user region $k$. Customer PII, payment records, employee HR data, and partner contracts are bound by a data-residency rule and must stay in Japan.
2. Mathematical Formulation
Let $x_{ij}\in{0,1}$ indicate that dataset $i$ is placed at location $j$. The three objectives are linear in $x$:
$$
f_{\text{risk}}(x)=\sum_{i=1}^{N}\sum_{j=1}^{M} p_j, v_i, x_{ij},
$$
$$
f_{\text{lat}}(x)=\frac{1}{\sum_{i,k} a_{ik}}\sum_{i=1}^{N}\sum_{j=1}^{M}\Big(\sum_{k=1}^{K} a_{ik},\ell_{jk}\Big)x_{ij},
$$
$$
f_{\text{cost}}(x)=12\sum_{i=1}^{N}\sum_{j=1}^{M} c_j, s_i, x_{ij},
$$
where $\ell_{jk}$ is the network latency (ms) from user region $k$ to location $j$ and $c_j$ is the monthly price per TB.
The constraints are:
$$
\sum_{j} x_{ij}=1 \quad \forall i, \qquad
\sum_{i} s_i,x_{ij}\le C_j \quad \forall j,
$$
$$
\sum_{i} v_i,x_{ij}\le B \quad \forall j, \qquad
x_{ij}=0 \ \text{ for forbidden pairs (residency)}.
$$
The second line contains the blast-radius cap $B = 160$ million USD. No single location may hold more than $B$ of exposed loss, so one breach can never be catastrophic.
To explore the trade-off, each objective is normalized with an ideal value $f_k^{\ast}$ (its single-objective optimum) and a nadir value $f_k^{\text{nad}}$ (its worst value among the three single-objective optima). The scalarized problem is
$$
\min_{x}\ \sum_{k\in{\text{risk, lat, cost}}} w_k,\frac{f_k(x)-f_k^{\ast}}{f_k^{\text{nad}}-f_k^{\ast}},
\qquad w_k\ge 0,\quad \sum_k w_k=1 .
$$
Sweeping $w$ over the simplex traces out the Pareto front. The resulting problem has only $60$ binary variables, so an exact MILP solver finishes each instance almost instantly. The script builds the constraint matrices once and reuses them for every weight vector, which keeps the whole sweep lightweight.
3. Source Code
1 | import time |
4. Code Walkthrough
Section 1: problem data. Every array is indexed by dataset ($i$) or location ($j$). The allowed mask encodes data residency: for the four Japan-only datasets, the Singapore and Oregon columns are switched off. The solver receives this mask as upper bounds of zero on the corresponding variables.
Section 2: linear coefficients. Each objective is a matrix with one entry per pair $(i, j)$, so the total value of a placement is simply the sum of the entries selected by $x$. The risk matrix is the outer product of loss and breach probability. The latency matrix is access @ latency_ms.T, which gives for every dataset–location pair the request-weighted latency, divided by total traffic to yield a mean in milliseconds. The cost matrix is the outer product of size and monthly price, multiplied by 12. The three matrices are stacked into one array so that evaluate returns all objectives in a single vectorized expression.
Section 3: exact MILP. milp from SciPy calls the HiGHS solver. Three constraint blocks are built once: one row per dataset forcing exactly one location, one row per location for capacity, and one row per location for the blast-radius cap. Integrality is set on every variable and the bounds restrict them to ${0,1}$, with forbidden pairs fixed at zero. The payoff table optimizes each objective alone, which yields the ideal point (diagonal) and a nadir estimate (column maxima). The ranges vector turns the three incompatible units (k$/yr, ms, k$/yr) into dimensionless quantities.
Section 4: weight sweep. A grid with step $0.1$ over the simplex gives 66 weight vectors. Each one produces a normalized cost matrix norm_coef(w) and one MILP solve. Duplicate placements are merged, and a dominance filter removes any weakly dominated points, leaving the Pareto-optimal set. The optimal scalarized value for every weight is stored for the 3D surface plot.
Section 5: baselines. The balanced optimum uses equal weights. The greedy heuristic processes datasets from highest potential loss to lowest and assigns each to the cheapest feasible location under the balanced scalarization. The random baseline draws 3000 feasible placements by rejection sampling, which also gives the grey point cloud in the 3D plot.
Section 6: console report. The report prints the payoff table, the method comparison, the final placement, and the load per location.
Section 7: figure. All six panels share one figure with two rows and three columns:
- Risk–cost projection of the Pareto set, colored by mean latency.
- 3D objective space with the random cloud, Pareto points, greedy solution, and MILP optimum.
- Heat map of the optimal placement matrix.
- Normalized regret of each method on each objective.
- 3D surface of the optimal scalarized value over the weight simplex.
- Stacked storage volume per location for four representative solutions.
5. Console Output
=== Problem size === datasets: 12, locations: 5, binary variables: 60 feasible random placements sampled: 3000 (trials: 6322) === Payoff table (rows: optimised objective) === optimised for risk [k$/yr] latency [ms] cost [k$/yr] risk 2382.0 50.73 151.3 latency 3514.0 45.93 124.2 cost 6875.0 81.81 83.9 === Weighted-sum sweep: 66 MILPs in 0.61 s, 40 Pareto-optimal placements === === Method comparison (balanced weights 1/3, 1/3, 1/3) === method risk latency cost score Random (mean) 4459.1 61.43 119.9 0.4762 Random (best of all) 3435.0 49.28 101.2 0.1949 Greedy heuristic 3434.0 46.58 101.9 0.1732 MILP optimum 3434.0 46.58 101.9 0.1732 === Optimal placement (balanced weights) === dataset TB loss [M$] location Customer PII 8 50 On-prem Tokyo Payment records 12 80 On-prem Tokyo Employee HR 3 30 On-prem Tokyo Source code 2 40 On-prem Osaka Product catalog 5 2 Cloud Tokyo Web analytics 40 5 Cloud Tokyo Access logs 60 8 Cloud Tokyo ML training set 80 20 Cloud Oregon Backups 100 60 Cloud Singapore Marketing assets 20 1 Cloud Tokyo Sensor telemetry 50 3 Cloud Singapore Partner contracts 1 25 On-prem Osaka === Load per location (balanced weights) === On-prem Tokyo 23 TB exposed loss 160 M$ On-prem Osaka 3 TB exposed loss 65 M$ Cloud Tokyo 125 TB exposed loss 16 M$ Cloud Singapore 150 TB exposed loss 63 M$ Cloud Oregon 80 TB exposed loss 20 M$
6. Result Figure

7. Interpreting the Results
Pareto front (top left). The curve is a classic knee-shaped trade-off. Moving left lowers expected leak loss, but only by moving sensitive and large datasets into the expensive on-premises sites, so storage cost climbs. Moving right saves money by pushing data toward the cheap but riskier cloud regions. The color shows that latency does not move monotonically with either objective, because the best latency depends on which datasets sit near which users rather than on the total amount of data stored near anyone.
Objective space (top middle). The grey cloud shows what random feasible placements look like in the three-dimensional objective space. The Pareto-optimal points form a thin lower-left boundary of that cloud, which is exactly where a rational operator wants to be. The yellow star marks the balanced optimum, a compromise that is not extreme on any axis.
Placement matrix (top right). The structure of the balanced solution follows the economics. The highest-value, residency-bound datasets (customer PII, payment records, HR) go to the on-premises sites with the lowest breach probability. Large, low-sensitivity, high-traffic data such as product catalogs, analytics, and logs goes to Cloud Tokyo, which is close to the main users and cheap. The cheapest regions absorb the bulk data whose leak would hurt little, such as the ML training set, backups, and sensor telemetry. Backups are valuable but are accessed rarely, so latency barely matters for them and the blast-radius cap and cost decide their location.
Method comparison (bottom left). A random feasible placement is far from the ideal on all three axes. The greedy heuristic and the MILP optimum are both close to the ideal on latency and sit at moderate regret for risk and cost. On this small instance the greedy rule happens to reach the same placement as the exact solver, but it carries no optimality guarantee, and only the MILP can certify that no better balanced placement exists. The extreme solutions show the price of single-minded optimization: minimizing risk alone pushes cost to its worst value, and minimizing cost alone pushes risk and latency to their worst values.
Weight surface (bottom middle). The surface shows the best achievable normalized score for every weighting of the three objectives. It is concave because it is the pointwise minimum of linear functions of the weights, one for each feasible placement. The valleys at the corners correspond to the single-objective optima, where the score reaches zero. The ridge in the interior shows where no placement is simultaneously good on all objectives, which is the region where the choice of weights matters most.
Storage volume (bottom right). The stacked bars make the architectural consequence visible. The risk-minimizing placement fills both on-premises sites. The cost-minimizing placement puts nearly everything into the cheapest cloud region. The balanced placement spreads data across all locations, using on-premises capacity mainly for sensitive data and cloud capacity for the bulk of the volume.
8. Conclusion
Leak-aware placement is a small assignment problem with a large practical payoff. Writing breach probability as a coefficient of the objective, adding a blast-radius cap, and encoding residency as variable bounds turns a vague security discussion into a mixed-integer program that an off-the-shelf solver handles in moments. The Pareto sweep then gives decision makers a menu of efficient options rather than a single answer, so the final weights can reflect the organization’s actual appetite for risk, latency, and cost.
















