Cut the Enemies, Unite the Allies
A strategy puzzle game that transforms the NP-hard Multicut problem from combinatorial optimization into an interactive alliance-building experience.
- Mathematical Background
- Game Setting
- How to Play
- Gameplay Features
- Difficulty and Level System
- Technical Implementation
- Future Work
- References
The Multicut problem is a combinatorial optimization problem. The goal is to cut an undirected graph into multiple connected components while minimizing the total cost of cut edges.
Let
In other words, no cycle is allowed to contain exactly one cut edge. The set of all multicuts of
Given edge costs
Intuition: edge costs can be positive or negative. Positive-cost edges represent friendly relations (expensive to cut), while negative-cost edges represent hostile relations (beneficial to cut). The player seeks the minimum total cutting cost.
The key Multicut validity rule is the cycle inequality: no cycle may have exactly one cut edge. This implies:
- If one edge on a cycle is cut, at least one more edge on that cycle must also be cut.
- This guarantees consistency of components: nodes split into different groups cannot remain connected by an uncut path.
The Multicut problem is NP-hard [3, 6], so an efficient exact algorithm is unlikely in general. Nevertheless, it has strong real-world impact [2, 12], motivating extensive theoretical [3, 5, 7, 11] and algorithmic [1, 4, 6, 9, 10] research.
- Grötschel & Wakabayashi (1989) [6]: early study on complete graphs.
- Chopra & Rao (1993) [3]: extension to general graphs.
The same family of problems appears under related names:
- Correlation Clustering [1]
- Coalition Structure Generation [13]
- World: city-states with complex friendly/hostile relations.
- Player role: a royal strategist discovering hidden alliance structures.
- Goal: cut hostile ties, preserve friendly ties, and form stable alliances.
- Hold the right mouse button to enter "Cut Mode".
- Choose valid and low-cost edges to cut.
- Observe the result and optimize iteratively.
A cut is valid if it separates at least one target pair of vertices into different territories.
Cutting low-cost edges reduces total cost and makes it easier to reach the optimal target value.
- Urban: spawns on land tiles.
- Port: spawns only on water tiles.
Edge labels indicate relationship strength:
- Larger values -> tighter relation, higher cut cost.
- Smaller values -> looser relation, lower cut cost.
- Level display: format
Difficulty_LevelID(e.g.,Easy_01). - Cut limit: remaining / total cuts.
- Cost display: current cost / optimal target cost.
With "Show Territory" enabled:
- Alliance boundaries become visually clear.
- Abstract graph structure is materialized as map territory.
- Different alliances are color-coded.
- Units in the same color area connected by uncut edges belong to one alliance.
When "Hint" is enabled, the game shows the optimal cut set computed by the ILP solver.
Two revert options:
- Reconnect a previously cut edge directly.
- Use the
Revertbutton to undo the latest action.
The game uses an infinite level generation pipeline with three difficulties:
| Difficulty | Node Count | Extra Mechanics |
|---|---|---|
| Easy | Fewer nodes | Core gameplay only |
| Medium | More nodes | Timer added |
| Hard | Many nodes | Timer + penalty edges (cutting reduces remaining time) |
To keep levels strategic and non-trivial, the game applies a smart balancing algorithm:
- Keep approximately 35% negative-weight edges.
- Ensure at least 3 negative-weight edges.
- Flip the smallest positive weights first when balancing is needed.
- Apply minimal changes only (conservative adjustment).
Generates city-state positions with minimum-distance constraints, producing random yet evenly distributed nodes.
Builds graph connectivity while avoiding skinny triangles and edge intersections.
Normalizes map bounds to screen space for different map sizes and resolutions.
Uses TiledProceduralHexTerrainGenerator:
- Generate random height map.
- Overlay multi-layer details.
- Classify terrain types.
- Add humidity variation.
Integration handles coordinate mapping from Tilemap (q, r) to Unity world (x, y), offset correction, and Y-axis inversion.
The Multicut problem is NP-hard, so exact optimization is expensive. We use Gurobi ILP for globally optimal solutions:
| Method | Limitation | Gurobi ILP Advantage |
|---|---|---|
| Heuristics | Fast but no global optimality guarantee | Industrial speed + provable global optimum |
| Approximation | Guarantee on bounds but weaker practical solutions | Exact optimization, not approximation |
| Brute force | Infeasible | Practically solvable with industrial optimization |
A C# Process launches Python, and JSON files are used for data exchange:
- Input: graph structure and edge weights.
- Output: cut edges and optimal objective value.
A nearest-neighbor based assignment maps terrain tiles to city-states to visualize alliances clearly.
-see releases/demo.mp4
- Improve territory rendering performance and reduce lag.
- Add random events that dynamically modify edge weights.
- Let hostile city-states actively repair cut edges.
- Make terrain features (mountains, rivers, forests) affect edge weights.
- Bansal, N., Blum, A., & Chawla, S. (2004). Correlation clustering. Machine Learning, 56(1–3), 89–113.
- Beier, T., Pape, C., et al. (2017). Multicut brings automated neurite segmentation closer to human performance. Nature Methods, 14(2), 101–102.
- Chopra, S., & Rao, M. R. (1993). The partition problem. Mathematical Programming, 59(1–3), 87–115.
- Demaine, E. D., Emanuel, D., Fiat, A., & Immorlica, N. (2006). Correlation clustering in general weighted graphs. Theoretical Computer Science, 361(2–3), 172–187.
- Deza, M. M., Grötschel, M., & Laurent, M. (1992). Clique-web facets for multicut polytopes. Mathematics of Operations Research, 17(4), 981–1000.
- Grötschel, M., & Wakabayashi, Y. (1989). A cutting plane algorithm for a clustering problem. Mathematical Programming, 45(1), 59–96.
- Grötschel, M., & Wakabayashi, Y. (1990). Facets of the clique partitioning polytope. Mathematical Programming, 47, 367–387.
- Horňáková, A., Lange, J.-H., & Andres, B. (2017). Analysis and optimization of graph decompositions by lifted multicuts. In ICML.
- Klein, P. N., Mathieu, C., & Zhou, H. (2015). Correlation clustering and two-edge-connected augmentation for planar graphs. In STACS.
- Levinkov, E., Kirillov, A., & Andres, B. (2017). A comparative study of local search algorithms for correlation clustering. In GCPR.
- Oosten, M., Rutten, J. H. G. C., & Spieksma, F. C. R. (2001). The clique partitioning problem: facets and patching facets. Networks, 38(4), 209–226.
- Tang, S., Andriluka, M., Andres, B., & Schiele, B. (2017). Multiple people tracking by lifted multicut and person re-identification. In CVPR.
- Voice, T., Polukarov, M., & Jennings, N. R. (2012). Coalition structure generation over graphs. Journal of Artificial Intelligence Research, 45, 165–196.













