A policy simulation sandbox method and system based on a large language model
By analyzing unstructured policy texts using a large language model and embedding planned behavior theory, combined with the Reflexion mechanism, this approach addresses the issues of lack of theoretical support and long-term inconsistency in the cognitive logic of simulating residential photovoltaic adoption behavior in existing technologies, thus achieving high-precision and transparent policy simulation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TSINGHUA SHENZHEN INTERNATIONAL GRADUATE SCHOOL
- Filing Date
- 2026-03-04
- Publication Date
- 2026-06-05
AI Technical Summary
Existing technologies lack support from social psychology theories when simulating residents' adoption of distributed rooftop photovoltaics. They struggle to handle unstructured policy texts, exhibit inconsistent long-term evolution, and are black-boxed in the simulation process, resulting in insufficient accuracy and logical interpretability in policy simulation.
A policy simulation sandbox method and system based on a large language model are constructed. The method parses unstructured policy texts through the input layer, embeds the cue word framework of the Theory of Planned Behavior, introduces the Reflexion mechanism, forms a hierarchical architecture, realizes chain reasoning and intertemporal cognitive consistency of the agent, and outputs structured decision tuples.
It improves the accuracy and logical robustness of policy simulation, can analyze complex policy contexts, provides transparent decision-making paths and explainable micro-logical support, and supports precise policy formulation.
Smart Images

Figure CN122154740A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer simulation and energy policy evaluation technology, and in particular to a policy simulation sandbox method based on a large language model. Background Technology
[0002] With the global energy transition, distributed rooftop photovoltaic (PV) has become a key path for building low-carbon energy systems and achieving sustainable urban development. However, despite its enormous potential, the development rate of rooftop PV in most Chinese cities is currently less than 1%. Against the backdrop of the "subsidy phase-out" policy and market-oriented transformation, how to bridge this huge development gap and transform theoretical potential into actual installed capacity has become a crucial issue that urgently needs to be addressed.
[0003] (1) Traditional residential energy behavior modeling methods and their limitations
[0004] In the field of distributed energy diffusion research, agent-based modeling (ABM) has become a mainstream analytical tool due to its ability to reveal macro-level social phenomena through the interactions of micro-level individuals. Early ABM models were largely based on the assumption of "perfect rationality," simplifying complex photovoltaic adoption decisions into hard-coded economic threshold judgments, such as triggering installation only when the payback period is less than a predetermined number of years. To improve the model's ability to characterize nonlinear decision-making processes, subsequent research introduced methods such as artificial neural networks (ANNs) and fuzzy-utility, attempting to integrate multi-dimensional driving factors such as economics, infrastructure, and society. However, these methods often face problems such as complex model structures, difficulties in parameter calibration, or poor "black box" interpretability, limiting their generalization ability in practical policy scenarios.
[0005] Current cutting-edge research, such as the work of Zhao Xiaoli et al. (2025), has significantly improved the simulation fit of urban-scale photovoltaic adoption behavior by deeply integrating the Theory of Planned Behavior (TPB) with multi-source empirical data such as Lianjia housing prices and building floor plans. However, the core logic of these refined models—including attitude update formulas and the utility weights of various factors—remains entirely exogenously presupposed by the researchers. This means that the model is essentially a static rule base, lacking the ability to autonomously understand and reason about newly emerging, unpredicted policy situations. Once external intervention schemes exceed the boundaries of its pre-set logic, the model struggles to generate reasonable and dynamic behavioral responses.
[0006] (2) Behavioral simulation driven by LLM: from static generation to dynamic evolution
[0007] The rise of Large Language Models (LLMs) has provided a new path to overcome the aforementioned bottlenecks. LLMs possess powerful semantic understanding and human-like reasoning capabilities, enabling intelligent agents to generate detailed and coherent decisions in complex situations without relying on detailed hard-coded rules.
[0008] Regarding decision-making logic and memory mechanisms, Chetty et al. (2025) proposed using LLM to simulate daily household electricity consumption behavior and update long-term electricity consumption characteristics through self-reflection. This work inspired the use of language-based reinforcement learning to achieve behavioral consistency of household agents over time. Li et al. (2024) developed EconAgent, demonstrating the superiority of LLM agents in perceiving macroeconomic fluctuations (such as inflation and unemployment) and adaptively adjusting consumption decisions. This provides direct evidence for constructing a profile of a "social being" capable of understanding complex policy tones.
[0009] Recent research has begun to explore the application of LLM in behavioral simulation, such as using LLM to simulate daily household electricity consumption habits or to build economic agents that can sense macroeconomic fluctuations and adaptively adjust consumption decisions. In addition, some studies (such as AgentSociety and YuLan-OneSim) have successfully built simulation frameworks that support large-scale interactions of tens of thousands of agents in real urban environments, verifying the feasibility of simulating the diffusion of complex social technologies at the urban scale.
[0010] Although distributed energy diffusion and residential decision-making simulation technology has moved from rule-driven to data-driven stages, existing technologies still exhibit significant limitations when facing the scenario of residential photovoltaic adoption, which is deeply coupled with policy fluctuations and socio-psychological factors.
[0011] First, existing cognitive models generally lack mature social psychology theoretical support, resulting in overly simplistic decision-making dimensions. Current agent behavior logic is largely based on the assumption of economically rational individuals, simplifying complex adoption decisions into threshold judgments of financial indicators such as payback period or internal rate of return. Due to the lack of connection with classic social psychology frameworks such as the Theory of Planned Behavior, existing models often encapsulate decision-making logic as exogenously pre-defined mathematical formulas, making it difficult to characterize the dynamic interactions of residents in dimensions such as behavioral attitudes, subjective norms, and perceived behavioral control. This lack of theoretical support weakens the explanatory power of the models, making it impossible for the system to explain why specific groups refuse to install the system even when economically feasible, thus leading to a lack of solid micro-level logical support for macro-level forecasting.
[0012] Secondly, existing simulation systems suffer from severe reliance on structured data, resulting in a black-box architecture and insufficient semantic parsing capabilities. Most systems can only process numerical inputs such as electricity prices and subsidies, making it difficult to directly parse unstructured information widely available in reality, such as policy documents, news reports, or public opinion. This limitation means that policy sandboxes can often only make simple parameter adjustments when dealing with intervention strategies, failing to achieve in-depth simulation at the strategy level. Furthermore, traditional architectures lack the ability to identify semantic framing effects and cannot simulate the heterogeneous impact of different policy tones on the diffusion process, thus limiting their application in complex social governance scenarios.
[0013] Furthermore, existing simulation methods generally lack explicit logical chains in the decision-making process, making it difficult to trace the reasoning process back to its source. When faced with a policy environment, agents often directly establish a mapping between environmental inputs and the final decision, lacking a step-by-step reasoning mechanism similar to a thought chain. This break in the logical chain prevents the model from recreating the complete closed loop from policy understanding and decision-making to the formation of will. Due to the lack of explicit reasoning paths, researchers find it difficult to locate simulation biases by tracing back psychological trajectories, and this logical opacity also reduces the persuasiveness of policy advice.
[0014] Finally, existing technologies often face the problems of rigid memory mechanisms and lack of reflective functions when dealing with long-term dynamic evolution. Residential photovoltaic adoption exhibits typical cross-cycle characteristics, but existing long-term simulations mostly employ instantaneous activation models, lacking a closed-loop feedback mechanism similar to reflexivity. Because they cannot deeply reflect on past experiences of hesitation or decision-making failures and transform them into cognitive adjustments, the models struggle to recreate the gradual psychological evolution of residents from resistance and observation to eventual acceptance. This inconsistency in cognitive evolution leads to random fluctuations in agent behavior across different years, weakening the accuracy of simulations of long-term social learning effects.
[0015] It should be noted that the information disclosed in the background section above is only for understanding the background of this application, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0016] The main objective of this invention is to overcome the deficiencies in the aforementioned background technology and provide a policy simulation sandbox method and system based on a large language model.
[0017] To achieve the above objectives, the present invention adopts the following technical solution: A policy simulation sandbox method based on a large language model is used to simulate residents' response behavior to energy policies at the urban scale, including the following steps: S1. Construct a heterogeneous group of family intelligent agents. Based on official statistics of the target city, initialize a digital personality profile for each intelligent agent, including socio-economic attributes, housing characteristics and psychological cognitive dimensions, and parse unstructured policy texts into environmental variables that are dynamically updated over time. S2. Based on a preset decision interval mechanism or changes in the external environment, the agent is triggered to make explicit reasoning, so that the agent only enters the decision state when the activation conditions are met. S3. For the triggered agent, the psychological constructs of the Theory of Planned Behavior are embedded into the cue word structure to guide the large language model to perform chain reasoning to generate a structured decision tuple containing the decision result and its logical reasons. If the decision result is rejection, the text of the rejection reason is stored in the memory module, and the agent is made to retrieve and reflect on the historical reasons in subsequent decision cycles to maintain intertemporal cognitive consistency. S4. Summarize the decision results of all agents, aggregate them monthly to generate macro diffusion curves, and respond to the What-if intervention instructions of end users. By adjusting the policy semantic framework, rerun the simulation and output the sandbox simulation results under different intervention scenarios.
[0018] A policy simulation sandbox system based on a large language model, used to implement the method, includes: The input layer module, as a data access point, is used to parse unstructured policy texts in the external environment and parameterize the socioeconomic attributes and housing characteristics of the family intelligent agent based on urban statistical data. The input layer module encapsulates the generated digital personality profile and external environmental variables into structured objects through the prompt word template protocol and passes them to the inference layer module. The inference layer module, as the core inference engine, is connected to the input layer module. It embeds a prompt word framework based on the theory of planned behavior to drive the large language model to perform chained inference. The inference layer module generates a decision tuple containing the agent ID, binary decision result and decision reasoning text based on the received structured object, and pushes it to the statistical monitoring layer module in real time through asynchronous data stream according to the decision reporting protocol. The statistical monitoring layer module, connected to the inference layer module, includes a closed-loop memory and reflection mechanism, used to receive and store the decision trajectory generated by the inference layer module in real time through a benchmark synchronization protocol; the statistical monitoring layer module uses a semantically driven fine-tuning function to execute intertemporal cognitive update logic, and stores the cumulative number of installations and structured reasons at each time point in the database as a dynamic benchmark for policy inference; The policy inference layer module, connected to the statistical monitoring layer module, is used to respond to the What-if intervention commands of the end user. The policy inference layer module reads the baseline data from the statistical monitoring layer module according to the scenario inference protocol, extracts the micro decision-making logic of the agent into a structured reasoning chain, and aggregates it to generate macro time series diffusion curves, installation quantity evolution diagrams and policy evaluation indicators, and finally outputs the sandbox inference results to the end user.
[0019] The present invention has the following beneficial effects: This invention provides a policy simulation sandbox method and system based on a large language model. It utilizes a large language model to construct an intelligent agent system, simulating urban residents' adoption behavior of energy policies such as distributed rooftop photovoltaics with high fidelity, thus providing scientific decision-making support for policy formulation. Addressing the limitations of existing residential photovoltaic adoption simulation technologies, such as the lack of theoretical support for cognitive logic, inconsistent long-cycle evolution, and difficulties in simulating unstructured text policies, this invention achieves technological breakthroughs from multiple dimensions.
[0020] First, this invention constructs a hierarchical architecture consisting of an input layer, an inference layer, a statistical monitoring layer, and a policy deduction layer, aiming to solve the challenges of parsing and feature mapping unstructured semantic information in complex policy environments. This architecture, through an unstructured text semantic parsing algorithm in the input layer, can directly extract key intervention parameters from policy texts, community opinions, and news reports, and utilize cue word engineering to transform this semantic information into a logical context understandable by a large language model. This ability to transform "unstructured semantics" into "structured psychological vectors" overcomes the dependence of traditional simulation models on preset numerical inputs, significantly enhancing the system's modeling accuracy and scenario transfer capabilities in heterogeneous policy contexts. Building upon this, this invention further develops a simulation environment that supports direct reading of unstructured policy texts. Through a policy summarization agent, it directly parses real-world policy documents, transforming them into semantic feature vectors understandable to the agent rather than simply numerical parameters, enabling the "policy sandbox" to handle complex semantic interventions and simulate real policy scenarios.
[0021] Secondly, this invention addresses the problems of insufficient social psychology theory guidance and inadequate interpretability of decision-making logic in intelligent agent cognitive models. To overcome the shortcomings of traditional models that rely solely on economic benefit thresholds to trigger decisions, this invention constructs a cue word structure guided by the Theory of Planned Behavior (TBE). By explicitly embedding TBE into the cue word framework, the intelligent agent is no longer based on simple rule calculations but can perform semantic decision-making reasoning through dimensions such as attitude, norms, and perceptual control, much like a real person. By explicitly modeling the agent's behavioral attitudes, subjective norms, and perceptual behavioral control, this invention can recreate the psychological trade-offs of residents during photovoltaic adoption, providing a psychologically grounded micro-decision-making path, thereby improving the logical robustness and interpretability of simulation results.
[0022] Furthermore, this invention addresses the issues of inconsistent cognition and lack of historical reflection ability in long-term simulations. To address the common cognitive discontinuity in cross-year simulations, this invention introduces a closed-loop memory module based on the Reflexion mechanism. By maintaining the agent's historical decision-making memory, it drives the agent to self-reflect and critically evaluate past "reasons of rejection," thus reconstructing the dynamic psychological evolution of residents from observation and hesitation to adoption. This module, through recording and reflecting on historical decision-making experiences, ensures that the agent maintains cognitive consistency over multiple years, accurately depicting the complete evolutionary trajectory of residents from observation and change to adoption, effectively capturing social learning effects and decision-making inertia.
[0023] Meanwhile, addressing the issues of policy intervention assessment's inability to parse semantic strategies and its overly coarse granularity, this invention provides a sandbox system with multi-granularity assessment capabilities and introduces a context-driven dynamic decision interval mechanism. Leveraging the semantic understanding advantages of large language models, the system can simulate the differentiated impact of promotion strategies with different semantic emphases on the diffusion process. By coupling underlying building features with high-level agent attributes, the system can output diffusion curves for different housing types and social classes, providing support for precise policy implementation. The dynamic decision interval mechanism, as a non-fixed-step agent activation method, dynamically adjusts the simulation rhythm based on the frequency of external environmental shocks and policy changes, improving simulation validity while optimizing computational performance. Furthermore, this invention also features policy counterfactual inference capabilities. By adjusting intervention variables within the simulation sandbox for policy pre-simulation, it supports the generation of policy diffusion curves under different intervention scenarios, providing quantitative and interpretable decision-making references for the pre-evaluation of policy effects.
[0024] Finally, this invention addresses the problems of black-box simulation processes and the disconnect between microscopic logic and macroscopic phenomena. By utilizing a structured output layer to extract and display the agent's reasoning chain in real time, this invention allows researchers to trace back decision-making motivations, ensuring that microscopic logic and macroscopic diffusion trends remain consistent along the causal chain. This provides transparent and traceable support for the formulation of distributed energy policies.
[0025] Compared with traditional agent modeling methods based on mathematical probability or fixed logical thresholds, this invention has significant technical advantages. On one hand, by utilizing the semantic parsing capabilities of large language models, this invention addresses the pain point of traditional models' inability to handle unstructured policy texts, enabling the simulation system to directly assess the impact of different policy statements on residents' psychology and significantly improving the counterfactual inference accuracy of the "policy sandbox." On the other hand, by introducing a reflexion mechanism and a psychological theoretical framework, this invention effectively overcomes the problems of "black box" decision-making logic and discontinuous long-cycle evolution in traditional agent modeling. Traditional models often only provide numerical results of "install or not install," while this invention can output a complete logical reasoning chain, clearly revealing why residents have changed their previous rejection attitudes under the current environment. This causal interpretability provides scientific evidence to support the government's formulation of differentiated and precise energy incentive policies, making the simulation results more valuable for decision-making.
[0026] Experimental results demonstrate that this invention exhibits excellent predictive performance in a real-world case of household photovoltaic adoption in a certain city. In long-term simulations, the installed capacity curve generated by the system closely matches the actual grid-connected data, with prediction accuracy significantly superior to traditional models. In counterfactual inference within a policy sandbox, the system successfully quantified the differentiated impacts of various semantic intervention strategies on different groups, revealing the synergistic effect between information dissemination methods and policy effectiveness, and fully verifying the predictive accuracy and practical value of this invention under complex policy fluctuations. The technical principles of this invention have broad application and transfer potential, extending to multiple social technology diffusion fields such as new energy vehicle promotion, public health intervention, and housing policy evaluation, providing an innovative technical path for constructing an interpretable, verifiable, and interventionist digital society laboratory.
[0027] Other beneficial effects of the embodiments of the present invention will be further described below. Attached Figure Description
[0028] Figure 1 This is a schematic diagram of the structure of an embodiment of the present invention.
[0029] Figure 2 This is a framework diagram of a policy simulation sandbox system based on a large language model, according to an embodiment of the present invention.
[0030] Figure 3 This is a comparison of simulated values with real values under the framework of this invention (a comparison chart of the number of household photovoltaic installations in a certain city). Detailed Implementation
[0031] The embodiments of the present invention will be described in detail below. It should be emphasized that the following description is merely exemplary and not intended to limit the scope and application of the present invention.
[0032] This invention aims to address the technical bottlenecks of existing policy simulation models, such as their inability to handle unstructured policy texts, lack of social psychology theoretical support, and inconsistent long-term evolution. It proposes a policy simulation sandbox method and system based on a large language model, constructing a hierarchical architecture integrating semantic parsing, theory-driven reasoning, and long-term reflective evolution. By embedding planned behavior theory into a cue word framework to drive the agent in chain-like reasoning, and introducing a reflexion mechanism to achieve intertemporal cognitive consistency, this invention achieves high-fidelity simulation and interpretable deduction of urban residents' policy response behavior, providing a quantifiable and interventionist decision support platform for precise policy formulation.
[0033] See Figure 1 This invention provides a policy simulation sandbox method based on a large language model to simulate residents' response behavior to energy policies at an urban scale, including the following steps: Step S1: Construct a heterogeneous group of family intelligent agents. Based on official statistics from the target city, initialize a digital personality profile for each agent, including socioeconomic attributes, housing characteristics, and psychological cognitive dimensions. Parse unstructured policy texts into environmental variables that are dynamically updated over time.
[0034] In some embodiments, step S1, the construction of the digital personality profile includes: assigning each family agent a family size parameter to represent electricity consumption base, income level, effective roof area to represent physical resource constraints, environmental awareness score to correspond to the behavioral attitude construct in the Theory of Planned Behavior, property constraint factors, and diversity of main information channels; wherein, the property constraint factor quantifies the impact of different property environments on decision-making through a piecewise function, and assigns different weight coefficients according to whether the property holds a supportive attitude, an opposing attitude, or an environment without property management; the environmental awareness score is quantified using a ten-point scale, with a higher value indicating a stronger positive attitude towards environmental protection.
[0035] In some embodiments, step S1, parsing the unstructured policy text into environmental variables, includes: performing semantic parsing on the original policy document using a policy summary agent. This policy summary agent is built based on a large language model and, guided by preset prompts, filters out procedural expressions irrelevant to decision-making, extracting core factors that have a substantial impact on household decisions. These core factors include subsidy standards, implementation periods, entry thresholds, and electricity pricing mechanisms. The prompts for the policy summary agent include a role set as a policy analysis expert, a task requirement to extract high-information-density summaries, and the categories of key points to be extracted, ensuring the objectivity and accuracy of the extraction. The parsed policy summary text is then input as an environmental variable into subsequent decision-making steps to avoid the attentional distraction problem caused by long texts on the decision-making model.
[0036] Step S2: Based on a preset decision interval mechanism or changes in the external environment, the agent is triggered to make explicit reasoning, so that the agent only enters the decision state when the activation conditions are met.
[0037] In some embodiments, in step S2, the decision interval mechanism is implemented by dynamically calculating the decision interval of each agent: based on a preset baseline decision frequency, a weighted synthesis is performed considering the agent's income level, risk aversion, property constraints, and information channel diversity; wherein, income level is assigned different weight coefficients according to high, medium, and low levels; risk aversion is represented by a continuous numerical value and multiplied by the corresponding weight coefficient; property constraints are assigned different adjustment weights according to support, opposition, or no property status; and information channel diversity is weighted according to the number of information sources the agent comes into contact with to reflect the compression effect of information completion on the decision cycle; high income, low risk aversion, property support, and multiple information channels are assigned weights to shorten the decision interval, and vice versa.
[0038] In some embodiments, in step S2, the explicit reasoning of the triggering agent includes: by monitoring the real-time rate of change of external environmental parameters, when a substantial change in environmental parameters is detected or the individual receives a significant external stimulus, the agent is immediately activated to enter a decision-making state; the substantial change includes policy text updates, subsidy intensity adjustments, and electricity price changes; the significant external stimulus includes policy publicity, neighbor installation examples, and major social events.
[0039] Step S3: For the triggered agent, embed the psychological constructs of the Theory of Planned Behavior into the cue word structure, guide the large language model to perform chain reasoning to generate a structured decision tuple containing the decision result and its logical reasons; if the decision result is rejection, store the rejection reason text in the memory module, and in subsequent decision cycles, enable the agent to retrieve and reflect on the historical reasons to maintain intertemporal cognitive consistency.
[0040] In some embodiments, step S3, embedding the psychological constructs of the Theory of Planned Behavior into the cue word structure, includes: explicitly modeling three psychological dimensions of the agent's behavioral attitude, subjective norms, and perceived behavioral control in the cue words, respectively representing the intensity of attitude through environmental awareness scores, the pressure of social norms through property attitudes and information sources, and the perceived level of behavioral control through rooftop physical conditions and policy support; the chain reasoning includes four sequentially linked stages: reviewing the basic family situation, analyzing the current policy environment, comparing historical decision-making reasons, and making a final decision. Each stage guides the large language model to perform step-by-step reasoning before synthesizing the decision conclusion to ensure the transparency and interpretability of the decision-making process.
[0041] In some embodiments, step S3, embedding the psychological constructs of the Theory of Planned Behavior into the prompt word structure, further includes: explicitly embedding a description of photovoltaic installation modes into the prompt words, wherein the installation modes include rooftop leasing mode and full-funding mode, corresponding to different benefit distribution mechanisms and decision-making trade-off dimensions; the prompt word structure further includes a role setting as a family decision-maker, current decision-making time node and seasonal factor prompts, external major event prompts, a review of the family's basic situation, a display of recent policy search results, and a review of historical decision-making reasons; wherein, the recent policy search results display the latest preset number of policy documents in reverse chronological order, including policy name, issuing agency, release date, and main content summary; the review of historical decision-making reasons displays the reasons for not installing in the most recent times, guiding the agent to reflect during the comparison stage of chain reasoning, and to judge whether the old reasons still hold true in the current new policy environment, thereby fully integrating the multi-dimensional trade-off of economic benefits, environmental awareness, social norms, and risk perception in the decision-making process.
[0042] In some embodiments, step S3, the storage to memory module includes: structurally recording the rejection reason text generated for each decision in natural language in the decision history database; in subsequent decision cycles, the system automatically retrieves the agent's most recent historical rejection reasons and injects them into the context of the current decision prompt, guiding the agent to perform comparative reflection, requiring it to critically evaluate the effectiveness of historical reasons in the current new policy environment, and determine whether the old reasons still hold true; through this cross-period comparative reflection mechanism, a gradual cognitive evolution from observation to acceptance is achieved, enabling the agent to maintain personality consistency over a long period.
[0043] Step S4: Summarize the decision results of all agents, aggregate them monthly to generate a macro diffusion curve, and respond to the What-if intervention instructions of the end users. Rerun the simulation by adjusting the policy semantic framework and output the sandbox simulation results under different intervention scenarios.
[0044] In some embodiments, in step S4, the macro diffusion curve includes: a time series curve of new installations counted monthly, a cumulative installation rate evolution graph, and a distribution of group characteristics by income level, housing type, and region; the What-if intervention instructions include modifying the policy subsidy level, adjusting the policy effective time node, and changing the policy semantic framework type; by comparing the differences in diffusion curves under different intervention scenarios, the precise incentive effect of the policy combination on different housing types or income groups is quantitatively evaluated; the system supports dynamic comparison of the simulated monthly installation curve with the actual grid connection data, calculating the error and visualizing the fitting effect, forming a closed loop of simulation-verification-iterative optimization.
[0045] See Figure 2This invention also provides a policy simulation sandbox system based on a large language model to implement the method described in the foregoing embodiments. The system includes four functionally coordinated modules, which achieve closed-loop simulation through a preset data flow interaction protocol. The input layer module, as a data access point, is used to parse unstructured policy texts in the external environment and parameterize the socioeconomic attributes and housing characteristics of the family intelligent agent based on urban statistical data. The input layer module encapsulates the generated digital personality profile and external environmental variables into structured objects through the prompt word template protocol and passes them to the inference layer module. The inference layer module, as the core inference engine, is connected to the input layer module. It embeds a prompt word framework based on the theory of planned behavior to drive the large language model to perform chained inference. The inference layer module generates a decision tuple containing the agent ID, binary decision result and decision reasoning text based on the received structured object, and pushes it to the statistical monitoring layer module in real time through asynchronous data stream according to the decision reporting protocol. The statistical monitoring layer module, connected to the inference layer module, includes a closed-loop memory and reflection mechanism, used to receive and store the decision trajectory generated by the inference layer module in real time through a benchmark synchronization protocol; the statistical monitoring layer module uses a semantically driven fine-tuning function to execute intertemporal cognitive update logic, and stores the cumulative number of installations and structured reasons at each time point in the database as a dynamic benchmark for policy inference; The policy inference layer module, connected to the statistical monitoring layer module, is used to respond to the What-if intervention commands of the end user. The policy inference layer module reads the baseline data from the statistical monitoring layer module according to the scenario inference protocol, extracts the micro decision-making logic of the agent into a structured reasoning chain, and aggregates it to generate macro time series diffusion curves, installation quantity evolution diagrams and policy evaluation indicators, and finally outputs the sandbox inference results to the end user.
[0046] In summary, in response to the limitations of existing residential photovoltaic adoption simulation technologies, such as the lack of theoretical support for cognitive logic, inconsistent long-cycle evolution, and difficulty in simulating policies under unstructured text, the policy simulation sandbox method and system based on a large language model proposed in this invention breaks through the existing technical bottlenecks from multiple dimensions.
[0047] First, this invention constructs a hierarchical architecture consisting of an input layer, an inference layer, a statistical monitoring layer, and a policy deduction layer, aiming to solve the challenges of parsing and feature mapping unstructured semantic information in complex policy environments. This architecture, through an unstructured text semantic parsing algorithm in the input layer, can directly extract key intervention parameters (such as subsidy intensity, implementation period, and eligibility criteria) from policy texts, community opinions, and news reports. It then utilizes cue word engineering to transform this semantic information into a logical context understandable by a Large Language Model (LLM). This ability to transform 'unstructured semantics' into 'structured psychological vectors' overcomes the dependence of traditional simulation models on preset numerical inputs, significantly enhancing the system's modeling accuracy and scenario transfer capabilities in heterogeneous policy contexts.
[0048] Secondly, this invention addresses the problem of insufficient social psychology theory guidance and inadequate explanatory power in decision-making logic of intelligent agent cognitive models. To overcome the shortcomings of traditional models that rely solely on economic benefit thresholds to trigger decisions, this invention constructs a cue word structure guided by the Theory of Planned Behavior. By explicitly modeling the agent's behavioral attitudes, subjective norms, and perceptual behavioral control, this invention can recreate the psychological trade-offs of residents during photovoltaic adoption, providing a psychologically grounded micro-decision-making path, thereby improving the logical robustness and interpretability of simulation results.
[0049] Furthermore, this invention addresses the issues of inconsistent cognition and lack of historical reflection ability in long-term simulations. To address the common cognitive gaps in cross-year simulations, this invention introduces a closed-loop memory module based on a reflection mechanism. This module ensures that the agent maintains cognitive consistency over multiple years by recording and reflecting on historical decision-making experiences, accurately depicting the complete evolutionary trajectory of residents from observation and change to adoption, and effectively capturing social learning effects and decision-making inertia.
[0050] Meanwhile, addressing the issues of policy intervention assessments failing to parse semantic strategies and exhibiting excessively coarse granularity, this invention provides a sandbox system with multi-granularity assessment capabilities. Leveraging the semantic understanding advantages of large language models, the system can simulate the differentiated impacts of promotion strategies with varying semantic emphases on the diffusion process. By coupling underlying building features with high-level agent attributes, the system can output diffusion curves for different housing types and social classes, providing support for precise policy implementation.
[0051] Finally, this invention addresses the problems of black-box simulation processes and the disconnect between microscopic logic and macroscopic phenomena. It utilizes a structured output layer to extract and display the agent's reasoning chain in real time. This mechanism allows researchers to trace back decision-making motivations, ensuring that microscopic logic and macroscopic diffusion trends remain consistent along the causal chain, thus providing transparent and traceable support for the formulation of distributed energy policies.
[0052] The following further describes specific embodiments and experimental verifications of the present invention.
[0053] A policy simulation sandbox system and method based on a large language model addresses the technical challenges of existing policy simulation models in handling unstructured text, simulating complex human psychological cognition, maintaining long-term decision-making consistency, and handling logical black-box issues. The key technical solution lies in: constructing a hierarchical architecture consisting of an input layer, an inference layer, a statistical monitoring layer, and an output layer to achieve semantic parsing of unstructured policy text and parametric modeling of agent attributes; the core is the integration of the Theory of Planned Behavior (TPB) into the cue word framework of the large language model to drive the agent to perform human-like chain reasoning (CoT), and the introduction of a self-reflection algorithm based on the Reflexion mechanism to achieve cross-cycle cognitive consistency, while employing a Dynamic Decision Interval (DDI) mechanism to accurately calibrate the agent's activation state. This enables high-fidelity simulation of residents' responses to policies such as photovoltaic adoption at the urban scale, serving as a "policy sandbox" to support government counterfactual reasoning and providing decision support for formulating accurate and interpretable energy incentives and social policies.
[0054] The policy simulation sandbox system based on the large language model includes four functionally coordinated virtual network modules. The modules achieve closed-loop simulation through a preset data flow interaction protocol. (1) First is the input layer module, which acts as the data access end and is responsible for parsing unstructured policy texts in the external environment and parameterizing the socioeconomic attributes and housing characteristics of the family agent based on urban statistical data. This module encapsulates the generated "family digital personality portrait" and "external environmental variables" into structured objects through the prompt word template protocol and passes them to the inference layer. (2) Second is the inference layer module, which is the core inference engine of the system. It embeds a prompt word framework based on social psychology theory (Theory of Planned Behavior TPB) to drive the large language model to perform chain inference. The inference layer generates decision tuples (including agent ID, binary decision result and decision reason text) based on the structured objects of the input layer and pushes them to the subsequent modules in real time through asynchronous data flow according to the decision reporting protocol. (3) Third is the statistical monitoring layer module, which includes a closed-loop memory and reflection mechanism. It receives and stores the decision trajectory of the inference layer in real time through the benchmark synchronization protocol. This module uses semantically driven fine-tuning functions to execute intertemporal cognitive update logic and stores the cumulative installation quantity and structured reasons at each time point in the database as a dynamic benchmark for policy inference. (4) Finally, there is the policy inference layer module, which is responsible for responding to the "What-if" intervention instructions (such as subsidy amount adjustment) from end users (such as policymakers). This module reads the benchmark data from the statistical monitoring layer according to the scenario inference protocol, extracts the micro-decision logic of the agent into a structured reasoning chain, and aggregates and generates macro-time series diffusion curves, installation quantity evolution diagrams and policy evaluation indicators, and finally outputs the sandbox inference results to end users.
[0055] The simulation method for distributed photovoltaic adoption based on a large language model is implemented through the following steps.
[0056] Step 1: Initialization of Agent Personality and Environmental Context. This is the logical starting point for the simulation, aiming to provide a multi-dimensional background for subsequent decision-making. Specifically, it involves constructing a "digital personality" for the household agent based on official statistical data of the target city (such as population census and statistical yearbooks), including key dimensions such as annual income, environmental awareness, and roof physical conditions; at the same time, it initializes real policy texts, seasonal factors, and external shock events as a space of environmental variables that are dynamically updated over time.
[0057] Step Two: Monthly Decision Generation Guided by Psychological Theory. This step generates specific decisions by inputting initialized individual characteristics and environmental information into the inference engine. During implementation, Theory of Planned Behavior (TPB) constructs (behavioral attitudes, subjective norms, and perceived behavioral control) are explicitly embedded into the cue word structure. This guides the large language model to execute chain-thinking (CoT) reasoning, which includes four stages: "reviewing the basic situation, analyzing current policies, comparing historical reasons, and making a final decision," thereby outputting the decision of whether to install and the underlying logical support.
[0058] Step 3: Behavioral evolution and dynamic memory update based on the reflexion mechanism. This step achieves intertemporal consistency of the agent's cognition by providing feedback on the decisions made in Step 2. Specifically, by maintaining a structured decision history database, when the agent chooses not to install in the current month, the system automatically extracts its historical reasons for refusal and injects them into the next decision prompt, forcing the agent to perform self-reflection, critically evaluate the effectiveness of historical reasons in the current new policy environment, and reconstruct the gradual evolutionary trajectory of residents from observation to acceptance.
[0059] Step 4: Multi-granularity result aggregation and policy sandbox counterfactual analysis. This step is the final manifestation of the simulation's value, responsible for transforming micro-level behaviors into macro-level insights. The system aggregates agent decision-making data monthly, generating time-series curves for installation rates, group characteristic distributions, etc.; and reruns the simulation process by modifying the policy semantic framework (e.g., shifting from economically induced to socially driven) to quantify the precise diffusion effects of different intervention strategies on low-income groups or different housing types.
[0060] In this invention, by employing an input module supporting unstructured text parsing, a chain-like reasoning step guided by the Theory of Planned Behavior (TPB), a storage and verification module with reflexion capabilities, and a counterfactual deduction function, policymakers can pre-simulate diffusion curves under different policy combinations by adjusting intervention variables in a virtual sandbox, thereby providing a forward-looking quantitative reference for scientific decision-making. These features collectively address the core pain points of existing technologies, such as cognitive logic gaps, decision-making black boxes, and the inability to interpret complex policy tones. Preferably, a dynamic decision interval (DDI) mechanism is introduced, which activates the agent through context-driven activation to optimize computational efficiency and enhance the ecological validity of the simulation.
[0061] This invention constructs an intelligent agent simulation framework based on a large language model (LLM) (such as...). Figure 2 As shown in the figure, this framework is used to simulate the decision-making process of residents in a certain city regarding the installation of rooftop distributed photovoltaic systems between 2020 and 2025. The framework uses an "individual-environment-memory" trinity as its core architecture and achieves high-fidelity, dynamically evolving household behavior simulation through the following four key steps: (1) Input layer - agent initialization and environment setting: construct a "digital personality" for each family that includes socioeconomic attributes, housing characteristics and initial attitudes; at the same time, use the policy summary agent to parse unstructured text, transform the lengthy official documents into policy summaries, and use them as input environmental variables.
[0062] (2) Reasoning Layer – Monthly Decision Generation: Guided by structured prompts, the LLM agent outputs a binary decision and reasoning on whether to install based on current policies, external factors, and personal traits. As the core engine, it embeds a prompt framework based on the Theory of Planned Behavior (TPB) to drive the Large Language Model (LLM) to perform CoT reasoning.
[0063] (3) Statistical monitoring layer - memory and reflection: maintain a structured database and use the Reflexion mechanism to record the historical decision-making trajectory of the agent to achieve cognitive consistency across cycles.
[0064] (4) Policy simulation layer – output / intervention: responds to the end user’s “What-if” command (i.e., simulates different policy interventions), runs the simulation by adjusting environmental parameters, and generates macro-diffusion curves.
[0065] The global data flow is as follows: Table 1: Data Flow Interaction Protocol Table for Policy Simulation Sandbox System
[0066] This invention proposes a policy simulation sandbox system based on a large language model, whose core inference engine adopts the open-source large language model GPT-OSS-120B. This system integrates distributed inference capabilities through standard API interface calls. Its key technical feature is that the model does not change its underlying parameters during operation, but strictly adopts an in-context learning mode based on structured prompts. The selection of GPT-OSS-120B aims to resolve the contradiction between the extremely high cost of calling general-purpose large models and the insufficient generalization of locally fine-tuned models in large-scale city-level simulations. Compared to closed-source models of similar scale, this model, through API calls, maintains a high level of logical inference capability while significantly reducing computational resource consumption and economic costs (approximately 100 to 200 times), making concurrent inference for tens of thousands of agents practically feasible in engineering. To balance the heterogeneity of decision-making and logical stability in simulations, the temperature coefficient during model inference is uniformly set to 0.7. This non-fine-tuning strategy, combined with chained reasoning (CoT), not only avoids the risk of a 'black box' in decision-making caused by model updates, but also ensures that the behavior of micro-individuals is logically highly aligned with the pre-set Theory of Planned Behavior (TPB) framework, achieving highly efficient, low-cost, and interpretable policy simulation.
[0067] In this invention, the reasoning layer transforms the Theory of Planned Behavior (TPB) into decision logic understandable by a large language model through specific structured prompts. This prompt template comprises five core components: role setting, environmental context, family characteristics, policy incentives and constraints, and CoT (Conceptual Chain of Thought) guidance.
[0068] Specific prompt word template examples:
[0069] Step 1: Initialize agent and environmental context parameters
[0070] Before conducting a simulation of urban-scale residential photovoltaic adoption behavior, it is necessary to first construct a micro-level individual foundation and macro-level policy environment that are highly consistent with the target area. This step provides the static and dynamic context for the entire simulation.
[0071] Agent Initialization: This step aims to construct an agent "digital personality" highly aligned with real-world demographic characteristics. Each household agent i is defined as a multi-dimensional feature vector. This vector serves as the core input for the inference layer prompt.
[0072] The attribute set of agent i is modeled as follows:
[0073] The specific parameters and quantification rules for each component are as follows: (1) Family size parameter (Si): (Personnel), this parameter represents the base amount of household electricity consumption. (2) Income level level {High, Medium, Low} (3) Physical resource constraints: (Unit: square meters); (4) Environmental awareness score This parameter corresponds to the "behavioral attitude" construct in the Theory of Planned Behavior (TPB). (5) Property constraint factor ( This variable primarily targets the environment of commercial housing, and its quantification logic is defined through the following piecewise function: (6) Diversify information channels. ): Defined as a set of information sources The elements are taken from {neighbor feedback, door-to-door sales, government news}.
[0074] For example, if a simulation is conducted using a specific city, the simulation will be based on the "Seventh National Population Census of a Certain City (2020)," the "Statistical Yearbook of a Certain City (2023)," and a special survey report from the housing and construction department on the population distribution in urban villages. The simulation will then use parametric modeling to model the family-based intelligent agent group. This personality will be constructed strictly based on official statistical data of the target city (e.g., a certain city), including key dimensions such as the number and type of households, housing characteristics, socioeconomic attributes (e.g., annual income level, environmental awareness score), and geographical location, ensuring that the intelligent agent group is highly consistent with the real population structure at the macro level.
[0075] Environment Initialization: Simultaneously, the simulation environment is initialized as a shared variable space that dynamically updates over a time step (monthly), containing the current year and month, seasonal factors (such as the impact of the Spring Festival holiday), external shock events, and the actual policy text content and release time. That is, the policy environment context vector ( ) is represented as: These policy texts are directly derived from publicly available government documents and serve as the core input for subsequent Large Language Model (LLM) decisions, thus anchoring the entire simulation to the timeline of real policy evolution.
[0076] To address the issue of lengthy and low-information-density policy documents, this invention introduces a policy summary agent at the input layer to generate summary policy text. This intelligent agent, built upon a large language model, aims to extract core content from raw, unstructured policy texts. This preprocessing avoids the attentional distraction problem that long texts can cause in subsequent household decision-making models, ensuring that individual decision-making models can focus on key decision-influencing factors. The specific workflow is as follows: The system first acquires the raw policy text. Through specific prompts, the model filters out procedural statements and non-decision-related information from the policy text, accurately extracting core decision factors such as subsidy standards, implementation periods, entry thresholds, and electricity pricing mechanisms.
[0077] To ensure the objectivity and accuracy of the extracted information, the prompt words for the policy summary agent are constructed as follows:
[0078] # Role: You are a professional and neutral policy analysis expert, skilled at extracting core information from complex government documents.
[0079] #Task: Please read the following policy text, extract the information that has a substantial impact on the decision to install solar panels in a home, and create a high-information-density summary.
[0080] # Extracting key points
[0081] 1. Economic Incentives: Specify the exact amount of the subsidy (RMB / kWh), the method of distribution, and the duration.
[0082] 2. Timeframe: Clearly define the policy's effective date, expiration date, and key grid connection timelines.
[0083] 3. Eligibility Constraints: Extract specific requirements for household roof area, housing type, or region.
[0084] No changes to any original values or dates are permitted.
[0085] # Original text: [Policy text]
[0086] Step 2: Monthly Decision Generation
[0087] Each month, the agent generates photovoltaic installation decisions through a prompt designed specifically for reliability and transparency.
[0088] First, LLMs are instructed to play the role of "family decision-maker." This role-playing technique is intentional, designed to mitigate known biases in LLMs (such as people-pleasing tendencies) and encourage more objective, analytical output. Second, LLMs are guided through a chain-of-thought (CoT) reasoning process, comprising four distinct steps: Step 1: Review your family's basic circumstances (income, roof, property attitude)...; Step 2: Analyze current month's policy and subsidy changes...; Step 3: Compare whether your past reasons for not installing still hold true...; Step 4: Make a decision on whether to install and explain your reasons.
[0089] Finally, a rule-based checking mechanism is attached to the end of the prompt, including a few examples to show the expected input-output format, to ensure that the output structure is consistent and reliable, facilitating automatic parsing in subsequent steps.
[0090] The innovation of this step lies in its use of a multi-part prompting architecture, which goes beyond simple instruction following and builds a constrained, self-correcting inference process within the LLM. This approach transforms the model into a predictable yet dynamic component in scientific simulation, capable of generating detailed and structured textual data.
[0091] Step 3: Behavioral Evolution and Memory Mechanisms
[0092] I. Static Cognitive Basis: Theory of Planned Behavior (TPB)
[0093] This invention uses Ajzen's (1991) Theory of Planned Behavior (TPB) as the core cognitive model for household photovoltaic adoption decisions. TPB posits that an individual's specific behavioral intentions are determined by three key psychological constructs: (1) Attitude toward the behavior: an individual's positive or negative assessment of the consequences of performing the behavior. In this model, this is characterized by a combination of household environmental awareness and economic rationality (such as income level, roof area, and comparison of expected returns from different models). (2) Subjective norm: social pressure perceived by the individual. The model indirectly reflects the penetration of social influence through property attitudes and major information channels (such as community social media and government propaganda). (3) Perceived behavioral control: an individual's judgment of the ease or difficulty of performing the behavior. This is determined by the physical conditions of the roof, the choice of installation mode (leasing vs. self-investment), and the current level of policy support.
[0094] Numerous empirical studies have demonstrated that TPB (Total Power Behavior) can effectively explain residents' psychological motivations in energy technology adoption, particularly in the decision-making process regarding rooftop photovoltaic (PV) systems. This invention explicitly embeds these constructs into the decision-making context of an LLM agent using structured prompts, ensuring that its decision-making process has a solid psychological basis.
[0095] II. Dynamic Evolution Mechanism: Memory and Reflection Based on Reflexion
[0096] To overcome the limitation of "independent decisions" in traditional LLM simulations and to achieve behavioral consistency and cognitive evolution of family agents over time, this invention introduces a dynamic memory module inspired by Reflexion. Reflexion proposes a language-based reinforcement learning paradigm: after making a decision, the agent generates self-reflection in natural language to perform attribution analysis on its behavior, and uses this reflection as context input for the next decision-making process.
[0097] (1) Natural Language-Based Decision Reason Storage
[0098] In this model, this mechanism is specifically applied to long-cycle decision-making scenarios for photovoltaic adoption. Whenever an agent decides to "not install for now," its reasons for refusal (such as "too long cost recovery period" or "unclear policy") are structured and recorded in the decision history archive (database) in the form of natural language text. In subsequent rounds, the system extracts historical reasons through a function and injects prompts: "You have considered this issue [N] times. Review the history: [Show the 3 most recent reasons for not installing]. Please reflect on the changes in current conditions and determine whether the old reasons still hold true."
[0099] (2) Cross-time comparative reflection to ensure the consistency of the agent's personality.
[0100] The reflection module is not a separate, complex loop, but rather directly integrated into the monthly decision prompts. It guides the agent to review past decisions: 1. Historical Retrieval: Before making a decision for the current month, the system automatically retrieves the agent's three most recent reasons for rejection from its archives and inputs them as background information into the large model. 2. Comparative Reflection: The prompts explicitly ask the agent: "Please reflect on the changes in current conditions and determine whether the old reasons still hold true." 3. Logical Transition: Through this comparison, the agent achieves a logical shift from "observation" to "adoption," ensuring it behaves like a consistent, realistic decision-maker throughout the simulation cycle, rather than making random decisions each month. Its attitude shift is gradual and verifiable.
[0101] This design achieves a closed loop of "execution-observation-attribution-adjustment." Unlike the original Reflexion, which is often applied to programming or programming tasks, this invention extends it to low-frequency, high-risk social technology adoption behaviors. When external environments (such as new subsidies or electricity price adjustments) change, historical reasons for rejection may conflict with current reality, triggering cognitive updates in the agent. This mechanism significantly enhances the longitudinal realism of the simulation, enabling a more accurate portrayal of the gradual logical shift of households from observation to adoption under policy incentives.
[0102] Step 4: Results Aggregation and Policy Sandbox Analysis
[0103] The ultimate goal of this framework is not only to generate individual decision sequences, but also to construct an interpretable, verifiable, and interventionist policy sandbox. To this end, the system automatically aggregates the following multi-dimensional outputs after each monthly simulation: (1) Micro level: Preserve the complete decision-making history of each family, including adoption status, reasons for rejection, decision-making triggering mechanism, level of urgency, etc., to support retrospective analysis of the behavioral paths of specific groups (such as low-income urban village families); (2) Meso-level: Monthly statistics on new installations, cumulative installation rate, LLM call count and adoption rate are used to form a time series diffusion curve; (3) Macro level: The total number of installations, distribution of group characteristics (income, housing type, region), average number of decisions, etc. are summarized annually to evaluate the long-term effects of the policy.
[0104] More importantly, this sandbox supports counterfactual simulation. For example, researchers can modify policy shock parameters (such as moving the "June 2025 policy breakpoint" forward to December 2024), or adjust subsidy intensity and information channel coverage, and rerun the simulation to quantify the impact of different policy combinations on adoption speed and fairness (such as penetration rate among low-income groups). This "what-if" capability is an advantage that traditional econometric models or rule-based ABM (Agent-based Modeling) cannot match.
[0105] Furthermore, to enhance the credibility of the results, this invention introduces a real data calibration mechanism, dynamically comparing the simulated monthly installation curve with the actual grid-connected data of a certain city, calculating the error, and visualizing the fitting effect. If the deviation is significant, it is possible to retrospectively check whether the prompt word design, agent initialization parameters, or external factor functions need to be adjusted, forming a closed loop of "simulation-verification-iterative optimization".
[0106] In addition, in the system's reasoning and decision-making process, this invention introduces a dynamic decision interval mechanism to calibrate the decision activation state of the agent in long-term simulation.
[0107] Specifically, in this embodiment of the invention, the Dynamic Decision Interval (DDI) mechanism triggers agent activation by monitoring the real-time rate of change of external environmental parameters. The specific quantification rules are as follows: Decision Interval It is a weighted composite of multiple factors, including individual economic attributes, risk preferences, social structure, and information access capabilities.
[0108] The relevant parameters and variables are defined as follows: , representing the baseline decision frequency (unit: month); The income level weighting coefficient is set to -1, 0, and 2 for high-, middle-, and low-income groups, respectively, to reflect the impact of economic redundancy on decision sensitivity. This represents the risk aversion level of the agent, with the corresponding weighting coefficient set as follows: ;P(prop iThe weight of the property constraint environment is set as follows: -2 when the property supports it, 0 when there is no property such as urban villages, and +4 when the property opposes it. The weighting coefficients represent the diversity of information channels accessed by an agent. This demonstrates how information completion can shorten the decision-making cycle.
[0109] This mechanism breaks through the "full-scale periodic invocation" mode commonly used in existing large language model simulation research. For the low-frequency decision-making behavior of residential photovoltaic adoption, which involves high cognitive load, this invention proposes that agent activation should not be based on mechanical time steps, but rather on a context-driven, real-world decision window. Specifically, the system only initiates the LLM decision-making process in the inference layer when the individual encounters significant external stimuli such as policy promotion or neighbor installation, or perceives substantial changes in environmental parameters such as electricity prices or subsidies.
[0110] The core of this design logic lies in accurately mapping the active population that is "truly considering whether or not to install," rather than unrealistically assuming that all residents will make decisions at every monthly point in time. By introducing the DDI mechanism, this system effectively overcomes the drawbacks of traditional full-scale call methods, which tend to overestimate the speed and breadth of policy response, integrating "decision inertia" and "information dependence" into the simulation framework. This not only significantly improves the system's computational efficiency, but more importantly, it significantly enhances the ecological validity of the simulation, making the multi-granularity diffusion curves output by the policy sandbox closer to the real spatiotemporal evolution of social technology diffusion.
[0111] Experimental verification
[0112] To verify the effectiveness of the policy simulation sandbox system proposed in this invention in a real-world scenario, this embodiment selects the adoption process of residential distributed photovoltaic (DPV) in a certain city as a research case, with the simulation spanning from January 2020 to December 2025. To ensure the robustness of the evaluation results, this invention conducted five independent replicate experiments using different random seeds (with a temperature coefficient set to 0.7).
[0113] The inference layer provides decision support to the agent via remote calls to the GPT-OSS-120B interface. This model was chosen based on optimizing the 'inference efficiency ratio' in large-scale simulation tasks: experimental data shows that GPT-OSS-120B exhibits extremely high computational efficiency when handling parallel simulations involving city-scale scenarios (such as tens of thousands of residential PV adopters), with its token processing speed and response latency meeting the real-time requirements of long-cycle evolution simulations. Furthermore, thanks to its open-source platform and high cost-effectiveness, the system's overall operating cost for completing over ten thousand decision-making inference tasks is only about 1% of that of similar commercial closed-source models. In addition, by setting a temperature coefficient of 0.7, the model, within the in-context learning framework, can generate decision samples that are both logically consistent and possess a moderate degree of randomness, thus statistically more realistically reproducing the decision distribution characteristics of real-world populations.
[0114] This system uniformly sets the temperature coefficient for model inference to 0.7. This value is chosen based on the following technical considerations: a low temperature coefficient (e.g., < 0.5) would lead to overly convergent and mechanical outputs, failing to reflect the randomness of residents' adoption of photovoltaic power due to social emotions; while an excessively high temperature coefficient (e.g., > 1.0) would introduce logical illusions, undermining decision-making consistency. 0.7 ensures that the agent retains appropriate behavioral diversity while strictly adhering to the Theory of Planned Behavior (TPB) logical framework, thus more realistically simulating the distribution characteristics of real-world group decision-making.
[0115] This embodiment divides the verification process into two stages: (1) Calibration stage (2020-2023): The initial attributes of the agent are aligned using historical data from this period, and key parameters in the Dynamic Decision Interval (DDI) mechanism are determined. (2) Blind test verification stage (2024-2025): In this stage, the system does not access any real installed capacity data. The agent only reads policy texts at specific times (such as unstructured texts like Document No. 136 issued in 2025) through the "input layer," and the "inference layer" autonomously generates decisions. Finally, the prediction accuracy of the system under complex policy fluctuations is quantified by comparing the simulated prediction values with the authorized photovoltaic installation data provided by a power supply bureau of a certain city in the Southern Power Grid.
[0116] I. Macroscopic Fit Verification
[0117] The experiment compared the simulated curves and measured data of the cumulative installed capacity of distributed photovoltaic power in a certain city. The results are as follows: Figure 3As shown, the simulation curves generated by the system of this invention show a very high degree of consistency with the measured trends, and can accurately capture the steady growth driven by subsidy policies from 2021 to 2022, as well as the explosive growth triggered by policy expectations in early 2025.
[0118] This experimental example uses the Annual Total Volume Error (ATVE) as the core evaluation index. This index calculates the relative error between the simulated total and the measured total for each year, and then calculates the average over the entire observation period to eliminate short-term monthly fluctuations caused by weather or construction cycles.
[0119] The calculation formula is as follows:
[0120] in, y represents the simulated value, and y represents the measured value.
[0121] Experimental data (as shown in Table 1) show that the average prediction error of this system was only 5.16% over the five full years from 2020 to 2025, with the fitting error for each year being less than 10%. This accuracy is significantly better than traditional heuristic models, fully verifying the superior performance and reliability of this invention in long-term, large-scale urban energy policy simulation.
[0122] Table 1: Experimental results of the framework of this invention in a case study in a certain city (2020-2025)
[0123] II. Policy Sandbox
[0124] To verify the practical value of this invention as a policy sandbox, three counterfactual intervention scenarios were designed using 2026 as an example. The experiment aims to quantify how policy interventions under different promotion methods affect the diffusion rate of distributed photovoltaic (DPV) in different socioeconomic groups and to provide policy insights for targeted promotion.
[0125] Starting in January 2026, a specific semantic framework (policy framing) will be injected as an intervention strategy into each agent's monthly decision context. This design aims to observe how different information delivery methods can influence the long-term diffusion process by reshaping the agent's cognition. The specific intervention design is as follows: This invention designs three intervention strategies to simulate the impact of different policies or promotional contexts on residential photovoltaic (PV) adoption behavior. Strategy A (Economic Induction Type) uses the following prompt: "[Authoritative Actuarial Analysis] Installing PV is currently the optimal choice for household financial management. According to calculations, the annualized return is as high as 10%, far exceeding bank fixed deposits. The subsidy policy is entering its final window of opportunity; install early and recoup your investment early." Its intervention logic focuses on value decision-making, activating the agent's economic perception by clearly quantifying the investment return (10%), aiming to reduce its concerns about the uncertainty of investment returns, thereby driving adoption conversion. Strategy B (Socially Driven) uses the prompt: "[Neighborhood Reputation] 30% of households in your community have already installed solar panels. Aunt Zhang's feedback: It's much cooler at home in the summer, and the electricity bill has dropped from 500 yuan to 50 yuan. Maintenance is all included, and the neighbors all say it's reliable." This strategy is based on social norms theory. By presenting the community penetration rate (30%) and concrete life scenarios, it simulates a real community promotion situation, using the "social proof" effect to reduce individuals' perceived risk and accelerate technology diffusion. Strategy C (Natural Diffusion Group) does not apply any external semantic intervention and serves as a control baseline to measure the net gain effect brought about by the above two types of semantic intervention strategies.
[0126] Table 2: Comparison of Residential Solar Adoption Indicators under Different Policy Scenarios (2026)
[0127] First, the experimental results reveal a significant synergistic effect between semantic expression and policy effectiveness. The results demonstrate that the mere existence of a policy is insufficient to directly and effectively reach residents and drive their adoption. Semantic interventions implemented through a large language model, namely strategies A and B, resulted in a significant increase in conversion rates for both groups, rising to between 57% and 67% compared to the baseline group's average conversion rate of 33.28%. This phenomenon illustrates that the method of information dissemination is as important as the policy itself. If the government issues subsidy policies but fails to establish consensus with residents through effective semantic outreach, the potential social benefits of the policy will be difficult to fully realize.
[0128] Secondly, a significant "trust leverage" effect was found in urban village environments. The close-knit social networks of urban villages make them highly sensitive to promotional methods based on neighborhood relationships. Experimental data shows that the conversion rate of strategy B in urban villages surged from 33.17% in the baseline group to 70.77%. This "trust leverage" effect based on social evidence is particularly pronounced in informal housing areas, with an increase far exceeding that in commercial housing areas. This provides important insights for policymakers: in communities with close social relationships, cultivating model families to build community consensus is an efficient path to reduce perceived individual risk and achieve large-scale technology diffusion.
[0129] Finally, residents of commercial housing exhibited greater prudence in their decision-making process, a stark contrast to the significant group conformity observed among residents of urban villages. The experimental results showed that even with interventions from authoritative actuarial science (Strategy A) or neighborhood word-of-mouth (Strategy B), the adoption conversion rate among commercial housing residents failed to exceed 60%. This reflects the more complex interest game faced by this group, including restrictions from property management, obstruction issues from high-rise buildings, and a stronger capacity for critical thinking regarding economic data. For this group, a single promotional approach is often insufficient to overcome their decision-making inertia; future efforts will require more diverse and targeted combined intervention strategies.
[0130] The core architecture proposed in this invention, namely "semantic parsing - theory-driven reasoning - long-cycle reflective evolution", has strong universality and transfer potential. In addition to household photovoltaic adoption simulation, its technical principles can also be deeply applied in the following broader fields: (1) In the field of urban governance and smart transportation, this invention can be used to simulate the diffusion of the willingness to purchase new energy vehicles (EVs), the psychological acceptance of urban congestion fee policies, and the formation of shared travel habits. By replacing the photovoltaic decision-making model with a traffic psychology model, the system can simulate the psychological resistance and acceptance process of citizens with different occupations and different commuting pressures when facing the government's adjustment of charging pile layout or implementation of traffic restriction policies, thereby predicting the spatiotemporal flow evolution after traffic policy adjustments and providing a more humane decision-making basis for traffic planning. (2) In the field of public health and health intervention, this invention can build a "digital resident laboratory" for scenarios such as vaccine promotion and chronic disease management intervention. By using the reflection mechanism of intelligent agents, the cognitive update logic of residents on massive amounts of health information can be simulated. For example, when faced with an outbreak of infectious diseases, the government can rehearse in a sandbox how different tones and channels of popular science information will affect the final decision of the "vaccine-hesitant" group, thereby selecting the intervention plan with the highest dissemination efficiency and the ability to eliminate social panic before the actual policy is released. (3) In the field of real estate policy and the allocation of affordable housing resources, due to the characteristics of housing decisions being high-value and long-cycle, the "intertemporal memory and reflection" module of this invention is extremely suitable for the wait-and-see mentality of homebuyers. The system can simulate the real reactions of the rigid demand group and the improvement group to policy changes under different scenarios such as interest rate adjustments, relaxation of purchase restrictions, or the entry of affordable rental housing into the market. This helps the government to more accurately predict the evolution of market supply and demand and avoid the drastic market fluctuations caused by policy lag.
[0131] In summary, this invention provides a policy simulation sandbox method and system based on a large language model. It designs an intelligent agent simulation framework that integrates social psychology theory and a large language model. By constructing a three-in-one technical architecture of "semantic parsing - theory-driven reasoning - long-term reflective evolution", it achieves high-fidelity simulation and interpretable deduction of urban residents' policy response behavior, providing a quantifiable, interventionist, and traceable decision support platform for the accurate formulation of energy and social policies.
[0132] The key innovative contributions and outstanding advantages of this invention include: 1. A cue-based reasoning framework based on social psychology theory: The Theory of Planned Behavior (TPB) is explicitly embedded into the cue-based framework, enabling the agent to no longer rely on simple rule calculations, but to make semantic decision-making and reasoning based on dimensions such as attitude, norms, and perceptual control, just like a real person.
[0133] 2. A cross-period cognitive update method based on the Reflexion mechanism: By maintaining the agent's historical decision memory, it drives the agent to reflect on and critically evaluate the past "reasons of rejection", thus restoring the dynamic psychological evolution process of residents from observation and hesitation to adoption.
[0134] 3. Simulation environment supporting direct reading of unstructured policy texts: A simulation architecture is proposed that utilizes a policy summarizing agent to directly parse unstructured semantic information such as real-world policy documents. This architecture uses an agent to summarize the text, transforming it into semantic feature vectors that the agent can understand, rather than simply numerical parameters. This enables the 'policy sandbox' to handle complex semantic interventions and simulate real policy scenarios.
[0135] 4. Context-Driven Dynamic Decision Interval (DDI) Mechanism: A non-fixed step size agent activation method is proposed to dynamically adjust the simulation rhythm according to the frequency of external environmental shocks and policy changes, thereby improving simulation validity and optimizing computational performance.
[0136] 5. Policy counterfactual simulation function: A method is proposed to conduct pre-simulation by adjusting intervention variables (such as policy subsidy intensity and publicity strategy combination) in the simulation sandbox, which supports the generation of policy diffusion curves under different intervention scenarios, and provides quantitative and interpretable decision reference for the pre-evaluation of policy effects.
[0137] Compared to traditional agent modeling (ABM) methods based on mathematical probability or fixed logical thresholds, this invention offers significant technical advantages. First, by leveraging the semantic parsing capabilities of large language models, this invention addresses the challenge of traditional models handling unstructured policy texts. This allows the simulation system to directly assess the psychological impact of different policies on residents, significantly improving the counterfactual inference accuracy of the "policy sandbox." Second, by introducing a reflexion mechanism and a psychological theoretical framework, this invention effectively overcomes the "black box" nature of agent decision-making logic and the lack of coherence in long-term evolution in traditional ABM. Traditional models often only provide numerical results of "install or not install," while this invention outputs a complete logical reasoning chain, clearly revealing why residents have changed their previous rejection attitudes under the current circumstances. This causal interpretability provides scientific evidence to support the government's formulation of differentiated and precise energy incentive policies, making the simulation results more valuable for decision-making.
[0138] The above description, in conjunction with specific / preferred embodiments, provides a further detailed explanation of the present invention. It should not be construed that the specific implementation of the present invention is limited to these descriptions. For those skilled in the art, various substitutions or modifications can be made to these described embodiments without departing from the inventive concept, and all such substitutions or modifications should be considered within the scope of protection of the present invention.
Claims
1. A policy simulation sandbox method based on a large language model, used to simulate residents' response behavior to energy policies at an urban scale, characterized in that... Includes the following steps: S1. Construct a heterogeneous group of family intelligent agents. Based on official statistics of the target city, initialize a digital personality profile for each intelligent agent, including socio-economic attributes, housing characteristics and psychological cognitive dimensions, and parse unstructured policy texts into environmental variables that are dynamically updated over time. S2. Based on a preset decision interval mechanism or changes in the external environment, the agent is triggered to make explicit reasoning, so that the agent only enters the decision state when the activation conditions are met. S3. For the triggered agent, the psychological constructs of the Theory of Planned Behavior are embedded into the cue word structure to guide the large language model to perform chain reasoning to generate a structured decision tuple containing the decision result and its logical reasons. If the decision result is rejection, the text of the rejection reason is stored in the memory module, and the agent is made to retrieve and reflect on the historical reasons in subsequent decision cycles to maintain intertemporal cognitive consistency. S4. Summarize the decision results of all agents, aggregate them monthly to generate macro diffusion curves, and respond to the What-if intervention instructions of end users. By adjusting the policy semantic framework, rerun the simulation and output the sandbox simulation results under different intervention scenarios.
2. The policy simulation sandbox method based on a large language model as described in claim 1, characterized in that, In step S1, the construction of the digital personality profile includes: assigning family size parameters to each family agent to represent electricity consumption base, income level, effective roof area to represent physical resource constraints, environmental awareness score to correspond to the behavioral attitude construct in the Theory of Planned Behavior, property constraint factors, and the diversity of main information channels; wherein, the property constraint factor quantifies the impact of different property environments on decision-making through a piecewise function, and assigns different weight coefficients according to whether the property holds a supportive attitude, an opposing attitude, or an environment without property management; the environmental awareness score is quantified using a ten-point scale, with higher values indicating a stronger positive attitude towards environmental protection.
3. The policy simulation sandbox method based on a large language model as described in claim 1, characterized in that, In step S1, parsing the unstructured policy text into environmental variables includes: The policy summary agent performs semantic parsing on the original policy documents. Built on a large language model, the agent filters out non-decision-related procedural statements under the guidance of preset prompts, extracting core factors that substantially impact household decisions. These core factors include subsidy standards, implementation periods, entry thresholds, and electricity pricing mechanisms. The prompts for the policy summary agent include a role set as a policy analysis expert, a task requirement to extract high-information-density summaries, and the categories of key points to be extracted, ensuring objectivity and accuracy. The parsed policy summary text is then used as an environmental variable input into subsequent decision-making steps to avoid the attentional distraction problem caused by long texts on the decision-making model.
4. The policy simulation sandbox method based on a large language model as described in claim 1, characterized in that, In step S2, the decision interval mechanism is implemented by dynamically calculating the decision interval of each agent: based on a preset baseline decision frequency, a weighted synthesis is performed by comprehensively considering the agent's income level, risk aversion, property constraints, and information channel diversity; wherein, income level is assigned different weight coefficients according to high, medium, and low levels, risk aversion is represented by a continuous numerical value and multiplied by the corresponding weight coefficient, property constraints are assigned different adjustment weights according to support, opposition, or no property status, and information channel diversity is weighted according to the number of information sources the agent comes into contact with to reflect the compression effect of information completion on the decision cycle; high income, low risk aversion, property support, and multiple information channels are assigned weights to shorten the decision interval, and vice versa.
5. The policy simulation sandbox method based on a large language model as described in claim 1, characterized in that, In step S2, the explicit reasoning of the triggering agent includes: by monitoring the real-time rate of change of external environmental parameters, when a substantial change in environmental parameters is detected or the individual receives a significant external stimulus, the agent is immediately activated to enter the decision-making state; the substantial change includes policy text updates, subsidy intensity adjustments, and electricity price changes; the significant external stimulus includes policy publicity, neighbor installation examples, and major social events.
6. The policy simulation sandbox method based on a large language model as described in claim 1, characterized in that, In step S3, embedding the psychological constructs of the Theory of Planned Behavior into the cue word structure includes: explicitly modeling the agent's behavioral attitude, subjective norms, and perceived behavioral control in the cue words, respectively representing the intensity of attitude through environmental awareness scores, the pressure of social norms through property attitudes and information sources, and the perceived behavioral control through rooftop physical conditions and policy support. The chain reasoning includes four sequentially linked stages: reviewing the family's basic situation, analyzing the current policy environment, comparing historical decision-making reasons, and making a final decision. Each stage guides the large language model to perform step-by-step reasoning before synthesizing the results to arrive at a decision conclusion, ensuring the transparency and interpretability of the decision-making process.
7. The policy simulation sandbox method based on a large language model as described in claim 1, characterized in that, In step S3, embedding the psychological constructs of the Theory of Planned Behavior into the prompt word structure further includes: explicitly embedding a description of photovoltaic installation modes into the prompt words, including rooftop leasing and full-funding modes, which correspond to different benefit distribution mechanisms and decision-making trade-offs; the prompt word structure further includes a role setting as a family decision-maker, current decision-making time node and seasonal factors prompts, external major event prompts, a review of the family's basic situation, a display of recent policy search results, and a review of historical decision-making reasons; wherein, the recent policy search results display the latest preset number of policy documents in reverse chronological order, including policy name, issuing agency, release date, and main content summary; the review of historical decision-making reasons displays the reasons for not installing in the most recent times, guiding the agent to reflect during the comparison stage of chain reasoning, and to judge whether the old reasons still hold true in the current new policy environment, thereby fully integrating the multi-dimensional trade-offs of economic benefits, environmental awareness, social norms, and risk perception in the decision-making process.
8. The policy simulation sandbox method based on a large language model as described in claim 1, characterized in that, In step S3, the storage to memory module includes: structurally recording the rejection reason text generated for each decision in natural language in the decision history database; in subsequent decision cycles, the system automatically retrieves the agent's most recent historical rejection reasons and injects them into the context of the current decision prompt, guiding the agent to perform comparative reflection, requiring it to critically evaluate the effectiveness of historical reasons in the current new policy environment, and determine whether the old reasons still hold true; through this cross-period comparative reflection mechanism, a gradual cognitive evolution from observation to acceptance is achieved, enabling the agent to maintain personality consistency over a long period.
9. The policy simulation sandbox method based on a large language model as described in claim 1, characterized in that, In step S4, the macro diffusion curve includes: a time series curve of new installations counted monthly, an evolution graph of cumulative installation rate, and a distribution of group characteristics by income level, housing type, and region; the What-if intervention instructions include modifying the policy subsidy level, adjusting the policy effective time node, and changing the policy semantic framework type; by comparing the differences in diffusion curves under different intervention scenarios, the precise incentive effect of the policy combination on different housing types or income groups is quantitatively evaluated; the simulated monthly installation curve is dynamically compared with the actual grid connection data, the error is calculated and the fitting effect is visualized, forming a closed loop of simulation-verification-iterative optimization.
10. A policy simulation sandbox system based on a large language model, used to implement the method described in any one of claims 1 to 9, characterized in that, include: The input layer module, as a data access point, is used to parse unstructured policy texts in the external environment and parameterize the socioeconomic attributes and housing characteristics of the family intelligent agent based on urban statistical data. The input layer module encapsulates the generated digital personality profile and external environmental variables into structured objects through the prompt word template protocol and passes them to the inference layer module. The inference layer module, as the core inference engine, is connected to the input layer module. It embeds a cue word framework based on the theory of planned behavior to drive the large language model to perform chained inference. The inference layer module generates a decision tuple containing the agent ID, binary decision result, and decision reasoning text based on the received structured object, and pushes it to the statistical monitoring layer module in real time via asynchronous data stream according to the decision reporting protocol. The statistical monitoring layer module, connected to the inference layer module, includes a closed-loop memory and reflection mechanism, used to receive and store the decision trajectory generated by the inference layer module in real time through a benchmark synchronization protocol; the statistical monitoring layer module uses a semantically driven fine-tuning function to execute intertemporal cognitive update logic, and stores the cumulative number of installations and structured reasons at each time point in the database as a dynamic benchmark for policy inference; The policy inference layer module, connected to the statistical monitoring layer module, is used to respond to the What-if intervention commands of the end user. The policy inference layer module reads the baseline data from the statistical monitoring layer module according to the scenario inference protocol, extracts the micro decision-making logic of the agent into a structured reasoning chain, and aggregates it to generate macro time series diffusion curves, installation quantity evolution diagrams and policy evaluation indicators, and finally outputs the sandbox inference results to the end user.