Solving the PCI DSS, GDPR, and FSA Guidelines Problem with Integer Programming
Every compliance team eventually faces the same uncomfortable question: what is the cheapest set of technologies, processes, and audit activities that still satisfies every mandatory requirement? Buying every tool on the market is safe but wasteful. Handling each regulation in a separate silo is organizationally convenient but pays for the same control several times.
In this article we turn the question into a concrete optimization problem, solve it exactly with mixed-integer linear programming, verify the answer by exhaustive search, and visualize the cost structure with a 2×3 panel of graphs, including two 3D plots.
1. The Example Problem
A payment-service company handles card data, serves EU customers, and is supervised by a Japanese financial regulator. It must therefore satisfy three regimes at once.
Requirements (12 in total, 4 per regime)
| ID | Regime | Requirement |
|---|---|---|
| P1 | PCI DSS | Segmentation and firewall (Req. 1) |
| P2 | PCI DSS | Protect stored card data (Req. 3) |
| P3 | PCI DSS | Access control and MFA (Req. 7-8) |
| P4 | PCI DSS | Logging and monitoring (Req. 10) |
| G1 | GDPR | Records of processing (Art. 30) |
| G2 | GDPR | Security of processing (Art. 32) |
| G3 | GDPR | Breach notification (Art. 33) |
| G4 | GDPR | Data subject rights (Art. 15-17) |
| F1 | FSA | Governance and risk management |
| F2 | FSA | Access management |
| F3 | FSA | Monitoring and incident response |
| F4 | FSA | Outsourcing and audit |
Candidate controls (14 in total): network segmentation, encryption and key management, tokenization, IAM with MFA, privileged access management, log management, SIEM with managed SOC, data inventory, DSR workflow automation, incident response retainer, governance and training, vendor risk management, GRC automation, and vulnerability management with penetration testing.
Each control $j$ has a three-year total cost of ownership
$$
c_j = K_j + T,(O_j + E_j), \qquad T = 3,
$$
where $K_j$ is the capital expenditure, $O_j$ the annual operating cost, and $E_j$ the annual audit-evidence effort. A control contributes a coverage weight $a_{ij}\in[0,1]$ to requirement $i$. One control can help several requirements, which is exactly why integrated planning beats silos.
Required coverage levels reflect a risk-based reading of each regime: $\theta_i = 1.0$ for PCI DSS, $0.8$ for GDPR, and $0.7$ for the FSA guidelines.
2. Mathematical Formulation
With a binary decision variable $x_j\in{0,1}$ that equals 1 when control $j$ is implemented, the problem is
$$
\min_{x}\ \sum_{j=1}^{n} c_j,x_j
$$
subject to
$$
\sum_{j=1}^{n} a_{ij},x_j ;\ge; \theta_i \qquad (i=1,\dots,m),
$$
$$
x_a ;\le; x_b \qquad \text{for each prerequisite pair } (a,b),
$$
$$
x_j \in {0,1}.
$$
The prerequisite constraints encode practical dependencies: privileged access management requires IAM, the SIEM requires log management, and DSR automation requires the data inventory.
This is a multi-constraint covering problem, which is NP-hard in general. With $n=14$ controls there are only $2^{14}=16{,}384$ candidate subsets, so we can also enumerate them all and confirm the solver’s answer.
For comparison we use three baselines:
- Buy all: implement every control.
- Siloed: solve each regime independently and add up the three costs, so shared controls are paid for repeatedly.
- Greedy: repeatedly add the control (plus any missing prerequisite) with the best ratio of deficit reduction to cost, then prune redundant controls.
3. Complete Source Code
1 | import itertools |
4. Code Walkthrough
Section 1: Problem data
The catalogue stores capital expenditure, annual operating cost, and annual audit effort for each control. The line cost = capex + T * opex + T * audit implements
$$
c_j = K_j + T,(O_j + E_j)
$$
so that audit-evidence work is priced in rather than ignored, which is a common blind spot when teams compare tools only by license fee.
The sparse dictionary cover lists, for each control, which requirements it helps and by how much. It is converted into the dense matrix $A=(a_{ij})\in\mathbb{R}^{12\times 14}$. Tokenization (C3), for example, contributes $0.9$ to P2 and $0.3$ to G2, while governance and training (C11) contributes small amounts to eight different requirements. This second pattern is typical of process controls: individually weak, collectively broad.
The list prereq stores index pairs $(a,b)$ meaning $x_a\le x_b$.
Section 2: Solvers
dep_matrix builds the matrix $D$ in which each row has $+1$ at column $a$ and $-1$ at column $b$. The constraint $Dx\le 0$ is then exactly the family of prerequisite inequalities $x_a-x_b\le 0$.
solve_milp calls scipy.optimize.milp, which uses the HiGHS branch-and-cut solver. The coverage constraints are passed as LinearConstraint(A[rows], lb=thr, ub=inf), the prerequisites as a second constraint block, and integrality is enforced by setting integrality=np.ones(n) together with bounds $[0,1]$. The rows argument lets us optimize a subset of requirements, which we need for the siloed baseline. The function returns (None, nan) if the model is infeasible, so a request for an unattainable level cannot crash the later plotting code.
solve_greedy is a classic cost-effectiveness heuristic. At each step it evaluates adding each missing control together with its prerequisites, measures the reduction of the total coverage deficit $\sum_i \max(\theta_i-(Ax)_i,0)$, and picks the best gain-per-cost ratio. A final pruning pass removes expensive controls that became redundant. Greedy is fast and intuitive, but it carries no optimality guarantee.
Section 3: Baseline and verification
The vector theta0 encodes $\theta=(1.0,,0.8,,0.7)$ for the three regimes. Three independent computations follow:
- MILP optimum
c_opt. - Exhaustive search:
itertools.product([0,1], repeat=n)creates all $2^{14}$ subsets as a matrix. A single matrix productsubsets @ A.Tevaluates every coverage vector at once, boolean masks apply the prerequisite constraints, andnp.whereassigns infinite cost to infeasible subsets. This vectorized check takes a fraction of a second, so it is the fastest and most transparent way to validate the solver at this scale. - Siloed cost: each regime is solved alone and the three optima are summed, which models three teams buying overlapping controls independently.
For much larger catalogues, exhaustive search becomes impossible ($2^{n}$ growth), but the MILP formulation scales to hundreds of controls with the same code.
Section 4: Console report
Two tables list the catalogue with the optimal selection and the coverage achieved per requirement next to the required level. The summary lines compare all strategies and print the percentage savings.
Section 5: Sensitivity data
Two sweeps feed the graphs. The 7×7 grid solves 49 MILPs while the PCI DSS level and the GDPR level vary independently from $0.5$ to $1.1$ (FSA fixed at $0.7$), producing the cost surface. The line sweep solves 17 problems at a uniform level from $0.4$ to $1.2$ for both the exact and the greedy method. The upper limit $1.2$ is deliberate: it is the largest level every requirement can still reach with the full catalogue, so every problem in the sweep is feasible.
Section 6: Graphs
All six panels are drawn into one figure with two rows and three columns. Panels 3 and 6 use projection="3d", and plt.subplots_adjust fixes the margins so the colorbars and 3D labels do not collide.
5. Execution Results
=== Control catalogue and optimal selection (thousand USD) === ID Control Category Capex Opex/yr Audit/yr TCO Selected C1 Network segmentation / NGFW Technology 90.0 18.0 6.0 162.0 YES C2 Encryption & key management Technology 70.0 14.0 5.0 127.0 - C3 Tokenization service Technology 110.0 30.0 6.0 218.0 YES C4 IAM with MFA Technology 60.0 20.0 5.0 135.0 YES C5 Privileged access management Technology 85.0 25.0 6.0 178.0 YES C6 Central log management Technology 50.0 16.0 4.0 110.0 YES C7 SIEM + managed SOC Technology 120.0 60.0 8.0 324.0 YES C8 Data inventory (RoPA) tool Technology 40.0 12.0 4.0 88.0 YES C9 DSR workflow automation Technology 45.0 15.0 3.0 99.0 YES C10 Incident response plan & retainer Process 25.0 20.0 3.0 94.0 - C11 Governance, policy & training Process 30.0 25.0 5.0 120.0 YES C12 Vendor risk management program Process 20.0 18.0 4.0 86.0 YES C13 GRC compliance automation Process 55.0 22.0 2.0 127.0 - C14 Vulnerability mgmt & pen testing Process 35.0 28.0 4.0 131.0 YES === Achieved coverage per requirement === Req Regulation Description Coverage Required P1 PCI DSS Segmentation & firewall (Req.1) 1.1 1.0 P2 PCI DSS Protect stored card data (Req.3) 1.2 1.0 P3 PCI DSS Access control & MFA (Req.7-8) 1.2 1.0 P4 PCI DSS Logging & monitoring (Req.10) 1.3 1.0 G1 GDPR Records of processing (Art.30) 1.4 0.8 G2 GDPR Security of processing (Art.32) 1.1 0.8 G3 GDPR Breach notification (Art.33) 0.9 0.8 G4 GDPR Data subject rights (Art.15-17) 1.3 0.8 F1 FSA Governance & risk management 0.9 0.7 F2 FSA Access management 1.2 0.7 F3 FSA Monitoring & incident response 1.2 0.7 F4 FSA Outsourcing & audit 0.8 0.7 Optimal (MILP) : 1651.0 -> ['C1', 'C3', 'C4', 'C5', 'C6', 'C7', 'C8', 'C9', 'C11', 'C12', 'C14'] Exhaustive search (2^14) : 1651.0 Greedy heuristic : 1651.0 Siloed implementation : 2572.0 Buy every control : 1999.0 Saving vs. silo : 35.8 % Saving vs. all controls : 17.4 %

6. Reading the Results
Optimal portfolio
The exact solver selects eleven of the fourteen controls: C1, C3, C4, C5, C6, C7, C8, C9, C11, C12, and C14, with a total three-year cost of 1,651 thousand USD. Exhaustive enumeration of all 16,384 subsets returns the same value, which confirms that the MILP result is a true global optimum rather than a local one.
Three controls are left out, and each omission teaches something:
- Encryption and key management (C2) is dropped because tokenization (C3) already delivers $0.9$ on stored-card-data protection and $0.3$ on security of processing, while C2 would add cost for overlapping coverage.
- GRC automation (C13) is dropped because governance and training (C11) and vendor risk management (C12) already cover the FSA governance and outsourcing requirements at the required $0.7$.
- Incident response retainer (C10) is dropped because the managed SOC (C7) already contributes to breach notification and monitoring.
Panel (1): cost breakdown
The stacked bars show where money goes. The SIEM with managed SOC (C7) is by far the most expensive item, and most of that cost is recurring operating expense rather than up-front capital. Process controls such as C11 and C12 have small capex but a noticeable operating share. The lesson is that comparing tools by purchase price alone understates the true cost of the recurring, labor-heavy controls.
Panel (2): coverage heatmap
Each cell shows how much a selected control contributes to a requirement. Rows with several bright cells, for example G2 (security of processing) or F3 (monitoring and incident response), are satisfied through combinations of controls. The column for C11 shows many faint cells spread across the matrix, which visualizes why a broad governance program is cheap insurance across all three regimes. Empty columns (C2, C10, C13) are exactly the controls the optimizer rejected.
Panel (3): 3D cost surface
The surface shows the minimum cost as the PCI DSS level (one horizontal axis) and the GDPR level (the other) vary, with the FSA level fixed. The surface rises in discrete terraces rather than smoothly, because controls are indivisible: raising a requirement slightly above a threshold can force an entire additional tool to be purchased, producing a jump. The cheapest corner (both levels at $0.5$) is far lower than the most demanding corner, and the slope along the PCI DSS axis is steeper in the middle range, which shows that the strictest card-data requirements are the main cost driver.
Panel (4): strategy comparison
The siloed approach costs 2,572 thousand USD, even more than simply buying everything (1,999), because three independent plans each purchase the shared controls again. The integrated optimum of 1,651 saves about 35.8% against the silo plan and about 17.4% against buying every control. The greedy heuristic, followed by pruning, also reaches 1,651 on this instance, so it is a strong practical fallback, although only the exact solver can prove it.
Panel (5): cost of raising the compliance level
Cost as a function of a uniform required level is a staircase. It stays low for relaxed targets, climbs steeply between roughly $0.6$ and $0.95$, and flattens at the cost of the full catalogue once the level approaches the maximum attainable $1.2$. The greedy curve tracks the optimal one closely but sits slightly above it at several levels, which shows the small but real gap that exact optimization closes. The plot is also a negotiation tool: it tells management precisely what each additional increment of assurance costs.
Panel (6): 3D efficiency scatter
Each point is a control, positioned by its total cost, its total coverage weight, and its coverage per 100 thousand USD. Green points are selected and red points are rejected. High, left-hand points (cheap and broad) such as governance, vendor risk, and data inventory are selected. The rejected controls sit lower on the efficiency axis. Note that efficiency alone does not decide the selection: some expensive, narrowly focused controls such as the SIEM remain in the optimal set because they are the only way to reach specific requirements, while the prerequisite structure forces cheap foundations like log management into the plan.
7. Conclusion
Treating compliance as a covering problem reveals three practical facts. First, overlap between regulations is the main source of savings, which is why a single integrated plan beat three siloed plans by more than a third. Second, indivisible controls make the cost curve a staircase, so small changes in required assurance can trigger large jumps in spending. Third, exact optimization is cheap at this scale: an MILP solver and a 16,384-subset enumeration agree instantly, and the same model extends to realistic catalogues with extra constraints such as budgets per year, vendor lock-in limits, or risk-weighted requirements.

















