Defending against a partly malicious opponent: a generalised maximin LP
A 2025 Games paper shows that if a spiteful opponent must still protect its own payoff, you can guarantee more than the classical maximin. We rebuild its linear program in fibub's LP solver.
Game theory’s safest answer to an opponent who might want to hurt you is the maximin strategy: pick the mix of moves whose worst case is as good as possible, assuming the other side will do whatever harms you most. But a real opponent who wants to hurt you usually also cares about not getting hurt itself. A 2025 paper in Games turns that idea into a linear program, an optimisation with straight-line constraints, and shows that it can guarantee you more than the classical maximin. This article rebuilds the paper’s worked example in the LP solver and checks every number it states, then looks at the same game’s ordinary equilibria in the nash equilibrium solver. For counting how many strategy supports such a search has to try, the combinatorics calculator helps.
The paper in brief
The authors look at players who want an adequate payoff rather than the largest one. Their first scenario is a two-player game with a “partially malicious” row player: it would like the column player to do badly, but only among strategies that keep its own payoff above a minimum it sets for itself. They measure that minimum with a risk threshold θ between 0 (no requirement at all) and 1 (the row player insists on its own maximin value).
Their worked example is a game with 4 row strategies and 3 column strategies, with θ = 0.22, which they say gives the row player a minimum requirement of about −53.89. Against a fully malicious row player the column player’s classical maximin mix is about (0.61, 0, 0.39), guaranteeing about −33.48. Knowing the row player must protect itself, a generalised maximin linear program gives the column player about (0.54, 0, 0.46), guaranteeing about −31.73. The row player’s matching generalised minimax strategy, the safe mix that hurts the column player most, is about (0.10, 0.13, 0.77, 0), and it holds the column player to the same −31.73. The paper’s second scenario applies similar linear programs to truncation selection in evolutionary games, where strategies whose payoff falls below a threshold are culled.
Checked with the tools
We typed the paper’s payoff matrices into the LP solver’s maths and solved three linear programs: the column player’s classical maximin, the row player’s own maximin, and the row player’s generalised minimax with the requirement written in as three extra constraints (one per column strategy: the row player’s expected payoff against it must stay at or above the requirement). This is a recomputation from the paper’s stated game, not a simulation.
Step 1: the classical maximin. The LP solver finds the column player’s best worst case at −33.479, with the mix (0.6134, 0, 0.3866). In exact fractions that is −3984/119 with weights 73/119 and 46/119, the paper’s −33.48 and (0.61, 0, 0.39).
Step 2: where −53.89 comes from. The paper does not print the rule that turns θ into a requirement. The row player’s own maximin, found by the same solver, is 28 (always play row 4), and its worst payoff anywhere in the game is −77. Reading θ as the fraction of the way from the worst payoff to the maximin value gives −77 + 0.22 × 105 = −53.9, which matches the paper’s “about −53.89”. That rule is our reading, modelled on the paper’s definition of the column player’s risk measure.
Step 3: the generalised minimax. With the requirement at −53.89, the LP solver gives the row player’s most harmful safe mix as (0.1019, 0.1330, 0.7650, 0) and the column player’s guarantee as −31.736, the paper’s −31.73. With −53.9 it is −31.737, so the rounding does not matter. The shadow prices on the three column-payoff constraints, how much the optimum moves if each constraint is loosened by one unit, are 0.5436, 0 and 0.4564. By linear programming duality those are exactly the column player’s defensive mix, the paper’s (0.54, 0, 0.46). One linear program gives both players’ answers.
| Check | Paper | LP solver |
|---|---|---|
| Classical column maximin | about −33.48 at (0.61, 0, 0.39) | −33.479 at (0.6134, 0, 0.3866) |
| Row player’s requirement at θ = 0.22 | about −53.89 | −53.9 (our reading of the rule) |
| Generalised guarantee | about −31.73 | −31.736 |
| Row player’s safe, harmful mix | about (0.10, 0.13, 0.77, 0) | (0.1019, 0.1330, 0.7650, 0) |
| Column player’s defensive mix | about (0.54, 0, 0.46) | shadow prices 0.5436, 0, 0.4564 |
Step 4: the whole range of thresholds. The paper quantifies the gain only at θ = 0.22. We solved the same linear program at 101 thresholds from 0 to 1 (Figure 1). The guarantee equals the classical maximin up to θ = 0.05; from θ = 0.06 it starts to climb: −31.95 at 0.2, −28.72 at 0.5, −13.92 at 0.7 and +28.77 at 0.9. At θ = 1 the row player has only one safe move left, row 4, and the column player can count on 85 by replying with column 1. This bears out the paper’s statement that the gain depends on how tightly the requirement restricts the row player.
Figure 2 shows how the row player’s harmful-but-safe mix changes. With no requirement it leans on row 3 (92 %) with some row 2; as the threshold rises it must shift weight to rows 1 and 2, and from θ = 0.56 also to its own safe row 4, which takes over completely at θ = 1.
Step 5: the ordinary Nash equilibria, for contrast. The Nash equilibrium solver lists four extreme equilibria of the same game: (row 2, column 3) paying 62 and 34; (row 4, column 1) paying 28 and 85; a mix of rows 1 and 2 (0.5914 and 0.4086) against column 3, paying 62 and −23.37; and a mix of rows 2 and 4 (0.4977, 0.5023) against columns 1 and 3 (0.1139, 0.8861), paying 50.15 and 4.87. None of them is what a cautious column player should plan for when the row player may be spiteful, which is the gap the paper’s linear program fills.
How we made the graphs
The charts and every number above come from scripts/blog-figures/malicious-opponent-generalised-maximin-linear-programming-bimatrix-game.mjs in fibub’s public code. It writes each model as plain text, exactly as you would type it into the LP solver, and solves it with parseModel and solve from src/lib/sci/lp.ts, the two-phase simplex method behind that tool. The Nash equilibria come from supportEnumeration in src/lib/sci/nash.ts, the maths of the nash equilibrium solver.
The payoff matrices, θ = 0.22, the requirement of −53.89 and the paper’s rounded results come from the paper’s text. The rule linking θ to the requirement (worst payoff plus θ times the distance to the maximin value) is our reading. The thresholds other than 0.22 are our own sweep.
How we test the maths
On every change to fibub, tests/sci.mjs runs tests/sci-tools/lp-solver.mjs, which pins the solver against SciPy’s linprog and milp (HiGHS):
- The feed-mix example must give 2.0407643 with shadow prices 0.00707006, 0.03458599, 0 and −0.24783439, as SciPy’s marginals do.
- The shipping example must cost 620 with duals 0, −2, 4, 5 and 9, and 36 random models must match SciPy’s status and objective.
- New with this article: the Zhang and Morsky game must give the classical maximin −3984/119 at weights 73/119 and 46/119, and the generalised minimax −31.7357 with mix (0.1019, 0.1330, 0.7650, 0) and duals 0.5436, 0, 0.4564.
The Nash solver’s checks in tests/sci-tools/nash-equilibrium-solver.mjs compare its equilibria with nashpy’s vertex enumeration on textbook and random games up to 6 × 6.
Check it yourself
On the LP solver:
- Clear the box Your model, one constraint per line and type the row player’s problem, one line each:
minimize w: w, thensubject to, thencolpay1: + 13 p1 - 76 p2 - 30 p3 + 85 p4 - w <= 0,colpay2: - 33 p1 - 90 p2 - 63 p3 - 33 p4 - w <= 0,colpay3: - 63 p1 + 34 p2 - 39 p3 - 24 p4 - w <= 0,rowmin1: - 62 p1 - 42 p2 + 24 p3 + 28 p4 >= -53.89,rowmin2: + 44 p1 + 4 p2 - 77 p3 + 80 p4 >= -53.89,rowmin3: + 62 p1 + 62 p2 - 68 p3 + 53 p4 >= -53.89,sum: p1 + p2 + p3 + p4 = 1, and lastfree w(w can be negative). - Status reads Optimal and the objective is about −31.74.
- In the Variables table, p1 is about 0.102, p2 0.133, p3 0.765 and p4 0.
- In the Constraints table, the Shadow price column shows about −0.544, 0 and −0.456 for colpay1 to colpay3: the column player’s defensive mix (the sign only says the minimum would rise).
- Change every −53.89 to −77 (no requirement): the objective falls to about −33.48, the classical maximin.
What researchers can use it for
- Recompute a game-theory paper’s maximin or minimax in a few lines of text with the LP solver, and read the opponent’s mix from the shadow prices.
- Add a “safety requirement” to any matrix game: one extra constraint per opponent strategy, then sweep the requirement as we did.
- List every Nash equilibrium of the same game in the nash equilibrium solver and compare it with the cautious answers.
- Teach LP duality with a case where the dual values have a meaning students can see: the other player’s strategy.
- Plan an experiment on spiteful play: compute in advance what a cautious player should do at each threshold you plan to test.
The fine print
- We checked the paper’s first scenario, the partially malicious opponent. Its second scenario, safe spaces under truncation selection, uses polyhedral vertex enumeration that our tools do not do.
- The rule from θ to the requirement is our reading; the paper gives only the resulting value, about −53.89, which our reading matches to the stated precision.
- Our guarantee rounds to −31.74 where the paper writes about −31.73; the paper seems to cut off rather than round.
- The game has a degenerate equilibrium (a whole segment of row mixes against column 3); the Nash solver lists its end points.
Sources
- Zhang, Z. and Morsky, B. (2025), Linear Programming for Computing Equilibria Under Truncation Selection and Designing Defensive Strategies Against Malicious Opponents, Games 16(6): 59, doi:10.3390/g16060059. Licence CC BY (Creative Commons Attribution), checked on the MDPI page, 2026-11-24. Values used here: the 4 × 3 bimatrix game of Section 2.1 (row and column payoffs); the row player's threshold 0.22 and minimum requirement of about −53.89; the classical column maximin mix (0.61, 0, 0.39) with worst case about −33.48; the generalised maximin mix about (0.54, 0, 0.46) with guarantee about −31.73; the row player's generalised minimax mix about (0.10, 0.13, 0.77, 0).
- Maximin strategies and linear programming duality: von Neumann, J. and Morgenstern, O. (1944), Theory of Games and Economic Behavior, Princeton University Press; Dantzig, G. B. (1963), Linear Programming and Extensions, Princeton University Press.
If you are an author or publisher and want a credit or a passage changed or removed, tell us and we will act quickly.