
Accepted for publication in SCIENCE CHINA Mathematics
This problem can be modeled as a Steiner Tree Problem in graphs (STP). Although these problems all involve finding
spanning trees in graphs, they have different constraints and objective functions, requiring heuristic algorithms tailored
to their specific problem characteristics, without a uniform solution framework. Moreover, unlike the Minimum
Spanning Tree (MST) problem, which can be solved in polynomial time by exact algorithms such as Prim’s algorithm
[
56
], finding optimal solutions for these problems requires computation time exponential in problem size, making it
impractical for real-world applications.
In contrast to conventional algorithms that are designed based on expert knowledge, end-to-end models leveraging
deep neural networks have achieved notable success in tackling a wide range of combinatorial optimization problems
[
35
,
36
]. However, most methods treat the problem as permutating a sequence of vertices, e.g., allocating resources in
the knapsack problem [
24
], finding the shortest travel route in routing problems [
6
,
46
,
53
,
75
,
77
,
78
], approximating
minimum vertex cover and maximum cut on graphs [
21
], learning elimination order in tree decomposition [
43
],
locating facilities in the p-median problem [
76
], and determining Steiner points in STP [
2
]. For problems that require
decision-making on edge sets such as MST, due to the need to consider the connectivity and acyclicity of the solution,
there hardly exists methods that deal with the edge generation tasks directly. [
26
] proposed to first transform edges
into vertices by constructing line graphs, then use an end-to-end approach to tackle various graph problems, including
MST. This method, however, is not suitable for dense graphs, as their line graphs are quite large. [
27
] presented the use
of Graph Neural Networks and Reinforcement Learning (RL) to solve STP, whose decoder, after outputting a vertex,
selects the edge with the smallest weight connected to that vertex in the partial solution. However, this method cannot
be applied to problems where the objective function is not the sum of the weights of all edges.
This paper proposes NeuroPrim, a novel framework that utilizes the successful Transformer model to solve three
challenging spanning tree problems in Euclidean space, namely the DCMST, MRCST and STP problems. The algorithm
is based on a Markov Decision Process (MDP) for general combinatorial optimization problems on graphs, which
significantly reduces the action and state spaces by maintaining the connectivity of partially feasible solutions, similar
to Prim’s algorithm. The framework is parameterized and trained with problem-related masks. Our goal is not to
outperform existing solvers; instead, we demonstrate that our approach can produce approximate solutions to various
sizes and variants of spanning tree problems quickly, with minimal modifications required after training. Our approach’s
effectiveness may provide insights into developing algorithms for problems with complex constraints and few heuristics.
Our work makes several significant contributions, including:
•
We present a novel Markov Decision Process (MDP) framework for general combinatorial optimization
problems on graphs. This framework allows all constructive algorithms for solving these problems to be
viewed as greedy rollouts of some policy solved by the model.
•
We propose NeuroPrim, a unified framework that leverages the MDP to solve problems that require decisions
on both vertex and edge sets. Our framework is designed to be easily adaptable, requiring only minimal
modifications to masks and rewards to solve different problems.
•
To the best of our knowledge, we are the first to use a sequence-to-sequence model for solving complex
spanning tree problems. We demonstrate the effectiveness of our approach by applying it to three challenging
variants of the spanning tree problem on Euclidean space, achieving near-optimal solutions in a short time and
outperforming strong heuristics.
2 Preliminaries
In this section, we describe the problems investigated and the techniques employed. Firstly, we present three vari-
ants of the spanning tree problem under investigation. Subsequently, we introduce the networks utilized for policy
parameterization.
2.1 Spanning tree problems
Given an undirected weighted graph
(V(G), E(G), w)
with
v(G)
vertices,
e(G)
edges and
w:E→R
specifying
the weight of each edge, a spanning tree of
G
is a subgraph that is a tree which includes all vertices of
G
. Among all
combinatorial optimization problems with spanning trees, the Minimum Spanning Tree (MST) problem is one of the
most typical and well-known one. The problem seeks to find a spanning tree with least total edge weights and can be
solved in time
O(e(G) log v(G))
by Bor˚uvka’s algorithm [
10
], Prim’s algorithm [
56
] and Kruskal’s algorithm [
47
].
However, with additional constraints or modifications to the objective function, it becomes more difficult to solve these
problems to optimality. Three variants of the spanning tree problem are considered in this paper. For each variant, an
example in Euclidean space is shown in Figure 1.
2