Traffic multi-agent simulation decision method and system based on large language model
Patent Information
- Application Number
- CN202510386357.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-31
- Publication Date
- 2026-09-04
- Estimated Expiration
- 2045-03-31
AI Technical Summary
该方法核心问题体现在:(1)行为真实性缺陷:随机策略导致个体决策偏差,产生不真实的出行行为,例如步行50km通勤,与实际决策行为脱节;(2)收敛效率瓶颈:该随机策略缺乏明确目标导向,导致收敛速度慢,通常需要300次以上迭代,造成时间和算力资源的浪费;(3)规则适应性局限:打分函数设计依赖人工规则,难以适应动态复杂场景
[0026]本发明提出一种基于大语言模型的交通多智能体仿真决策方法及系统,首次将大语言模型的认知推理能力引入交通仿真决策闭环,实现决策逻辑从"随机试错"到"因果推断"的范式转变。本方法赋予仿真中的多智能体决策智能,替换原本仿真模型中的随机更新策略和打分模块,利用仿真获取的实时路网状态数据和各出行方式属性值,结合大语言模型的深度学习模型,决策个体在特定出行场景下的出行方式、出发时间和出行路径。该方法在保证决策合理性的同时,能够极大程度降低仿真迭代优化次数,提高收敛效率,节约时间和经济成本。
Smart Images

Figure CN120317113B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the interdisciplinary field of intelligent transportation systems and artificial intelligence, specifically relating to a traffic multi-agent simulation decision-making method and system based on a large language model. Background Technology
[0002] With the continuous improvement of urban transportation infrastructure, a multi-agent simulation model for the refined allocation and control of urban transportation resources has emerged. This simulation model models real-world individuals one-to-one in the virtual world, simulates each traveler's daily activities and transportation, and scores each individual after the simulation. Furthermore, the model improves individual scores by randomly changing individual travel modes, departure times, and travel routes, and finally achieves individual optimality and Nash equilibrium. Although random changes enrich the diversity of each individual's travel behavior, this method essentially improves individual scores through continuous trial and error, without endowing individuals with the ability to think. The core problems of this method are: (1) Defect of behavioral authenticity: The random strategy leads to individual decision-making bias, resulting in unrealistic travel behavior, such as walking 50km to commute, which is out of touch with actual decision-making behavior; (2) Bottleneck of convergence efficiency: The random strategy lacks a clear goal orientation, resulting in slow convergence speed, usually requiring more than 300 iterations, causing a waste of time and computing resources; (3) Limitation of rule adaptability: The scoring function design relies on manual rules, which is difficult to adapt to dynamic and complex scenarios. Therefore, this invention proposes a traffic multi-agent simulation decision-making method and system based on a large language model. Summary of the Invention
[0003] The purpose of this invention is to provide a traffic multi-agent simulation decision-making method and system based on a large language model, which is applicable to the intelligent transformation of the decision-making mechanism of open-source multi-agent traffic simulation platforms such as MATSim and TRANSIMS, and realizes dynamic optimization of urban traffic resource allocation and a breakthrough improvement in simulation and deduction efficiency.
[0004] The specific technical solution adopted by this invention is as follows:
[0005] A traffic multi-agent simulation decision-making system based on a large language model includes:
[0006] The perception layer is a spatiotemporal tensor encoder used for multimodal data fusion. It encodes road network status data into a three-dimensional feature matrix containing channel, time, and spatial dimensions. The channel dimension includes traffic flow, speed, and density. The time dimension adopts a sliding time window evolution mode. The spatial dimension adopts a road network graph convolutional topology. The perception layer also achieves joint representation of numerical road network data and text-based event reports through a hybrid embedding model.
[0007] Decision Layer: Dynamic Prompt Generator, which generates a set of candidate solutions based on a four-layer progressive prompt structure. The four-layer structure includes: a context-aware layer for extracting weather and emergencies; a constraint recognition layer for parsing user attributes; a solution generation layer for driving the large language model to output strategies; an optimization and verification layer for fine-tuning based on simulation feedback; and a decision layer that collaborates with the decision core module to perform Monte Carlo Tree Search (MCTS) multi-objective optimization.
[0008] Execution layer: A cross-language communication bridge that uses the gRPC bidirectional streaming communication protocol and the Protobuf data serialization scheme to achieve millisecond-level data interaction between the Java simulation platform and the Python model service, and supports a hot-plug mechanism for the policy injection interface.
[0009] Preferably, the channel dimension of the spatiotemporal tensor encoder is constructed using the following formula:
[0010]
[0011] Among them, G conv For the convolutional features of the road network map, Vt, Ft, Dt t These are spatiotemporal sliding window features for velocity, flow rate, and density, respectively.
[0012] Preferably, the dynamic Prompt generator further includes:
[0013] A domain-specific token library (TrafficBERT) is used to enhance traffic semantic understanding;
[0014] The failure safety policy module is configured as follows: enable local caching when the large model service latency exceeds 200ms; switch to lightweight decision tree when the service interruption exceeds 5 seconds; and fall back to the original random policy in extreme cases.
[0015] Preferably, the execution layer integrates a federated learning framework and protects user attribute data through differential privacy technology, where the Laplace noise in differential privacy technology is ∈=0.3. The execution layer also uses edge computing nodes to deploy a compressed TrafficBERT model with a parameter scale of ≤370 million.
[0016] Preferably, the cross-language communication bridging device includes: an adaptive compression algorithm that uses a combination of Zstandard and DeltaEncoding compression; and a heartbeat monitoring mechanism with a timeout threshold set to 150ms, supporting automatic reconnection after disconnection.
[0017] A traffic multi-agent simulation decision-making method based on a large language model, the decision-making method comprising the following steps:
[0018] Step S1: Obtain real-time road network status data through the perception layer, encode it into a spatiotemporal tensor feature matrix, and fuse user socioeconomic attributes to generate a 128-dimensional semantic vector;
[0019] Step S2: Construct structured prompt words based on the dynamic Prompt generator, and call the large language model interface to generate a set of candidate solutions containing travel mode, departure time and route;
[0020] Step S3: Perform multi-objective optimization and verification of candidate solutions using the solution evaluation matrix;
[0021] Step S4: Inject the optimized solution into the simulation platform through the execution layer, and realize cross-language data synchronization based on the gRPC protocol.
[0022] Preferably, the embedded representation of the user's socioeconomic attributes in step S1 is generated using the following example formula:
[0023] e u =MLP([OneHot(v car );MinMax(income);BERT(occupation)])
[0024] Among them, v car The text refers to the number of cars owned by the family, income to income level, and occupation to occupation.
[0025] The technical effects achieved by this invention are as follows:
[0026] This invention proposes a traffic multi-agent simulation decision-making method and system based on a large language model. For the first time, it introduces the cognitive reasoning capabilities of a large language model into the traffic simulation decision-making closed loop, realizing a paradigm shift in decision-making logic from "random trial and error" to "causal inference." This method endows the multi-agents in the simulation with decision-making intelligence, replacing the random update strategy and scoring module in the original simulation model. Utilizing real-time road network status data and attribute values of various travel modes obtained from the simulation, combined with a deep learning model of the large language model, it determines the travel mode, departure time, and travel route of each agent in a specific travel scenario. This method, while ensuring the rationality of the decision, can significantly reduce the number of simulation iterations, improve convergence efficiency, and save time and economic costs.
[0027] The advantages of the traffic multi-agent simulation decision-making method and system based on the large language model of the present invention are: (1) Based on the reasoning ability of the large language model with millions of parameters, the intelligent decision-making ability of the simulation agent is improved, and the decision-making behavior that conforms to reality is generated; (2) It can integrate multimodal data and make decisions, and can adapt to complex scenarios with a large number of variables; (3) It improves the convergence speed of traffic multi-agent simulation, saving time and computing power resources; (4) It further shortens the response time of multi-agent simulation under sudden events. Attached Figure Description
[0028] Figure 1 This is a schematic diagram of the overall architecture and core functions of the traffic multi-agent simulation decision-making system based on a large language model according to the present invention;
[0029] Figure 2 This is a data flow diagram of the traffic multi-agent simulation decision system based on a large language model, as described in this invention. Detailed Implementation
[0030] To make the objectives and advantages of this invention clearer, the invention will be specifically described below with reference to embodiments. It should be understood that the following text is merely used to describe one or more specific embodiments of the invention and does not strictly limit the scope of protection specifically claimed by the invention.
[0031] like Figure 1 as well as Figure 2 As shown, the traffic multi-agent simulation decision-making system based on a large language model includes:
[0032] Perception layer: A spatiotemporal tensor encoder for multimodal data fusion, which encodes road network status data into a three-dimensional feature matrix containing channel, time, and spatial dimensions; the channel dimension includes traffic flow, speed, and density; the time dimension adopts a sliding time window evolution mode; the spatial dimension adopts a road network graph convolutional topology; the perception layer achieves joint representation of numerical road network data and text-based event reports through a hybrid embedding model;
[0033] In this invention, the perception layer, which serves as the central hub of data intelligence, is based on a multi-source heterogeneous data fusion engine. It encodes the average vehicle speed, traffic flow, and other data from the previous simulation output into a feature matrix. Based on the road network status, it calculates the travel time and cost of intelligent agents using cars, regular buses, subways, non-motorized vehicles, walking, and other modes of transportation in specific travel scenarios. It integrates the socioeconomic attribute information of each intelligent agent and the origin and destination location information. The socioeconomic attribute information includes the number of cars owned by the family, income, gender, age, etc.
[0034] Decision Layer: Dynamic Prompt Generator, which generates a set of candidate solutions based on a four-layer progressive prompt structure. The four layers include: Context Awareness Layer for extracting weather and emergencies; Constraint Recognition Layer for parsing user attributes; Solution Generation Layer for driving the output strategy of the large language model; Optimization and Validation Layer for fine-tuning based on simulation feedback; and Decision Layer, which works with the decision core module to perform Monte Carlo Tree Search (MCTS) multi-objective optimization.
[0035] In this invention, the decision-making layer, which serves as the core of cognitive reasoning, consists of two parts: a dynamic Prompt generator and a decision-making core. The former generates a set of candidate solutions based on a large language model, such as Deepseek's Prompt project. For example, it asks, "As a transportation decision-making expert, based on the current 'origin,' 'destination,' and 'type,' the user has the following travel options: Option 1 'Travel Mode 1': 'Travel Duration,' 'Travel Cost'; Option 2 'Travel Mode 2': 'Travel Duration,' 'Travel Cost.' Please recommend a travel mode; and output whether the departure time needs to be adjusted, and if so, provide a suggested departure time offset within ±30 minutes; output whether there is a recommended travel route set, and if so, provide the recommended travel route number. Requirements: Consider the user's attributes, balance time and economic costs, and recommend the optimal comprehensive solution for the user. Based on this prompt template, it calls the large language model interface, especially models with reasoning capabilities, such as Deepseek-r1, to deeply consider and decide the best travel solution for the specific user. Finally, it establishes a solution failure safety strategy, including a three-level degradation mechanism: Level 1: Enable local caching when the large model service latency > 200ms; Level 2: Switch to a lightweight decision tree when the service is unavailable for more than 5 seconds; Level 3: ... 3: In extreme cases, revert to the original random strategy.
[0036] The dynamic Prompt project framework in this invention is as follows:
[0037] class DynamicPromptGenerator:
[0038] def build_prompt(self,user_context,network_state):
[0039] #Context-aware components
[0040] situation=self._extract_critical_factors(network_state['events'])
[0041] #Constraint Modeling Components
[0042] constraints=self._parse_user_constraints(user_context['attributes'])
[0043] #Solution Generation Template
[0044] return f""""
[0045] [Character Setting] You are a transportation planning expert with 20 years of experience.
[0046] [Current Context] {situation['weather']} Weather, {situation['traffic_status']} Traffic conditions
[0047] [User Profile] Vehicle owners, time sensitivity.
[0048]
Task Requirements
[0049] 1. Recommend three feasible solutions (method + time + route)
[0050] 2. Assess the carbon emissions of each scenario (based on the VSP model)
[0051] 3. Issue a risk warning (triggered when the probability of an accident is >30%).
[0052] [Output Format] JSON structured data""""
[0053] Execution layer: A cross-language communication bridge that uses the gRPC bidirectional streaming communication protocol and the Protobuf data serialization scheme to achieve millisecond-level data interaction between the Java simulation platform and the Python model service, and supports a hot-plug mechanism for the policy injection interface.
[0054] In this invention, since most open-source traffic multi-agent simulations are written in Java, while calling large language model APIs requires Python, a cross-language communication mechanism needs to be developed. This is achieved using the gRPC bidirectional streaming communication protocol, a Protocol Buffer (Protobuf) data serialization scheme, an adaptive compression algorithm (Zstandard+Delta Encoding), a heartbeat monitoring and reconnection mechanism, and a timeout threshold of 150ms, enabling millisecond-level data exchange between Java and Python. Secondly, this strategy needs to be integrated into the open-source traffic multi-agent simulation model; therefore, a strategy injection interface is built to support a hot-swappable mechanism for multi-agent simulation extension points.
[0055] Preferably, the channel dimension of the spatiotemporal tensor encoder is constructed using the following formula:
[0056]
[0057] Among them, G conv The road network map uses convolutional features, where Vt, Ft, and Dt are spatiotemporal sliding window features of velocity, flow rate, and density, respectively.
[0058] Preferably, the dynamic Prompt generator further includes:
[0059] A domain-specific token library (TrafficBERT) is used to enhance traffic semantic understanding;
[0060] The failure safety policy module is configured as follows: enable local caching when the large model service latency exceeds 200ms; switch to lightweight decision tree when the service interruption exceeds 5 seconds; and fall back to the original random policy in extreme cases.
[0061] Preferably, the execution layer integrates a federated learning framework, protects user attribute data through differential privacy technology, and the Laplace noise in differential privacy technology is ∈=0.3. The execution layer also uses edge computing nodes to deploy a compressed TrafficBERT model with a parameter size of ≤370 million.
[0062] Preferably, the cross-language communication bridging device includes: an adaptive compression algorithm that uses a combination of Zstandard and DeltaEncoding compression; and a heartbeat monitoring mechanism with a timeout threshold set to 150ms, supporting automatic reconnection after disconnection.
[0063] A traffic multi-agent simulation decision-making method based on a large language model includes the following steps:
[0064] Step S1: Obtain real-time road network status data through the perception layer, encode it into a spatiotemporal tensor feature matrix, and fuse user socioeconomic attributes to generate a 128-dimensional semantic vector;
[0065] Step S2: Construct structured prompt words based on the dynamic Prompt generator, and call the large language model interface to generate a set of candidate solutions containing travel mode, departure time and route;
[0066] Step S3: Perform multi-objective optimization and verification of candidate solutions using the solution evaluation matrix;
[0067] Step S4: Inject the optimized solution into the simulation platform through the execution layer, and realize cross-language data synchronization based on the gRPC protocol.
[0068] Preferably, the embedded representation of the user's socioeconomic attributes in step S1 is generated using the following example formula:
[0069] e u =MLP([OneHot(v car );MinMax(income);BERT(occupation)])
[0070] Among them, v car The text refers to the number of cars owned by the family, income to income level, and occupation to occupation.
[0071] This invention discloses a multi-agent decision-making intelligent framework for traffic: it proposes to use the reasoning and multimodal data processing capabilities of a large language model to replace the slow-converging stochastic strategy and the manual scoring function that is difficult to adapt to complex scenarios in the original method, thereby improving the decision-making accuracy and efficiency of multi-agents in simulation.
[0072] This invention discloses a cross-modal state representation method: a spatiotemporal tensor coding scheme (ST-Tensor) is proposed to decompose the road network state into: channel dimension: traffic flow / speed / density three-channel features; time dimension: state evolution pattern within a sliding time window; and spatial dimension: graph convolutional coding of the road network topology. A hybrid embedding model is developed to achieve joint representation of numerical sensor data and text-based event reports.
[0073] This invention discloses a dynamic Prompt engineering framework: a four-layer progressive prompting structure is constructed, (1) a context-aware layer: extracting key decision factors in real time (such as travel purpose / travel location / departure time / passenger situation); (2) a constraint identification layer: parsing individual travel characteristics (travel cost / time sensitivity); (3) a solution generation layer: driving the large model to output a set of candidate strategies; and (4) an optimization and verification layer: combining simulation feedback to optimize the strategy. At the same time, a domain-specific token library (TrafficBERT) is designed to improve the accuracy of traffic semantic understanding.
[0074] This invention discloses a privacy protection scheme: applying differential privacy technology at the data acquisition layer, adding Laplace noise ∈=0.3, and using a federated learning framework for model updates to ensure that user attribute data does not leave the local machine.
[0075] The data flow diagram of the method of this invention is as follows: Figure 2 As shown. After the initial multi-agent traffic simulation model is completed, the simulation outputs the flow, density, and speed indicators of each road segment in the road network under different time and spatial dimensions, encoding the road network state into an N*N spatiotemporal feature matrix. Based on this road network state, the travel time and cost of all agents in the simulation using modes such as cars, regular buses, subways, bicycles, and walking are calculated. The above information, including the road network state, feature vectors of various modes, traveler socioeconomic attributes, and travel scenarios, is input into the prompt word template, as shown in the dynamic Prompt project framework program code, to generate text and image information that is conducive to reading by the large language model. The large language model API is called, especially the large language model with reasoning ability and deep thinking, to make a comprehensive decision on the traveler's travel mode, departure time, and travel route. Based on the output results, key elements are extracted, and after scheme evaluation, the plan is updated and written into the traveler's next simulated travel plan. The simulation continues to run, and the above process is repeated until the simulation model converges.
[0076] The advantages of the traffic multi-agent simulation decision-making method and system based on the large language model of the present invention are: (1) Based on the reasoning ability of the large language model with millions of parameters, the intelligent decision-making ability of the simulation agent is improved, and the decision-making behavior that conforms to reality is generated; (2) It can integrate multimodal data and make decisions, and can adapt to complex scenarios with a large number of variables; (3) It improves the convergence speed of traffic multi-agent simulation, saving time and computing power resources; (4) It further shortens the response time of multi-agent simulation under sudden events.
[0077] The above description is merely a preferred embodiment of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention. Structures, devices, and operating methods not specifically described or explained in this invention are implemented according to conventional methods in the art unless otherwise specified or limited.
Claims
1. A traffic multi-agent simulation decision-making system based on a large language model, characterized in that: include: Perception layer: a spatiotemporal tensor encoder for multimodal data fusion, which encodes road network status data into a three-dimensional feature matrix containing channel, time, and spatial dimensions, and achieves joint representation of numerical sensor data and text-based event reports through a hybrid embedding model; Decision Layer: Dynamic Prompt Generator, which generates a set of candidate solutions based on a four-layer progressive prompting structure. The four-layer progressive prompting structure includes: a context-aware layer for extracting weather and emergencies; a constraint recognition layer for parsing user attributes; a solution generation layer for driving the large language model to output strategies; an optimization and verification layer for fine-tuning based on simulation feedback; and a Monte Carlo Tree Search (MCTS) multi-objective optimization that works in conjunction with the decision core module. Execution layer: A cross-language communication bridge that uses the gRPC bidirectional streaming communication protocol and the Protobuf data serialization scheme to achieve millisecond-level data interaction between the Java simulation platform and the Python model service, and supports a hot-plug mechanism for the policy injection interface.
2. The traffic multi-agent simulation decision-making system based on a large language model according to claim 1, characterized in that: The channel dimension of the spatiotemporal tensor encoder is constructed using the following formula: ; Among them, G conv V is a convolutional feature of the road network map. t F t D t These are spatiotemporal sliding window features for velocity, flow rate, and density, respectively.
3. The traffic multi-agent simulation decision-making system based on a large language model according to claim 1, characterized in that: The dynamic Prompt generator also includes: A domain-specific token library for enhancing traffic semantic understanding; The failure safety policy module is configured as follows: enable local caching when the large model service latency exceeds 200ms; switch to lightweight decision tree when the service interruption exceeds 5 seconds; and fall back to the original random policy in extreme cases.
4. The traffic multi-agent simulation decision-making system based on a large language model according to claim 1, characterized in that: The execution layer integrates a federated learning framework, protects user attribute data through differential privacy technology, and deploys a compressed TrafficBERT model with a parameter scale of ≤370 million using edge computing nodes.
5. The traffic multi-agent simulation decision-making system based on a large language model according to claim 4, characterized in that: The cross-language communication bridging device includes: an adaptive compression algorithm that uses a combination of Zstandard and Delta Encoding compression; a heartbeat monitoring mechanism with a timeout threshold set to 150ms, supporting automatic reconnection after disconnection.
6. A traffic multi-agent simulation decision-making method based on a large language model, wherein the decision-making method is the operation method of the decision system described in any one of claims 1-5, characterized in that: The decision-making method includes the following steps: Step S1: Obtain real-time road network status data through the perception layer, encode it into a spatiotemporal tensor feature matrix, and fuse user socioeconomic attributes to generate a 128-dimensional semantic vector; Step S2: Construct structured prompt words based on the dynamic Prompt generator, and call the large language model interface to generate a set of candidate solutions containing travel mode, departure time and route; Step S3: Perform multi-objective optimization and verification of candidate solutions using the solution evaluation matrix; Step S4: Inject the optimized solution into the simulation platform through the execution layer, and realize cross-language data synchronization based on the gRPC protocol.
7. The traffic multi-agent simulation decision-making method based on a large language model according to claim 6, characterized in that: The embedded representation of the user's socioeconomic attributes in step S1 is generated by the following formula: ; in, v "car" refers to the number of cars owned by households. income For income level, occupation This is a textual description of a profession.
Citation Information
Patent Citations
Smart city traffic planning method and system based on big data
CN118917025A
Large-scale urban network multi-agent traffic simulation prediction method, system and equipment
CN119416627A