arXiv is now an independent nonprofit! Learn more
License: CC BY 4.0
arXiv:2609.00859v1 [cs.AI] 01 Sep 2026

Reinforcement Learning Enhanced LLM Agents for Complex Vehicle Routing Problems

Yi Chen Affiliation: School of Computer Science and Engineering, Sun Yat-sen University, Guangzhou 510006, China E-mail {cheny2596,wangjiah,yuzk6,zhoujp7}@mail2.sysu.edu.cn    Zikang Yu Affiliation: School of Computer Science and Engineering, Sun Yat-sen University, Guangzhou 510006, China E-mail {cheny2596,wangjiah,yuzk6,zhoujp7}@mail2.sysu.edu.cn    Jiahai Wang(🖂){(\textrm{\Letter})} Affiliation: School of Computer Science and Engineering, Sun Yat-sen University, Guangzhou 510006, China E-mail {cheny2596,wangjiah,yuzk6,zhoujp7}@mail2.sysu.edu.cn    Jinbiao Chen Affiliation: Department of Industrial Systems Engineering and Management, National University of Singapore, Singapore E-mail bill.cjb@nus.edu.sg    Jianpeng Zhou Affiliation: School of Computer Science and Engineering, Sun Yat-sen University, Guangzhou 510006, China E-mail {cheny2596,wangjiah,yuzk6,zhoujp7}@mail2.sysu.edu.cn    Zizhen Zhang E-mail {wangjiah, zhangzzh7}@mail.sysu.edu.cn Affiliation: School of Computer Science and Engineering, Sun Yat-sen University, Guangzhou 510006, China E-mail {cheny2596,wangjiah,yuzk6,zhoujp7}@mail2.sysu.edu.cn
Abstract

Vehicle Routing Problems (VRPs) are fundamental combinatorial optimization problems with widespread applications in various scenarios. The advanced optimization solvers can effectively solve such problems. However, modeling complex VRP variants for solvers often requires substantial domain expertise, which limits the accessibility of advanced optimization technologies. In this paper, we propose Reinforcement Learning Enhanced LLM Agents (RLEA), a multi-agent framework designed to automate the modeling of complex VRPs. RLEA introduces a lightweight neural Planner trained with Soft Q-learning to efficiently orchestrate the actions of LLM-based agents. In addition, we equip the system with an evolutionary memory module and retrieval-augmented generation, enabling the agent to leverage both accumulated experience and external solver knowledge during program generation and refinement for solving VRPs. We evaluated 48 distinct VRP variants across various solvers. The experimental results demonstrate that RLEA outperforms the previous state-of-the-art method, achieving a 16.67% higher success rate while significantly reducing runtime errors. These results validate that integrating reinforcement learning with LLM-based reasoning is highly effective for automated optimization modeling. The appendix is available at: https://doi.org/10.5281/zenodo.19134435.

Keywords: 
Vehicle Routing Problem Large Language Model Automatic Modeling Multi-Agent System Reinforcement Learning.

1 Introduction

Vehicle routing problems (VRPs) constitute an important class of combinatorial optimization problems in operations research and have been widely applied across various domains, such as communication and transportation [23, 2, 15]. Recent studies increasingly focus on more complex VRP variants to better reflect real-world scenarios [18, 27]. As the number and complexity of the constraints increase, the challenge of solving these NP-hard VRPs grows commensurately [4].

Recently, large language models (LLMs) have been increasingly applied to solving complex VRPs due to their strong capabilities in reasoning and code generation [6]. The LLM-based methods for complex VRPs can be mainly divided into three categories.

The first paradigm attempts to directly generate solutions using LLM [11]. These methods prompt the model to infer routes or decision sequences from natural language descriptions. However, due to the complex combinatorial structure and strict feasibility constraints of VRPs, these methods often struggle to produce valid and scalable solutions. The second paradigm emphasizes automated heuristic design. Leveraging the reasoning and code generation capabilities of LLMs, this approach has demonstrated substantial potential for automating heuristic design. Recent works [22, 16, 26, 30, 3, 7, 5, 29, 13] focus on combining evolutionary computation (EC) with LLMs to generate heuristics to solve VRPs. Although these methods show promise, they remain heavily reliant on the internal knowledge of LLMs and fail to leverage the capabilities of state-of-the-art (SOTA) optimization solvers designed by experts.

The third paradigm focuses on automatic modeling [10, 24, 1, 20, 21], where problem constraints are transformed into programs, enabling direct invocation of expert solvers to solve complex VRPs. Its core value lies in democratizing advanced optimization tools, enabling non-expert users to bridge the gap between high-level business requirements and rigorous solver execution. Traditionally, converting real-world VRPs into solver-ready models requires substantial domain expertise, which limits the accessibility of powerful optimization engines such as Gurobi [8] and OR-Tools [19]. The rapid development of LLMs has made this process increasingly feasible through automated reasoning and code generation. Existing automatic modeling methods mainly follow two routes: formulation-first methods, which first derive explicit mathematical formulations before program implementation, and code-only methods, which directly generate executable solver code from problem descriptions. In this paper, we use automatic modeling as a broad term to refer to the process of transforming high-level problem descriptions into solver-ready optimization programs, regardless of whether an explicit mathematical formulation is generated as an intermediate step. Recent state-of-the-art method DRoC [12] also adopts a code-only paradigm and improves the modeling accuracy of complex VRP variants by using retrieval-augmented generation (RAG). However, DRoC primarily depends on LLMs for action decision-making at each modeling step, leading to high inference latency caused by repeated LLM calls. In addition, its retrieval process mainly leverages external solver knowledge, overlooking valuable internal experience accumulated from previous modeling attempts.

In this work, we follow the automatic modeling paradigm and propose a Reinforcement Learning Enhanced LLM Agents famework (RLEA) that integrates a lightweight neural Planner, retrieval-based knowledge augmentation, and an evolved memory mechanism. This design enables efficient action orchestration while leveraging both external knowledge and internal experience to improve modeling robustness for complex VRP variants. The contributions of this paper can be summarized as follow:

  1. 1.

    We propose RLEA, a novel multi-agent framework that integrates reinforcement learning with LLM agents to automatically generate solver-ready programs for complex VRP variants.

  2. 2.

    We introduce a lightweight Planner trained with Soft Q-learning to adaptively select actions for LLM agents, enabling efficient exploration while significantly reducing the latency compared with LLM-based decision-making.

  3. 3.

    We present an agent equipped with evolvable memory. This agent actively analyzes interaction trajectories to identify successful action paths and derives the root causes of constraint conflicts from failure instances. Beyond the external knowledge provided by RAG, the agent further leverages its accumulated experience to enhance modeling robustness.

  4. 4.

    We conducted a comprehensive evaluation of RLEA across 48 distinct VRP variants. Experimental results demonstrate that RLEA significantly outperforms existing methods. Compared to the state-of-the-art (SOTA) method DRoC, RLEA achieves a 16.67% increase in success rate and a 10.41% reduction in runtime error rate.

2 Related Work

Recent studies have explored the potential of LLMs for automating modeling of operations research problems. Existing approaches within this paradigm can be broadly categorized into two groups based on whether an explicit mathematical formulation is generated before program implementation.

Formulation-First Methods

The first line of work follows a sequential pipeline that explicitly translates optimization problems into mathematical expressions before generating executable code. Early studies proposed structured workflows [1] to convert natural language descriptions into mathematical representations. Chain-of-Experts [24] introduces specialized agents to collaboratively construct mathematical formulations and corresponding solver implementations. More recently, unified learning-based frameworks have been proposed to improve the robustness of this formalization process. LLMOPT [10] introduces a universal five-element formulation that enables LLMs to represent diverse optimization problems in a structured symbolic form before generating solver-ready programs. By emphasizing mathematical clarity and structured reasoning, these approaches enhance interpretability and reduce the risk of incorrect program implementations.

Code-Only Methods

While methods that explicitly generate mathematical formulations offer strong interpretability, they often introduce unnecessary reasoning steps that can be error-prone, especially for highly specialized optimization tasks. As a result, a more efficient paradigm has emerged that directly maps problem descriptions to executable solver code, bypassing the need for explicit mathematical formulation. A representative example is DRoC [12], which leverages RAG to incorporate solver documentation and constraint-specific knowledge during code generation. By grounding the generation process in external resources, DRoC significantly enhances the modeling accuracy of complex VRP variants. However, such frameworks typically rely on LLMs for decision-making at every interaction step, resulting in high inference latency and underutilizing accumulated experience from previous modeling efforts.

To overcome these limitations, we propose RLEA, a reinforcement learning enhanced multi-agent framework [25]. RLEA introduces a lightweight neural Planner that efficiently orchestrates LLM-driven actions. By integrating policy learning, retrieval-augmented knowledge, and an evolved memory mechanism, RLEA enables more efficient and robust automatic modeling for complex VRP variants.

3 Preliminaries

3.1 Complex Vehicle Routing Problems

The VRPs aim to determine the optimal routes for a fleet of vehicles serving a set of customers. Formally, the problem is represented on a directed graph G=(V,E)G=(V,E), where V=0,1,…,NV={0,1,\dots,N} denotes the set of nodes (node 00 is the depot, and Vc={1,…,N}V_{c}=\{1,\dots,N\} are the customers), and E={(i,j)∣i,j∈V,i≠j}E=\{(i,j)\mid i,j\in V,i\neq j\} defines the edges. Each edge (i,j)(i,j) has an associated travel cost ci​jc_{ij}, representing the distance between nodes ii and jj. The binary decision variable xi​jx_{ij} is 1 if a vehicle travels from node ii to jj, and 0 otherwise. The objective is to minimize the total travel cost, expressed as:

𝒥=min∑i∈V∑j∈V,j≠ici​jxi​j.\mathcal{J}=\min\sum_{i\in V}\sum_{j\in V,j\neq i}c_{ij}x_{ij}. (1)

This objective is subject to several constraints:

∑j∈V,j≠ixi​j=∑j∈V,j≠ixj​i=1,∀i∈Vc,\sum_{j\in V,j\neq i}x_{ij}=\sum_{j\in V,j\neq i}x_{ji}=1,\quad\forall i\in V_{c}, (2)
∑j∈Vcx0​j=∑i∈Vcxi​0.\sum_{j\in V_{c}}x_{0j}=\sum_{i\in V_{c}}x_{i0}. (3)

Eq. (2) ensures each customer is visited by exactly one vehicle, and Eq. (3) ensures the depot flow conservation, with the same number of vehicles returning to the depot. We also consider nine additional VRP constraints based on real-world variants encountered in practical applications [12]: 1) Capacity, the vehicle load limit; 2) Open routes, where vehicles don’t have to return to the depot; 3) Distance limit, the total travel distance cannot exceed a specified bound; 4) Service time, each customer requires a specific service time; 5) Time window, each customer must be served within a given time frame; 6) Multiple depots, allowing vehicles to start and return to multiple depots; 7) Resource constraints, additional resource limitations; 8) Prize collecting, maximizing rewards while satisfying routing constraints; 9) Pickup and delivery, where pickup must occur before delivery. More details are in Appendix 1.

3.2 Problem Formulation

The goal of this work is to automatically generate solver-ready programs for complex VRP variants. Formally, We model this process as a Markov Decision Process (MDP) augmented with a memory pool, defined by the tuple ⟨𝒮,𝒜,𝒫,ℛ,γ,ℳ⟩\langle\mathcal{S},\mathcal{A},\mathcal{P},\mathcal{R},\gamma,\mathcal{M}\rangle.

At each step tt, an agent follows a policy π⁡(at∣st)\pi(a_{t}\mid s_{t}) to select an action at∈𝒜a_{t}\in\mathcal{A} based on the current state st∈𝒮s_{t}\in\mathcal{S}. Repeated action selection induces a trajectory τ=(s0,a0,s1,a1,…,sT)\tau=(s_{0},a_{0},s_{1},a_{1},\dots,s_{T}), which represents the entire process of code generation and refinement. Each state consists of the embeddings of the problem description and the current modeling code, while the action space defines the operations that the agent can invoke to generate or revise the code. After executing an action, the environment transitions to a new state according to the transition probability 𝒫⁡(st+1∣st,at)\mathcal{P}(s_{t+1}\mid s_{t},a_{t}). The reward function ℛ\mathcal{R} evaluates the quality and feasibility of the generated code. In addition, a memory pool ℳ\mathcal{M} stores historical experiences, allowing the agent to learn from past successes and failures.

To improve exploration and avoid premature convergence to sub-optimal actions, we adopt the Soft Q-Learning framework [9]. This approach augments the standard reinforcement learning objective with an entropy regularization term, encouraging stochastic policies and better exploration. The resulting objective is defined as:

J(π)=𝔼τ∼π[∑t=0Tγtr(st,at)+αH(π(⋅∣st,Mt))],J(\pi)=\mathbb{E}_{\tau\sim\pi}\left[\sum_{t=0}^{T}\gamma^{t}r(s_{t},a_{t})+\alpha\,{H}\!\left(\pi(\cdot\mid s_{t},M_{t})\right)\right], (4)

where τ\tau denotes a trajectory of states, actions, and rewards generated by the policy, HH denotes the entropy, and α\alpha is a weighting coefficient that regulates the impact of the entropy. The discount factor γ∈[0,1]\gamma\in[0,1] balances immediate rewards with long-term optimization performance.

4 Methodology

4.1 Overview

We propose Reinforcement Learning Enhanced LLM Agents (RLEA), a multi-agent framework for automatic VRP modeling. As illustrated in Figure 1, RLEA consists of three main components: a neural Planner, an LLM-based Executor, and a Memory module. The Planner selects actions based on the current problem state, the Executor carries out the selected action to generate or revise code, and the memory module continuously evolves historical interaction trajectories into reusable experience for future decision-making.

We next describe the action space, followed by the training strategy of the Planner and the inference procedure.

Refer to caption
Figure 1: Architecture of RLEA for automated VRP modeling. The input consists of the problem name and the current modeling code to be generated or revised. An extractor encodes this pair into embeddings, which define the Planner state. Based on the current state, the Planner follows a policy π⁡(a∣s)\pi(a\mid s) to select the action, such as exploiting similar historical experiences from the memory pool (MLEM). The selected action is then executed to generate or update the modeling code and invoke the solver for the current problem instance. During training, the Planner samples actions according to the learned policy; during inference, the Planner is frozen and selects actions deterministically.

4.2 Execution Action Space Design

To support automatic VRP modeling in complex settings, we design an action space 𝒜\mathcal{A} consisting of three actions: Refine, Retrieval-Augmented Generation (RAG), and Meta-Learning with Evolved Memory (MLEM). These actions are designed to address three key requirements in solver-oriented program generation: iterative error correction, the incorporation of external solver knowledge, and the reuse of evolved experience. Detailed prompts are provided in Appendix 2. Below we describe the mechanics of each action.

Refine

When handling complex VRP variants, the executor may produce erroneous code or incomplete constraint implementations. The Refine action exploits the self-correction capability of LLMs by enabling iterative revision based on the current code state. When this action is selected, the executor examines whether the generated code satisfies all required constraints, identifies potential sources of failure, and revises the program accordingly. This process allows the executor to reflect on and correct its previous output in a debugging-style manner. We denote this action by ara_{r}.

Retrieval-Augmented Generation

To compensate for the limited solver-specific knowledge encoded in LLM parameters, we incorporate a RAG mechanism that injects external documentation into the code generation process. This action is denoted by aga_{g}.

When selected, the Executor first decomposes the current problem PP into a set of atomic constraints,

𝒞={c1,c2,…,cN}=Φdecomp​(P),\mathcal{C}=\{c_{1},c_{2},\dots,c_{N}\}=\Phi_{\text{decomp}}(P), (5)

where Φdecomp\Phi_{\text{decomp}} denotes the LLM-based decomposition prompt and NN is the number of identified constraints, such as capacity limits or time windows. Each constraint cic_{i} is then used as a retrieval query.

Following [12], both query keywords and external documents are encoded into embeddings. For each constraint cic_{i}, we construct a query QiQ_{i} using the template “Python code for cic_{i}”. The relevance between the query embedding E⁡(Qi)E(Q_{i}) and a document embedding E⁡(dj)E(d_{j}) is measured by the squared Euclidean distance:

𝒟⁡(E⁡(Qi),E⁡(dj))=‖E⁡(Qi)−E⁡(dj)‖22.\mathcal{D}\big(E(Q_{i}),E(d_{j})\big)=\|E(Q_{i})-E(d_{j})\|_{2}^{2}. (6)

The retrieved candidates are further filtered by the LLM to remove irrelevant documents. If multiple candidates remain, the LLM summarizes them and selects the most relevant reference. The Executor then generates or revises modeling code using the retrieved documentation associated with all constraints. If the RAG action is invoked again, the executor refines the failed code conditioned on the previously retrieved content.

Meta-learning with Evolved Memory

To improve adaptation to new problem settings, we further introduce Meta-Learning with Evolved Memory (MLEM), which enables the agents to reuse evolved experience distilled from prior interactions. This action is denoted by ama_{m}.

The memory module consists of a Collector agent and a Memory Distiller agent. Formally, the memory pool is defined as a set of tuples ℳ={(qi,fi)}i=1N\mathcal{M}=\{(q_{i},f_{i})\}_{i=1}^{N}, where qiq_{i} denotes the problem description and fif_{i} represents corresponding execution feedback, including success summaries or failure analyses. The Collector monitors the Executor’s generation process, summarizes the causes of success or failure, and appends new records to the evolving memory pool ℳ\mathcal{M}.

When the MLEM action is activated for a current problem qq, the Memory Distiller aggregates the subset ℳq⊂ℳ\mathcal{M}_{q}\subset\mathcal{M} associated with similar problem types and organizes it into two complementary forms of experience: successful experience fsuccf_{\text{succ}} and failed experience ffailf_{\text{fail}}. To retrieve the most relevant demonstrations, we rank historical cases by the semantic similarity between problem embeddings:

S⁡(qc​u​r​r,qi)=E⁡(qc​u​r​r)⋅E⁡(qi)‖E⁡(qc​u​r​r)‖​‖E⁡(qi)‖,S(q_{curr},q_{i})=\frac{E(q_{curr})\cdot E(q_{i})}{\|E(q_{curr})\|\|E(q_{i})\|}, (7)

where E⁡(⋅)E(\cdot) denotes the embedding function. We then retrieve the top-KK most similar successful and failed memory pairs, denoted by 𝒟r​e​t={(fs​u​c​c(k),ff​a​i​l(k))}k=1K\mathcal{D}_{ret}=\{(f_{succ}^{(k)},f_{fail}^{(k)})\}_{k=1}^{K}.

The Executor implements the meta-learning mechanism by utilizing 𝒟r​e​t\mathcal{D}_{ret} as in-context demonstrations. The action ama_{m} of MLEM is thus formalized as generating the solution conditioned on both the current problem qc​u​r​rq_{curr} and the evolved memory Dr​e​t{D}_{ret}. This mechanism enables fast adaptation to unseen constraints by leveraging historical meta-knowledge. The detailed prompt together with representative memory examples, are provided in Appendix 2.

4.3 Training Phase: Policy Optimization and Memory Evolution

Static LLM-based decision-making pipelines are often insufficient for complex VRP modeling [14], where the most effective action depends on both the problem context and the current code state. This makes adaptive decision-making essential. In addition, the evolving memory pool is initially sparse, so the MLEM action ama_{m} may provide limited benefit in early training, which can further suppress exploration if a fixed action strategy is used. To address these challenges, RLEA employs a lightweight neural Planner trained with Soft Q-learning, enabling adaptive action selection without incurring the high cost of LLM-based decision-making at every interaction step.

The Planner learns a stochastic policy πθ​(at∣st)\pi_{\theta}(a_{t}\mid s_{t}) over the action space 𝒜={ar,ag,am}\mathcal{A}=\{a_{r},a_{g},a_{m}\}, corresponding to Refine, RAG, and MLEM, respectively. The detailed definitions of these actions are given in Section 4.2. The policy is induced by a soft Q-network through the Boltzmann distribution:

πθ​(a∣s)=exp⁡(Qθ​(s,a)/α)∑a′∈𝒜exp⁡(Qθ​(s,a′)/α),\pi_{\theta}(a\mid s)=\frac{\exp\left(Q_{\theta}(s,a)/\alpha\right)}{\sum_{a^{\prime}\in\mathcal{A}}\exp\left(Q_{\theta}(s,a^{\prime})/\alpha\right)}, (8)

where α>0\alpha>0 is the temperature parameter controlling the exploration–exploitation trade-off. A larger α\alpha encourages broader exploration over candidate actions, which is particularly beneficial in the early stage when evolved memory is not yet sufficiently informative, whereas a smaller α\alpha leads to more greedy action selection.

During training, the planner interacts with the environment to generate a trajectory τ\tau. To guide policy optimization, we design a dense reward based on the optimality gap. Let ytobjy_{t}^{\mathrm{obj}} denote the objective value of the solution obtained at step tt. The relative optimality gap δt\delta_{t} is defined as

δt=|ytobj−y∗y∗|,\delta_{t}=\left|\frac{y_{t}^{\mathrm{obj}}-y^{*}}{y^{*}}\right|, (9)

where y∗y^{*} denotes the reference optimal objective value obtained from expert benchmarks. To encourage high-quality solutions while explicitly penalizing execution failures, the reward rtr_{t} is defined as

rt={11+δt,if a feasible solution ​ytobj​ is obtained,0,otherwise.r_{t}=\begin{cases}\frac{1}{1+\delta_{t}},&\text{if a feasible solution }y_{t}^{\mathrm{obj}}\text{ is obtained},\\[4.0pt] 0,&\text{otherwise}.\end{cases} (10)

This reward is bounded in (0,1](0,1] for valid solutions and approaches 1 as the solution converges to the optimum.

The Planner is parameterized by a soft Q-network Qθ​(s,a)Q_{\theta}(s,a). Its input state is the embedding of the current problem context, including the VRP variant description and the current modeling code, extracted by a frozen open-source small language model. The Planner is trained by minimizing the soft Bellman residual. Specifically, the soft temporal-difference target is defined as

y^t=rt+γ⁡(1−dt)​α​log​∑a′∈𝒜exp⁡(Qθ¯​(st+1,a′)α),\hat{y}_{t}=r_{t}+\gamma(1-d_{t})\,\alpha\log\sum_{a^{\prime}\in\mathcal{A}}\exp\left(\frac{Q_{\bar{\theta}}(s_{t+1},a^{\prime})}{\alpha}\right), (11)

where dt∈{0,1}d_{t}\in\{0,1\} is the termination flag, γ∈[0,1]\gamma\in[0,1] is the discount factor, and Qθ¯Q_{\bar{\theta}} denotes the target network. The training objective is

ℒ⁡(θ)=𝔼(st,at,rt,st+1)∼ℬ​[(Qθ​(st,at)−y^t)2],\mathcal{L}(\theta)=\mathbb{E}_{(s_{t},a_{t},r_{t},s_{t+1})\sim\mathcal{B}}\left[\left(Q_{\theta}(s_{t},a_{t})-\hat{y}_{t}\right)^{2}\right], (12)

where ℬ\mathcal{B} is the experience replay buffer. Meanwhile, memory evolution proceeds in parallel with policy optimization. The replay buffer ℬ\mathcal{B} is used exclusively for reinforcement learning updates, whereas the memory pool ℳ\mathcal{M} is maintained separately to accumulate and evolve historical interaction records for the MLEM action.

4.4 Inference Phase: Policy Evaluation and Generalization

During inference, the Planner parameters θ\theta are frozen. Given a target VRP variant, the executor first attempts to generate solver-ready code from the problem description directly. If this initial attempt fails to produce a valid code, the problem description together with the generated code is encoded as the initial state for the Planner.

Starting from this state, the Planner performs a forward pass and selects actions from the action space 𝒜\mathcal{A} according to the learned policy. Conditioned on the selected actions, the Executor iteratively generates or refines the modeling code for the target problem. In this way, the Planner serves as a lightweight decision-making module that orchestrates the interaction process without requiring costly LLM-based deliberation at every step.

We impose a maximum number of steps Tm​a​xT_{max}. The procedure terminates early once the generated code successfully invokes the solver and produces a solution whose relative optimality gap is below 5%. This mechanism prevents infinite refinement loops while still allowing sufficient opportunities for the agent to correct modeling or syntax errors.

5 Experiments

In this section, we conduct comprehensive experiments to evaluate the effectiveness of RLEA on automated VRP modeling. The experiments cover 48 VRP variants composed of different constraint combinations. All experiments are conducted on a Tesla A40 GPU and an Intel i5-7500 CPU.

5.1 Experiment Settings

Hyperparameters

The Planner is trained using the Soft Q-Learning algorithm with the Adam optimizer and a learning rate of 1×10−41\times 10^{-4}. The model consists of a frozen small language model (SLM) and a trainable Q-value head. We adopt Qwen2.5-1.5B-Instruct as the SLM to encode state representations with a maximum context length of 8192 tokens. The Q-value head is a two-layer MLP with 256 hidden units and ReLU activation, mapping state embeddings to the action space. DeepSeek-Reasoner as the Executor and ChatGPT (gpt-4o-2024-08-06) as the Memory Agent.

The replay buffer has a capacity of 512 state transitions, with a training batch size of 16. The discount factor is set to γ=0.99\gamma=0.99, and the entropy temperature coefficient is fixed at α=4\alpha=4 to encourage exploration. The target network is updated every four training steps via hard parameter copying. Each training episode is limited to a maximum of 16 interaction steps to avoid infinite loops.

Baselines

We compare RLEA with five representative baselines:

  • •

    Direct Generation: Standard prompting without additional reasoning or correction mechanisms.

  • •

    Reasoning-based methods: Self-Refine [17] and Chain-of-Thought (CoT) [28].

  • •

    Formulation-first approach: Chain-of-Experts (CoE) [24].

  • •

    Code-only approach: DRoC [12].

In our framework, two inference settings are evaluated. In offline inference, the Executor generates solutions using a pre-trained memory pool. In online inference, the memory agent dynamically constructs and updates the memory pool during test time.

To ensure robustness, we conducted evaluations using two widely used optimization solvers: Gurobi [8] and OR-Tools [19]. The maximum number of interaction steps during inference was set to Tm​a​x=6T_{max}=6. To ensure a fair comparison, all baselines were assigned the same iteration budget. As in previous work [12], the reported results are the average of three independent runs.

Performance Metrics

There are two performance metrics we used:

  • •

    Success Rate (SR): This metric evaluates the capability of the framework to generate valid modeling code. It is defined as:

    SR=Ns​u​c​cNt​o​t​a​l×100%\text{SR}=\frac{N_{succ}}{N_{total}}\times 100\% (13)

    where Nt​o​t​a​lN_{total} is the total number of VRP instances tested. Ns​u​c​cN_{succ} represents the number of instances where the generated code successfully executes and yields a feasible solution (i.e., the solver successfully returns a valid objective value without errors).

  • •

    Runtime Error Rate (RER): This metric reflects the proportion of programs that fail to execute due to syntax errors, API misuse, or internal logical flaws. It is calculated as:

    RER=Ne​r​rNt​o​t​a​l×100%\text{RER}=\frac{N_{err}}{N_{total}}\times 100\% (14)

5.2 Main Results

Table 1 reports the performance of RLEA and five representative baselines in terms of Success Rate (SR) and Runtime Error Rate (RER) on both OR-Tools and Gurobi solvers.

Methods that rely solely on the internal knowledge of LLMs, including Standard Prompting, CoT, and Self-Refine, achieve limited performance, indicating that complex VRP variants are difficult to model accurately without domain-specific knowledge. CoE produces the lowest rates on SR due to its focus on Mixed-Integer Programming rather than complex VRPs, it maintains a remarkably low RER suggesting the potential of the multi-agent framework. By incorporating external solver documentation, DRoC improves performance over these methods, demonstrating the importance of domain-specific knowledge retrieval.

Our method achieves the best overall performance. On OR-Tools, RLEA reaches an SR of 62.50%, outperforming the previous state-of-the-art DRoC by 16.67%, while also significantly reducing runtime errors. Although the generated solutions are not always optimal, they already provide valid solver implementations, allowing human developers to focus on solution improvement rather than constructing models from scratch. This improvement stems from the synergy of the learned Planner policy, external knowledge retrieval, evolved memory, and the refine mechanism, which together enable effective error correction and solution refinement.

In the online inference setting, the performance is slightly lower than in the offline setting but still surpasses all baselines. This difference is mainly due to the dynamic updating of the memory pool during inference, which introduces additional stochasticity in the learning process. However, this dynamic memory mechanism encourages broader exploration and ultimately contributes to a further reduction in runtime errors.

Table 1: Performance comparison of different prompting and agent-based methods.
Methods OR-Tools Gurobi
SR (%) RER (%) SR (%) RER (%)
Standard Prompting 29.17 39.58 29.17 27.08
Self-Refine 31.25 39.58 33.33 35.42
Chain of Thoughts 25.00 54.17 18.75 56.25
Chain of Experts 16.67 27.08 8.33 18.75
DRoC 45.83 27.08 35.42 33.33
Ours (offline) 62.50 16.67 43.75 16.67
Ours (online) 60.42 12.50 39.58 22.92

5.3 Ablation Study

Table 2: Ablation study on the Planner.
Method SR (%) RER (%) Avg Time (s)
Ours 62.50 16.67 3.06
w/o Planner 50.00 14.58 -
Prompt-based Planner 56.25 12.50 153.30

We conduct ablation studies to evaluate the contribution of key components in RLEA, including the neural Planner and the action modules. The results are presented in Table 2 and Table 3.

Ablation on the Planner

To assess the impact of the learned Planner, we compare RLEA with two variants on OR-Tools: (1) w/o Planner, where actions are randomly selected, and (2) prompt-based Planner, where DeepSeek-Reasoner generates the execution strategy through prompting. As shown in Table 2, RLEA achieves the highest SR, indicating that the learned policy effectively captures action-selection patterns across different VRP variants. Although the prompt-based Planner also attains a reasonable success rate, it incurs higher inference latency, while our neural Planner enables significantly faster decision-making. The slightly higher RER of RLEA reflects a trade-off between aggressive exploration and execution stability: by exploring more complex reasoning trajectories, the Planner occasionally encounters challenging edge cases. In contrast, the lower RER of the baselines stems from their simpler or more cautious trajectories, which avoid such boundary risks but fail to achieve high SR.

Refer to caption
Figure 2: Distribution of action types executed by RLEA on OR-Tools.

Ablation on action module

In order to investigate the impact of the actions, we conduct an ablation study as shown in Table 3. The results demonstrate that our full method consistently achieves the highest SR and the lowest RER compared to all variants lacking a specific action module. Removing Refine causes the largest performance drop, suggesting that refine is the most critical action in our framework. Given that many modeling or programming errors are relatively easy to solve, the Executor can rectify minor logical flaws autonomously, thereby preventing simple errors from escalating into task failures. The action distribution in Figure 2 further supports this observation, where Refine accounts for 50.65% of the executed actions. In contrast, removing RAG or MLEM leads to comparable performance degradation, suggesting that external knowledge retrieval and evolved memory play complementary roles in improving modeling accuracy.

Table 3: Ablation study of different actions on OR-Tools.
Method SR (%) RER (%)
Ours 62.50 16.67
w/o Refine 39.58 36.25
w/o RAG 43.75 22.92
w/o Meta learning with evolved memory 41.67 27.08

5.4 Impact of Different LLM Compositions

The experimental results in Table 4 reveal a clear performance advantage in heterogeneous multi-agent collaboration, specifically validating the optimal division of Action (reasoning-intensive models) and Memory (general-purpose models). The DeepSeek-r1 (Action) and GPT-4o (Memory) configuration achieves a peak Success Rate (SR) of 62.50%, demonstrating that DeepSeek-r1 demonstrates its ability to leverage reasoning capabilities for the effective modeling of complex VRPs, while GPT-4o provides a robust contextual foundation for retrieval.

Conversely, when assigning GPT-4o to execute action and DeepSeek-r1 to manage the memory modules, the SR to drop to 45.83%. This suggests that DeepSeek-r1’s intensive reasoning may be counterproductive for memory distillation, where its tendency toward over-deliberation introduces noise that hinders concise information flow. Furthermore, all single-model setups exhibit significant performance bottlenecks, such as the standalone GPT-4o’s low 37.50% SR. These findings underscore that decoupling roles within a multi-agent framework prevents the cognitive overload inherent in single-agent architectures, allowing specialized LLMs to leverage their distinct strengths for superior collective performance.

Table 4: Performance comparison of different LLM compositions
ExecutorMemory DeepSeek-r1 GPT-4o Qwen3-max
SR(%) RER(%) SR(%) RER(%) SR(%) RER(%)
DeepSeek-r1 52.08 22.92 62.50 16.67 43.75 12.50
GPT-4o 45.83 25.00 37.50 31.25 47.92 18.75
Qwen3-max 52.08 16.67 60.42 12.50 45.83 14.58
Figure 3: Sensitivity analysis of OR-Tools performance relative to iterations

5.5 Sensitivity Analysis of Iterations

We analyze the effect of the maximum number of interaction iterations on performance using OR-Tools. Since the action space contains three actions, the minimum number of iterations is set to 3. As shown in Figure 3, performance improves steadily as the number of iterations increases from 3 to 6: the SR rises from 34.15% to 62.50%, while the RER decreases from 43.90% to 16.67%.

When the iteration number reaches 6, the framework achieves its best performance. Further increasing the iteration budget brings only marginal gains. This suggests that excessive iterations may lead to over-searching or algorithmic stagnation, where the added computational cost no longer yields better performance.

6 Conclusion

In this paper, we propose RLEA, a novel multi-agent framework for automating the modeling and solving of complex VRPs. By integrating a lightweight Planner optimized via Soft Q-Learning, RLEA enables rapid execution by the Executor, reducing computational overhead. The hybrid memory mechanism, combining evolutionary trajectory analysis with external RAG-based knowledge, ensures robust self-correction, helping resolve constraint conflicts that often cause solver failures. Empirical results show a 62.50% success rate across 48 VRP variants, achieving a 16.67% performance gain over the previous state-of-the-art. Future work will explore integrating multi-modal inputs for VRPs described through visual diagrams and extending the framework to dynamic, real-time routing scenarios with evolving constraints.

Acknowledgements

This work is supported by the National Natural Science Foundation of China (62472461), and the Guangdong Basic and Applied Basic Research Foundation (2025A1515010129).

References

  • [1] A. AhmadiTeshnizi, W. Gao, and M. Udell (2024) OptiMUS: scalable optimization modeling with (MI)LP solvers and large language models. In ICML, Proceedings of Machine Learning Research, Vol. 235, pp. 577–596. Cited by: §1, §2.
  • [2] J. Bi, Y. Ma, J. Wang, Z. Cao, J. Chen, Y. Sun, and Y. M. Chee (2022) Learning generalizable models for vehicle routing problems via knowledge distillation. In Advances in Neural Information Processing Systems, Vol. 35, pp. 31226–31238. Cited by: §1.
  • [3] T. Cazenave Learning a prior for monte Carlo search by replaying solutions to combinatorial problems. In Parallel Problem Solving from Nature - PPSN XVIII - 18th International Conference, PPSN 2024, Vol. 15148, pp. 85–99. Cited by: §1.
  • [4] J. Chen, H. Huang, Z. Zhang, and J. Wang (2022) Deep reinforcement learning with two-stage training strategy for practical electric vehicle routing problem with time windows. In International Conference on Parallel Problem Solving from Nature, pp. 356–370. Cited by: §1.
  • [5] P. Cybula, A. Jaszkiewicz, P. Pelka, M. Rogalski, and P. Sielski Evolutionary algorithm for vehicle routing with diversity oscillation mechanism. In Parallel Problem Solving from Nature - PPSN XVII - 17th International Conference, PPSN 2022, Dortmund, Germany, September 10-14, 2022, Proceedings, Part I, Vol. 13398, pp. 279–293. Cited by: §1.
  • [6] Y. Feng, Y. Liu, J. Zhang, J. Qin, et al. (2026) MoniTor: exploiting large language models with instruction for online video anomaly detection. In Advances in Neural Information Processing Systems, Cited by: §1.
  • [7] S. Guo, N. Yin, J. Kwok, and Q. Yao Nested-refinement metamorphosis: reflective evolution for efficient optimization of networking problems. In Findings of the Association for Computational Linguistics, ACL 2025, Vienna, Austria, July 27 - August 1, 2025, pp. 17398–17429. Cited by: §1.
  • [8] Gurobi Optimization, LLC (2024) Gurobi optimizer reference manual. Note: Accessed: 2026-03-16 External Links: Link Cited by: §1, §5.1.
  • [9] T. Haarnoja, H. Tang, P. Abbeel, and S. Levine (2017) Reinforcement learning with deep energy-based policies. In ICML, Proceedings of Machine Learning Research, Vol. 70, pp. 1352–1361. Cited by: §3.2.
  • [10] C. Jiang, X. Shu, H. Qian, X. Lu, J. Zhou, A. Zhou, and Y. Yu (2025) LLMOPT: Learning to define and solve general optimization problems from scratch. In The Thirteenth International Conference on Learning Representations, Cited by: §1, §2.
  • [11] X. Jiang, Y. Wu, M. Li, Z. Cao, and Y. Zhang (2026) Large language models as end-to-end combinatorial optimization solvers. Advances in Neural Information Processing Systems 38, pp. 164787–164826. Cited by: §1.
  • [12] X. Jiang, Y. Wu, C. Zhang, and Y. Zhang (2025) DRoC: elevating large language models for complex vehicle routing via decomposed retrieval of constraints. In ICLR, Cited by: §1, §2, §3.1, §4.2, 4th item, §5.1.
  • [13] K. Li, F. Liu, Z. Wang, X. Tong, X. Han, M. Yuan, and Q. Zhang (2025) Ars: automatic routing solver with large language models. arXiv preprint arXiv:2502.15359. Cited by: §1.
  • [14] Y. Li, G. Cai, S. Yang, H. Luo, S. Han, X. He, D. Li, and L. Feng (2026) PhGPO: pheromone-guided policy optimization for long-horizon tool planning. arXiv preprint arXiv:2602.13691. Cited by: §4.3.
  • [15] Z. Liao, J. Chen, D. Wang, Z. Zhang, and J. Wang (2025) BOPO: neural combinatorial optimization via best-anchored and objective-guided preference optimization. In Proceedings of the 42nd International Conference on Machine Learning (ICML 2025), Vol. 267, pp. 37456–37475. Cited by: §1.
  • [16] F. Liu, X. Tong, M. Yuan, X. Lin, F. Luo, Z. Wang, Z. Lu, and Q. Zhang (2024) Evolution of heuristics: towards efficient automatic algorithm design using large language model. In Forty-first International Conference on Machine Learning, ICML 2024, Vienna, Austria, July 21-27, 2024, Cited by: §1.
  • [17] A. Madaan, N. Tandon, P. Gupta, S. Hallinan, L. Gao, S. Wiegreffe, U. Alon, N. Dziri, S. Prabhumoye, Y. Yang, S. Gupta, B. P. Majumder, K. Hermann, S. Welleck, A. Yazdanbakhsh, and P. Clark (2023) Self-Refine: iterative refinement with self-feedback. In NeurIPS, Cited by: 2nd item.
  • [18] A. Mor and M. G. Speranza (2022) Vehicle routing problems over time: a survey. Annals of Operations Research 314 (1), pp. 255–275. Cited by: §1.
  • [19] OR-Tools Google. External Links: Link Cited by: §1, §5.1.
  • [20] G. Prasath and S. Karande (2023) Synthesis of mathematical programs from natural language specifications. arXiv preprint arXiv:2304.03287. Cited by: §1.
  • [21] R. Ramamonjison, T. T. L. Yu, R. Li, H. Li, G. Carenini, B. Ghaddar, S. He, M. Mostajabdaveh, A. Banitalebi-Dehkordi, Z. Zhou, and Y. Zhang (2023) NL4Opt competition: formulating optimization problems based on their natural language descriptions. arXiv preprint arXiv:2303.08233. Cited by: §1.
  • [22] B. Romera-Paredes, M. Barekatain, A. Novikov, M. Balog, M. P. Kumar, E. Dupont, F. J. R. Ruiz, J. S. Ellenberg, P. Wang, O. Fawzi, P. Kohli, and A. Fawzi (2024) Mathematical discoveries from program search with large language models. Nat. 625 (7995), pp. 468–475. Cited by: §1.
  • [23] X. Wu, D. Wang, L. Wen, Y. Xiao, C. Wu, Y. Wu, C. Yu, D. L. Maskell, and Y. Zhou (2025) Neural combinatorial optimization algorithms for solving vehicle routing problems: a comprehensive survey with perspectives. arXiv preprint arXiv:2406.00415. Cited by: §1.
  • [24] Z. Xiao, D. Zhang, Y. Wu, L. Xu, Y. J. Wang, X. Han, X. Fu, T. Zhong, J. Zeng, M. Song, and G. Chen (2024) Chain-of-Experts: When LLMs meet complex operations research problems. In ICLR, Cited by: §1, §2, 3rd item.
  • [25] S. Yang, Y. Li, S. He, Y. Li, Q. Cai, P. Jiang, and L. Feng (2026) Phase-aware mixture of experts for agentic reinforcement learning. In ICML, Cited by: §2.
  • [26] H. Ye, J. Wang, Z. Cao, F. Berto, C. Hua, H. Kim, J. Park, and G. Song ReEvo: large language models as hyper-heuristics with reflective evolution. In Advances in Neural Information Processing Systems 38: Annual Conference on Neural Information Processing Systems 2024, NeurIPS 2024, Vancouver, BC, Canada, December 10 - 15, 2024, Cited by: §1.
  • [27] Z. Yu, J. Chen, and J. Wang (2026) Combination-of-experts with knowledge sharing for cross-task vehicle routing problems. In The Fourteenth International Conference on Learning Representations, Cited by: §1.
  • [28] J. Zhang, W. Wang, S. Guo, L. Wang, F. Lin, C. Yang, and W. Yin (2024) Solving general natural-language-description optimization problems with large language models. In NAACL (Industry Track), pp. 483–490. Cited by: 2nd item.
  • [29] N. Zhang, Z. Cao, J. Zhou, C. Zhang, and Y. Ong (2026) An agentic framework with LLMs for solving complex vehicle routing problems. In The Fourteenth International Conference on Learning Representations, Cited by: §1.
  • [30] Z. Zheng, Z. Xie, Z. Wang, and B. Hooi Monte Carlo tree search for comprehensive exploration in LLM-based automatic heuristic design. In Forty-second International Conference on Machine Learning, ICML 2025, Vancouver, BC, Canada, July 13-19, 2025, Cited by: §1.