Table of Contents
Fetching ...

Hybrid Genetic Algorithm for Optimal User Order Routing: Multi-Objective Solver Optimization in CoW Protocol Batch Auctions

Mitchell Marfinetz

TL;DR

This work addresses real-time order routing for CoW Protocol batch auctions by formulating a non-convex, multi-objective search over heterogeneous AMMs. It introduces a hybrid solver that fuses a production-grade NSGA-II with a variable-length encoding of path sets and split ratios, an adaptive controller, and a deterministic baseline with Bellman--Ford-based negative-cycle detection, all guarded by six safety layers. The approach delivers anytime solutions within a ~2 s budget, showing 0.4–9.8 ETH per order in the benchmarks for small-to-medium sizes and robust Pareto front quality under varying gas regimes, while large, highly fragmented orders remain challenging. The open-source, safety-first design demonstrates practical applicability for real-time DEX solver optimization and offers a scalable foundation for future enhancements across multi-chain routing and MEV-protection contexts.

Abstract

CoW Protocol batch auctions aggregate user intents and rely on solvers to find optimal execution paths that maximize user surplus across heterogeneous automated market makers (AMMs) under stringent auction deadlines. Deterministic single-objective heuristics that optimize only expected output frequently fail to exploit split-flow opportunities across multiple parallel paths and to internalize gas, slippage, and execution risk constraints in a unified search. We apply evolutionary multi-objective optimization to this blockchain routing problem, proposing a hybrid genetic algorithm (GA) architecture for real-time solver optimization that combines a production-grade, multi-objective NSGA-II engine with adaptive instance profiling and deterministic baselines. Our core engine encodes variable-length path sets with continuous split ratios and evolves candidate route-and-volume allocations under a Pareto objective vector F = (user surplus, -gas, -slippage, -risk), enabling principled trade-offs and anytime operation within the auction deadline. An adaptive controller selects between GA and a deterministic dual-decomposition optimizer with Bellman-Ford based negative-cycle detection, with a guarantee to never underperform the baseline. The open-source system integrates six protection layers and passes 8/8 tests, validating safety and correctness. In a 14-stratum benchmark (30 seeds each), the hybrid approach yields absolute user-surplus gains of approximately 0.40-9.82 ETH on small-to-medium orders, while large high-fragmentation orders are unprofitable across gas regimes. Convergence occurs in about 0.5 s median (soft capped at 1.0 s) within a 2-second limit. We are not aware of an openly documented multi-objective GA with end-to-end safety for real-time DEX routing.

Hybrid Genetic Algorithm for Optimal User Order Routing: Multi-Objective Solver Optimization in CoW Protocol Batch Auctions

TL;DR

This work addresses real-time order routing for CoW Protocol batch auctions by formulating a non-convex, multi-objective search over heterogeneous AMMs. It introduces a hybrid solver that fuses a production-grade NSGA-II with a variable-length encoding of path sets and split ratios, an adaptive controller, and a deterministic baseline with Bellman--Ford-based negative-cycle detection, all guarded by six safety layers. The approach delivers anytime solutions within a ~2 s budget, showing 0.4–9.8 ETH per order in the benchmarks for small-to-medium sizes and robust Pareto front quality under varying gas regimes, while large, highly fragmented orders remain challenging. The open-source, safety-first design demonstrates practical applicability for real-time DEX solver optimization and offers a scalable foundation for future enhancements across multi-chain routing and MEV-protection contexts.

Abstract

CoW Protocol batch auctions aggregate user intents and rely on solvers to find optimal execution paths that maximize user surplus across heterogeneous automated market makers (AMMs) under stringent auction deadlines. Deterministic single-objective heuristics that optimize only expected output frequently fail to exploit split-flow opportunities across multiple parallel paths and to internalize gas, slippage, and execution risk constraints in a unified search. We apply evolutionary multi-objective optimization to this blockchain routing problem, proposing a hybrid genetic algorithm (GA) architecture for real-time solver optimization that combines a production-grade, multi-objective NSGA-II engine with adaptive instance profiling and deterministic baselines. Our core engine encodes variable-length path sets with continuous split ratios and evolves candidate route-and-volume allocations under a Pareto objective vector F = (user surplus, -gas, -slippage, -risk), enabling principled trade-offs and anytime operation within the auction deadline. An adaptive controller selects between GA and a deterministic dual-decomposition optimizer with Bellman-Ford based negative-cycle detection, with a guarantee to never underperform the baseline. The open-source system integrates six protection layers and passes 8/8 tests, validating safety and correctness. In a 14-stratum benchmark (30 seeds each), the hybrid approach yields absolute user-surplus gains of approximately 0.40-9.82 ETH on small-to-medium orders, while large high-fragmentation orders are unprofitable across gas regimes. Convergence occurs in about 0.5 s median (soft capped at 1.0 s) within a 2-second limit. We are not aware of an openly documented multi-objective GA with end-to-end safety for real-time DEX routing.
Paper Structure (32 sections, 1 theorem, 14 equations, 8 figures, 8 tables)

This paper contains 32 sections, 1 theorem, 14 equations, 8 figures, 8 tables.

Key Result

Proposition 1

Let $x_{\text{GA}}$ and $x_{\text{DET}}$ be candidate routes. Suppose the fallback rule selects subject to safety constraints. Then $S(x^{\star}) \ge S(x_{\text{DET}})$. This S-only fallback matches Figure alg:hybrid and is independent of deployment weights.

Figures (8)

  • Figure 1: System orchestration and data flow. Market data feeds populate a heterogeneous DEX graph. DualDecompositionOptimizer computes a deterministic baseline and warm-start seeds. GeneticRouterEngine (NSGA-II) evolves variable-length path sets with split ratios. HybridGAEngine selects the solver based on instance profiling. Post-processing validation, solution construction, and circuit breakers ensure safety before submission to CoW Protocol batch auction.
  • Figure 2: Anytime NSGA-II loop specialized for heterogeneous AMMs.
  • Figure 3: Recombination that respects pool-edge continuity and token compatibility.
  • Figure 4: Adaptive controller with self-contained deterministic fallback guarantee (no external path dependencies).
  • Figure 5: Win rate (fraction of instances where GA net surplus > best baseline) by fragmentation level and gas regime. Left: win rate increases with fragmentation (low/medium/high), consistent with GA's advantage in complex, split-flow scenarios. Right: win rate by gas regime shows that GA excels across all gas settings when instances are sufficiently complex. Each bar aggregates $N=30$ seeds per stratum. These charts complement the absolute $\Delta$ surplus ECDFs by showing "how often GA wins" at a glance.
  • ...and 3 more figures

Theorems & Definitions (2)

  • Proposition 1: Surplus Fallback Guarantee
  • Definition 1: Pareto Dominance