Everyday routing requests are rarely a point-to-point shortest path. A driver may need to visit stops, sometimes in a fixed order, under time budgets or distance limits, and perhaps recharge their EV car along the way. Each combination is a distinct routing problem that classically requires its own algorithm, so no fixed solver covers the space of queries users may ask. This paper presents CRAFT, which takes a constrained routing query as free text and returns a route that satisfies the user's requirements on a real road network. An LLM parses the query and generates four search functions, which a generic graph-search engine executes on the road network. We formalize the underlying problem as State-Expanded RCSP (SE-RCSP), which extends resource-constrained shortest paths (RCSP) with non-additive state such as node-dependent resets and discrete progress tracking. We evaluate CRAFT on 2,600 natural-language queries over California road networks against two baselines, analyzing correctness, constraint violations, long-distance scalability, and semantic POI filtering.
Figures & tables
Figure 1: User Query Example
POIs
Route cost
Problem
Obj.
Constr.
Obj.
Constr.
Related work
Shortest path
✓
[ 2 , 31 ]
RCSP
✓
✓
[ 5 , 7 , 8 , 32 , 9 , 10 , 33 ]
Routing with stops
✓
✓
(✓)
[ 14 , 11 , 13 , 34 ]
Itinerary planning
✓
(✓)
✓
[ 16 , 17 , 19 ]
CRAFT
✓
✓
✓
✓
this paper
Table 1: Related work on route planning
Figure 2: CRAFT System Overview
Field
Value
query_id
example_query_1
source
v1
destination
v10
objective
minimize_distance
poi_category
[park, restaurant]
poi_filters
[{description: ‘playground for kids’}, {cuisine: ‘thai’}]
Figure 3: Spec Builder output for the example in Figure 1
Field
Value
query_id
example_query_1
route
[v1, v4, v5, v8, v7, v9, v10]
poi_stops
[{type: charger, node: v4},
{type: park, node: v7},
{type: restaurant, node: v9}]
objective(normalized to meters)
27358.8
Figure 5: Search output for the example in Figure 1 .
Query set
Count
Family
Main
Q1
EV Routing [ 20 , 21 ]
200
RP
“What’s the shortest route from A to B ? I’m at 12% of a 250-mile battery.”
Q2
EV + Ordered [ 20 , 11 ]
200
RP
“I need the shortest route from A to B with 20% charge: a pharmacy first and then a bank, with no leg over 5 miles.”
Q3
Unordered POI [ 14 ]
200
RP
Table 2: Benchmark query sets. Main and specialized sets are introduced in this paper; the external set (LLMAP) is re-grounded onto our road network. RP = route planning, IP = itinerary planning.
Objective
Battery
Stops
Order
Distance
Highway
Time
Filters
Q1
distance
✓
Q2
distance
✓
✓
✓
✓
Q3
time
✓
✓
Q4
distance
✓
✓
✓
Q5
POIs
✓
✓
Q6
time
✓
✓
Table 3: Objective and constraints of each query set. Objectives are minimized except Q5, which maximizes number of POIs.
Correct
Incorrect
Model
System
EV Routing
EV+Ordered
Unord. POI
Ordered POI
POI Collect.
T-Inf
Total
Error
F-Inf
Viol
Flash Lite
LLM
89
20
32
8
51
0
200
616
1
183
LLMAP
92
79
170
52
27
0
420
20
153
407
CRAFT
200
185
181
124
172
49
911
38
20
31
GPT-4.1
LLM
98
19
13
11
123
1
265
542
0
193
LLMAP
92
80
174
48
27
0
421
2
171
406
Table 4: Correct routes for the main Query Set and failure breakdown
Model
Template
#Q
LLM
LLMAP
CRAFT
Failed
Flash Lite
EV Routing
200
89
92
200
0
EV + Ordered
200
1
28
185
14
Unordered POI
200
1
38
179
4
Ordered POI
200
1
32
124
68
POI Collection
200
27
4
168
18
Total
1000
119
194
856
104
Table 5: Quality Experiments. Report the number of queries that each system answered correctly and with the best objective. Failed = all systems failed.
Figure 6: Per-stop classification of the stops proposed by the LLM-only baseline.
Figure 7: CRAFT outcome breakdown per LLM model (1,000 queries)
Model
System
Correct
Fail
Infeas
Viol
First-rank
Flash Lite
LLM
134
625
10
231
19
LLMAP
757
0
24
219
279
CRAFT
761
48
180
11
695
GPT-4.1
LLM
150
580
78
192
11
LLMAP
775
0
3
222
188
CRAFT
924
24
51
1
846
Table 6: Results of LLMAP-inspired benchmark of 1,000 queries [ 28 ] . First-rank credits every system tied on the best objective, as in Table 5 .
Template
Gemini Flash Lite
GPT-4.1
gpt-oss-20b
EV Routing
0.62%
0.24%
0.27%
EV + Ordered
0.77%
0.61%
1.40%
Ordered POI
0.10%
0.10%
0.33%
Unordered POI
2.21%
1.34%
1.39%
POI Collection
6.98%
1.40%
14.98%
Table 7: Optimality against the exact solver: MAPE of correct routes’ objectives relative to the proven optimum, per template and model.
Figure 8: Highway-avoidance template: correct routes per backbone (left) and the distribution of highway share of route distance (right). The leftmost bin is routes using no highway at all; the highest share observed is 52%.
Correct
Incorrect
Model
Route
T-Inf
Total
Error
F-Inf
Viol
Flash Lite
151
22
173
2
18
7
GPT-4.1
114
20
134
1
51
14
gpt-oss-20b
99
19
118
16
24
42
Table 8: Attribute- and description-filtered queries (Q7).
Figure 9: The description check. (a) Choosing θ on the calibration phrases, with the loss fixed at 5% in advance. (b) Each arm over the 47 description stops of Q7; calls are relative to LLM only.
Phrase
Role
AUC
Kept at θ
an art museum
test
0.91
100.0
a history museum
test
0.89
100.0
a theme park attraction
test
0.85
90.4
an upscale fine-dining restaurant
calib.
0.81
97.2
a cafe that roasts its own coffee
calib.
0.80
100.0
a park with sports fields
calib.
0.65
95.2
Table 9: Embedding quality. AUC and true matches at θ=0.32 (%).
Success (%)
Search (s), med.
States, med.
Model
Long
Opt
Long
Opt
Long
Opt
Flash Lite
94.5
96.0
3.6
0.6
678k
102k
GPT-4.1
75.0
92.5
3.1
0.5
584k
101k
gpt-oss-20b
71.6
87.3
3.1
0.5
594k
98k
Table 10: CRAFT on the 200 long EV trips: the baseline engine (Long) vs. the same generated code under an A ⋆ engine (Opt).
Real-world path planning tasks typically involve multiple constraints beyond simple route optimization, such as the number of routes, maximum route length, depot locations, and task-specific requirements. Traditional approaches rely on dedicated formulations and algorithms for each problem variant, making them difficult to scale across diverse scenarios. In this work, we propose a flexible framework that leverages large language models (LLMs) to solve constrained path planning problems directly from natural language input. The core idea is to allow users to describe routing tasks conversationally, while enabling the LLM to interpret and solve the problem through solution verification and iterative refinement. The proposed method consists of two integrated components. For problem types that have been previously formulated and studied, the LLM first matches the input request to a known problem formulation in a library of pre-defined templates. For novel or unseen problem instances, the LLM autonomously infers a problem representation from the natural language description and constructs a suitable formulation in an in-context learning manner. In both cases, an iterative solution generation and verification process guides the LLM toward producing feasible and increasingly optimal solutions. Candidate solutions are compared and refined through multiple rounds of self-correction, inspired by genetic-algorithm-style refinement. We present the design, implementation, and evaluation of this LLM-based framework, demonstrating its capability to handle a variety of constrained path planning problems. This method provides a scalable and generalizable approach for solving real-world routing tasks with minimal human intervention, while enabling flexible problem specification through natural language.
Dylan Shim, Minghan Wei
Florida Atlantic University, 777 Glades Road, Boca Raton, United States
We present our submission to the IJCAI 2025 'Counterfactual Routing Competition' (CRC 25). The goal of the competition is to find counterfactual explanations for the shortest path problem. This requires deciding what the minimal changes to a road network would make a route chosen by the user the optimal route. This enables explanations such as "Your suggested route would indeed have been optimal, if road X were not a bicycle path." Our solution models the problem as an integer program, iteratively incorporating constraints until an exact solution is found. In the final evaluation on held-out test instances, our method ranked fourth in solution quality and obtained its solution fastest on every instance, with an average runtime of 9.0 seconds compared to 118.8 seconds for the next-fastest submission.
The problem of route optimization with realistic constraints is becoming extremely relevant in the face of global urban population growth. While we are aware of approaches that theoretically provide an exact optimal solution, their application becomes challenging as the problem size increases because of exponential complexity. We investigate the Capacitated Vehicle Routing Problem with Time Windows (CVRPTW) and compare solutions obtaining by exact solver SCIP with heuristic algorithms such as LKH, 2-OPT, 3-OPT, the ORTools framework, and the deep learning model JAMPR. We demonstrate that for problem of size 50 deep learning and classical heuristic solutions became close to SCIP exact solution but requires less time. Additionally for problems with size 100, SCIP exact methods around 13 times slower that neural and classical heuristics with the same route cost and on around 50% worse for the first feasible solution on the same time. To conduct experiments, we developed the Smart Routes platform for solving route optimization problems, which includes exact, heuristic, and deep learning models, and facilitates convenient integration of custom algorithms and datasets.
Andrew Soroka, German Mikhelson, Alexander Mescheryakov +1
Moscow State University, Faculty of Computational Mathematics and Cybernetics, Moscow · Space Research Institute of RAS, Moscow