Abstract
Constraint Satisfaction Problems (CSPs) are foundational to various AI domains, yet traditional solving techniques like Arc Consistency (AC) enforcement are often bottlenecked by sequential propagation logic. This paper introduces Recurrent Tensor Arc Consistency (RTAC), a novel framework that reformulates AC as a fixed-point iteration over tensors. By mapping variables to bitmasks and constraints to compatibility matrices, RTAC enables massive parallelism on modern GPUs. Empirical evaluations demonstrate that RTAC provides significant speedups and superior scaling compared to state-of-the-art sequential algorithms like AC3, particularly in large and dense constraint networks.
Introduction
At the heart of many artificial intelligence tasks—ranging from scheduling and planning to complex configuration—lies the Constraint Satisfaction Problem (CSP). To solve these problems efficiently, researchers utilize Arc Consistency (AC) enforcement. AC acts as a critical pruning step, removing values from a variable's domain that cannot possibly satisfy a given constraint, thereby drastically shrinking the search space.
For decades, the standard paradigm for enforcing AC has been sequential: a constraint is checked, inconsistent values are removed, and the change is "propagated" to connected variables via a queue. While algorithms like AC3 and AC2001 are highly optimized, their linear nature creates a computational bottleneck on modern parallel hardware. As constraint networks grow in size and density, this "chain of propagation" fails to leverage the massive throughput of GPUs.
Methodology: From Propagation to Recurrence
RTAC proposes a fundamental shift from incremental propagation to global recurrence. Instead of managing a queue of individual revisions, the algorithm reformulates AC as a fixed-point iteration where all inconsistent values across the entire network are identified and removed simultaneously.
Tensorization of CSPs
To exploit GPU acceleration, the components of a CSP are mapped to tensors:
- Variables: Represented as 1D bitmask arrays indicating the current state of the domain.
- Constraints: Represented as 2D compatibility matrices.
The RTAC Algorithm
The enforcement process is converted into basic tensor operations, such as matrix multiplications (matmul), sums, and logical masks. The process follows three primary steps:
- Support Accumulation: Calculating the support for each value across all constraints.
- Support Mask Computation: Identifying values that lack valid support across the network.
- Variable Domain Masking: Updating all variable domains in parallel based on the computed masks.
This implementation, built on PyTorch, avoids the branching logic and pointer-chasing that typically hinder CSP solvers on GPUs. Furthermore, the author introduces an incremental optimization (Proposition 2) that maintains the recurrence by only checking variables whose domains changed in the previous iteration, further reducing redundant work without sacrificing parallelism.
Experimental Evaluation
The performance of RTAC was evaluated against the standard AC3 algorithm using 25 different configurations of randomly generated binary CSPs. These benchmarks varied in scale (100 to 1,000 variables) and constraint density (0.1 to 1.0).
Key Results and Insights
The empirical results demonstrate that RTAC scales significantly better than sequential AC3. While the runtime of AC3 explodes as the number of variables and constraint density increase, the runtime of RTAC remains nearly flat.
For a dense network with 1,000 variables, AC3 required approximately 60ms per assignment, whereas RTAC handled the same task in roughly 3ms—a 20x speedup. A key finding is the "shallow" nature of the recurrence: while AC3 might require thousands of individual revisions, the RTAC recurrence typically converges to a fixed point in just 3 to 5 iterations, regardless of problem size. This efficiency is most pronounced in densely connected networks, which are traditionally the most difficult for sequential propagation algorithms.
Limitations and Future Work
While RTAC shows immense promise, its benefits are currently tied to GPU availability. In CPU-only environments, traditional sequential algorithms may still be preferable for smaller, sparser problems. Additionally, the current framework focuses on binary constraints; extending this tensor-based approach to $n$-ary (higher-order) constraints remains an open challenge. Future work will also explore "from-scratch" CUDA implementations to further minimize the overhead associated with general-purpose deep learning libraries like PyTorch.
Summary updated