Abstract
Constraint programming is known for being an efficient approach for solving combinatorial problems. Important design choices in a solver are the branching heuristics, which are designed to lead the search to the best solutions in a minimum amount of time. However, developing these heuristics is a time-consuming process that requires problem-specific expertise. This observation has motivated many efforts to use machine learning to automatically learn efficient heuristics without expert intervention. To the best of our knowledge, it is still an open research question. Although several generic variable-selection heuristics are available in the literature, the options for a generic value-selection heuristic are more scarce. In this paper, we propose to tackle this issue by introducing a generic learning procedure that can be used to obtain a value-selection heuristic inside a constraint programming solver. This has been achieved thanks to the combination of a deep Q-learning algorithm, a tailored reward signal, and a heterogeneous graph neural network architecture. Experiments on graph coloring, maximum independent set, and maximum cut problems show that our framework is able to find better solutions close to optimality without requiring a large amounts of backtracks while being generic.
Introduction
Constraint Programming (CP) is a powerful paradigm for solving combinatorial optimization problems. At the heart of a CP solver's efficiency are branching heuristics, which dictate the search path by selecting variables and assigning values. While generic variable-selection heuristics (e.g., Impact-Based or Activity-Based search) are well-established, generic value-selection heuristics remain elusive, often requiring manual engineering for specific problem domains.
The integration of Machine Learning (ML) to automate heuristic design faces three primary challenges: the non-Markovian nature of backtracking in search trees, the sparsity of reward signals (often only available at the end of a search branch), and the difficulty of creating a generalizable representation for diverse CP models. This research addresses these hurdles by proposing a generic learning framework integrated into the SeaPearl.jl solver.
Methodology
The proposed framework leverages Deep Reinforcement Learning (DRL) and Heterogeneous Graph Neural Networks (GNNs) to learn value-selection policies.
Restart-Based Training
To handle the complexities of backtracking, the authors introduce a restart-based training strategy. Instead of training on a full depth-first search (DFS) tree, the agent performs "single dives" from the root to a leaf node. If a solution or a failure is reached, the episode ends and the solver restarts. This approach simplifies the credit assignment problem by mapping the search to a standard Markov Decision Process (MDP).
Propagation-Based Reward and Tripartite GNN
To mitigate sparse rewards, the agent receives an intermediate signal based on the reduction of the objective variable's domain. When a decision leads to significant pruning by the solver's propagation engine, the agent is rewarded.
The state representation uses a tripartite graph consisting of Variables, Values, and Constraints. This architecture allows the model to generalize across different problem sizes and types by capturing the underlying relational structure of the CP model.
Experimental Results
The framework was evaluated on three NP-hard problems: Graph Coloring (COL), Maximum Independent Set (MIS), and Maximum Cut (MAXCUT), using Barabási-Albert graphs to simulate real-world network structures.
The learned heuristics demonstrated superior solution quality compared to standard heuristics and random search. Notably, the "Restart-based Learning" strategy consistently outperformed both "DFS-based Learning" and "Random" baselines in finding high-quality solutions within a limited node budget.
Key insights include:
- Solver-Agent Synergy: The agent learns to maximize the effectiveness of the solver's internal propagation logic.
- Efficiency: Although GNN inference is computationally more expensive than simple heuristics, the resulting "smarter" search explores significantly fewer nodes to reach near-optimal solutions.
- First-Dive Performance: In Maximum Cut problems, the agent often finds near-optimal solutions on its very first dive, whereas random search requires tens of thousands of nodes to achieve similar results.
Discussion and Future Work
While the framework shows great promise for genericity, scalability remains a challenge as tripartite graphs grow with problem size. Future work may explore transfer learning or selective model invocation to reduce overhead. Additionally, extending the model to simultaneously learn both variable and value selection could further enhance solver performance.
Summary updated