World model based software migration adaptation method and system
Patent Information
- Application Number
- CN202611258153.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-19
- Publication Date
- 2026-10-23
AI Technical Summary
其一,离线测试或模拟验证均需要耗费大量真实物理交互资源,测试周期长且成本高昂;对于高价值或高安全要求的物理受控对象(如工业机器人、医疗设备),重复测试可能引入不可逆损坏风险,导致适配过程难以高效推进
[0048]本发明世界模型的引入使软件迁移全程可在虚拟空间进行高精度模拟,无需频繁触发物理受控对象的真实响应,大幅降低迁移过程中的安全隐患与调试成本。通过执行行为数据与响应数据构建的世界模型,能够准确刻画待迁移软件与物理受控对象之间的交互规律,为后续适配提供可信基座。候选适配配置经世界模型模拟后输出的预测置信度,为安全边界判别提供量化指标,避免盲目采用未知风险配置。当预测置信度低于预设安全判定条件时,系统仅在物理受控对象的安全边界内发送探测指令,获取实际响应数据对世界模型进行增量修正。这种渐进式探索机制在保证物理实体安全的前提下,不断缩小世界模型与真实环境的偏差,提升模型预测精度。修正后世界模型对候选适配配置重新模拟,得到更准确的预测响应轨迹,从而有效应对目标运行环境特征数据的不确定性,使适配过程具备自校正能力。依据物理受控对象稳定运行裕度要求转化的约束条件,对修正后预测响应轨迹进行符合程度评估,自动筛选出最优目标适配配置,确保适配后软件在实际运行中始终满足安全裕度。最终生成的适配策略可指导待迁移软件在目标运行环境中的适配调整与部署,实现从模拟到实际的无缝衔接,驱动物理受控对象按预期执行动作。
Smart Images

Figure CN122963610A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of software migration and adaptation technology, and in particular to a software migration and adaptation method and system based on a world model. Background Technology
[0002] Software migration and adaptation technologies are widely used in cross-platform deployment scenarios for various embedded systems and control software. Current conventional practices typically rely on offline testing of the target operating environment: technicians manually configure or automate the process using scripts, repeatedly running the software to be migrated in the target environment to observe its interaction with the physical controlled object, and adjusting software parameters one by one based on the observation results until basic functional requirements are met. Some solutions employ a simulator-based pre-verification process, simulating the response characteristics of physical objects in a virtual environment, thereby reducing the number of real-world tests. In addition, there are static adaptation methods based on rule bases or expert experience, which modify the software in batches using predefined configuration templates and rely on regression testing to verify the adaptation effect.
[0003] The aforementioned conventional methods have significant drawbacks. First, offline testing or simulation verification requires substantial real-world physical interaction resources, resulting in long testing cycles and high costs. For high-value or high-security physically controlled objects (such as industrial robots and medical devices), repeated testing may introduce irreversible damage risks, hindering the efficient advancement of the adaptation process. Second, static rules or fixed templates cannot address the dynamic uncertainties in the target operating environment, such as hardware performance fluctuations, network latency variations, or the nonlinear characteristics of the physical object itself. This means that the adapted software may deviate from the safe range due to minor environmental shifts during long-term operation, failing to effectively guarantee the system's stable operation margin. These shortcomings necessitate an urgent need in the field for an intelligent adaptation method that balances efficiency and security. Summary of the Invention
[0004] The embodiments of the present invention provide a software migration and adaptation method and system based on a world model, which can solve the problems in the prior art.
[0005] A first aspect of this invention provides a software migration and adaptation method based on a world model, comprising:
[0006] Acquire execution behavior data of the software to be migrated, response data of the physically controlled objects interacting with the software to be migrated, and characteristic data of the target operating environment;
[0007] A world model is constructed based on execution behavior data and response data. Candidate adaptation configurations are generated based on the differences between execution behavior data and target operating environment characteristic data. The world model simulates the candidate adaptation configurations and outputs the predicted response trajectory and prediction confidence.
[0008] When the prediction confidence level is lower than the preset security judgment condition, a detection command within the security boundary is issued to the physical controlled object, and the actual response data is obtained to correct the world model, thus obtaining the corrected world model.
[0009] The candidate adaptation configurations are simulated using the modified world model to obtain the modified predicted response trajectory. The stability margin requirement of the physically controlled object is transformed into the constraint condition of the predicted response trajectory. Based on the degree of conformity of the modified predicted response trajectory with respect to the constraint condition, the target adaptation configuration is selected from the candidate adaptation configurations to generate an adaptation strategy.
[0010] The software to be migrated is adjusted according to the adaptation strategy to obtain the adapted software. The adapted software is then deployed to the target operating environment and interacts with the physical controlled object to drive the physical controlled object to perform actions.
[0011] A world model is constructed based on execution behavior data and response data. Candidate adaptation configurations are generated based on the differences between the execution behavior data and the target operating environment characteristic data. The world model simulates the candidate adaptation configurations and outputs the predicted response trajectory and prediction confidence, including:
[0012] Extract the sequence of control commands and the command sending time from the execution behavior data, extract the sequence of physical controlled object state changes and the state acquisition time from the response data, align the command sending time and the state acquisition time in time, establish the pairing relationship between each control command and the corresponding state change to form a command-state sample set, and perform function fitting on the command-state sample set to generate a state transition function as a world model.
[0013] Extract hardware response characteristics and resource constraints from the target operating environment feature data, extract hardware dependency characteristics and resource occupancy conditions from the execution behavior data, calculate the response deviation of hardware response characteristics and hardware dependency characteristics and the capacity deviation of resource constraints and resource occupancy conditions, and generate candidate adaptation configurations based on the response deviation and capacity deviation.
[0014] The candidate adaptation configuration is applied to the control command sequence to generate the correction command sequence. The correction command sequence and the initial state are input into the world model for iterative calculation. At each step, the world model takes the output state of the previous step as the current input state and outputs the predicted state and the deviation value.
[0015] The predicted states from the iterative outputs of the world model are connected to form the predicted response trajectory, and the prediction confidence is obtained by accumulating the deviation values of the iterative outputs.
[0016] The world model is generated by fitting a function to a set of instruction-state samples to produce a state transition function, which includes:
[0017] The response delay is identified from the instruction-state sample set as the time difference between the sending time of each control instruction and the time when the state change of the corresponding physical controlled object occurs. The response delay distribution characteristics corresponding to different instruction types are statistically analyzed, and the response delay distribution characteristics are encoded into a delay embedding vector. The delay embedding vector is concatenated with the instruction parameters of the control instruction to form a delay-aware input feature vector.
[0018] A multi-layer neural network consisting of an encoding layer, a state prediction layer, and a delay prediction layer is constructed as the state transition function. The encoding layer receives the delay-aware input feature vector and extracts the state transition pattern. The state prediction layer outputs the predicted state change based on the state transition pattern, and the delay prediction layer outputs the predicted delay based on the state transition pattern.
[0019] Calculate the state deviation between the predicted state change and the state change of the physical controlled object in the command-state sample set, as well as the time delay deviation between the prediction delay and the response delay. Based on the weighted combination of the state deviation and the time delay deviation, adjust the connection weights of the encoding layer, the state prediction layer and the delay prediction layer in the multilayer neural network in reverse. Repeat the training until the state deviation and the time delay deviation converge simultaneously to generate a state transition function as the world model.
[0020] The world model is revised by obtaining actual response data, resulting in the revised world model, which includes:
[0021] The detection command is input into the world model and the physical controlled object respectively. The predicted response data is obtained from the world model and the actual response data is obtained from the physical controlled object. The response deviation between the predicted response data and the actual response data is calculated. When the response deviation exceeds the preset allowable threshold, the corresponding detection command, predicted response data and actual response data are marked as inaccurate samples.
[0022] The detection commands from the inaccurate samples are re-inputted into the world model and the extrapolation process is tracked. The network layer that contributes the most to the response bias during the extrapolation process is identified as the inaccurate network layer. The detection commands from the inaccurate samples and the actual response data are used to construct a corrected sample set.
[0023] The corrected sample set is input into the misaligned network layer for training. The connection weights of the misaligned network layer are adjusted according to the error between the actual response data and the output of the misaligned network layer. The connection weights of the other network layers are frozen. The training is repeated until the error converges. The world model with the updated connection weights is used as the corrected world model.
[0024] The stability margin requirements of the physically controlled object are transformed into constraints for the predicted response trajectory. Based on the degree to which the modified predicted response trajectory conforms to the constraints, a target adaptation configuration is selected from the candidate adaptation configurations, and the adaptation strategy is generated, including:
[0025] Obtain the limits on the amplitude of state fluctuations and the limits on the rate of state change from the design specification documents of the physically controlled object as the stability margin requirements for the physical controlled object;
[0026] The state fluctuation amplitude limit is transformed into upper and lower limits of the state value in the corrected predicted response trajectory, and the state change rate limit is transformed into gradient constraints of the change amount of adjacent states in the corrected predicted response trajectory. The upper limit constraint, lower limit constraint and gradient constraint are combined to form the constraint conditions.
[0027] Calculate the number and magnitude of default points that exceed the upper limit constraint, lower limit constraint, and gradient constraint in each corrected predicted response trajectory, and calculate the compliance score of each corrected predicted response trajectory based on the number and magnitude of default points.
[0028] The adaptation configuration corresponding to the corrected predicted response trajectory with the highest conformity score is selected as the target adaptation configuration. The target adaptation configuration is then converted into parameter adjustment instructions and resource allocation instructions for the software to be migrated to generate an adaptation strategy.
[0029] The conformity score for each revised predicted response trajectory is calculated based on the number of default points and the magnitude of defaults, including:
[0030] Traverse the default points in each corrected predicted response trajectory, select the corresponding constraint boundary according to the type of constraint violated by the default point, calculate the deviation distance between the default point and the corresponding constraint boundary as the single-point default amount, and sum up the single-point default amounts of each default point after normalization to obtain the cumulative default magnitude.
[0031] The proportion of default points in each corrected predicted response trajectory to the total number of predicted states is used as the default point density. A weighted combination function of cumulative default magnitude and default point density is constructed, and the cumulative default magnitude and default point density are mapped to default penalty values through the weighted combination function.
[0032] The difference between the preset benchmark score and the default penalty value is used to obtain the conformity score of each corrected predicted response trajectory.
[0033] The software to be migrated is adjusted according to the adaptation strategy to obtain adapted software. The adapted software is then deployed to the target runtime environment and interacts with the physical controlled object to drive the physical controlled object to perform actions, including:
[0034] The parameter adjustment instructions and resource allocation instructions in the adaptation strategy are parsed. Based on the parameter adjustment instructions and resource allocation instructions, the configuration of the software to be migrated is modified and resources are reallocated to obtain the adapted software. The adapted software is then deployed to the target runtime environment and started.
[0035] When the adapted software sends control commands to the physical controlled object, it synchronously inputs the control commands and the current state of the physical controlled object into the modified world model for real-time simulation. The modified world model outputs the expected response data of the corresponding control commands. After receiving the control commands, the physical controlled object executes the actions and returns the actual response data. The real-time deviation between the expected response data and the actual response data is calculated.
[0036] When the real-time deviation exceeds the preset deviation threshold, the control command and actual response data are input into the corrected world model to track the simulation path, identify the parameter mismatch items in the simulation path that cause the real-time deviation, generate parameter correction commands based on the parameter mismatch items, adjust the operating parameters of the adapted software according to the parameter correction commands, and the adjusted adapted software continues to send subsequent control commands to the physical controlled object.
[0037] A second aspect of this invention provides a software migration and adaptation system based on a world model, comprising:
[0038] The data acquisition unit is used to acquire the execution behavior data of the software to be migrated, the response data of the physically controlled objects that interact with the software to be migrated, and the characteristic data of the target operating environment.
[0039] The model simulation unit is used to build a world model based on execution behavior data and response data, generate candidate adaptation configurations based on the differences between execution behavior data and target operating environment feature data, simulate the candidate adaptation configurations by the world model, and output the predicted response trajectory and prediction confidence.
[0040] The model correction unit is used to issue a detection command within the safety boundary to the physical controlled object when the prediction confidence is lower than the preset safety judgment condition, obtain the actual response data to correct the world model, and obtain the corrected world model.
[0041] The strategy generation unit is used to simulate candidate adaptation configurations using the modified world model to obtain the modified predicted response trajectory. It transforms the stability margin requirement of the physically controlled object into the constraint condition of the predicted response trajectory. Based on the degree of conformity of the modified predicted response trajectory with respect to the constraint condition, it selects the target adaptation configuration from the candidate adaptation configurations and generates the adaptation strategy.
[0042] The deployment and implementation unit is used to adjust the software to be migrated according to the adaptation strategy to obtain the adapted software, deploy the adapted software to the target operating environment and interact with the physical controlled object to drive the physical controlled object to perform actions.
[0043] A third aspect of the present invention provides an electronic device, comprising:
[0044] processor;
[0045] Memory used to store processor-executable instructions;
[0046] The processor is configured to invoke instructions stored in the memory to execute the aforementioned method.
[0047] A fourth aspect of the present invention provides a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement the aforementioned method.
[0048] The introduction of the world model in this invention enables high-precision simulation of the entire software migration process in virtual space, eliminating the need for frequent triggering of the actual responses of the physically controlled objects and significantly reducing security risks and debugging costs during migration. The world model, constructed from execution behavior and response data, accurately depicts the interaction patterns between the software to be migrated and the physically controlled objects, providing a reliable foundation for subsequent adaptation. The prediction confidence score output by the world model after simulation of candidate adaptation configurations provides a quantitative indicator for safety boundary determination, avoiding the blind adoption of configurations with unknown risks. When the prediction confidence score is lower than the preset safety judgment condition, the system only sends probe commands within the safety boundary of the physically controlled objects, obtaining actual response data to incrementally correct the world model. This progressive exploration mechanism continuously reduces the deviation between the world model and the real environment while ensuring the safety of physical entities, improving the model's prediction accuracy. The corrected world model re-simulates the candidate adaptation configurations to obtain more accurate predicted response trajectories, effectively addressing the uncertainty of the target operating environment's characteristic data and enabling the adaptation process to have self-correcting capabilities. Based on the constraints transformed from the stability margin requirements of the physically controlled object, the conformity of the corrected predicted response trajectory is evaluated, and the optimal target adaptation configuration is automatically selected to ensure that the adapted software always meets the safety margin in actual operation. The final generated adaptation strategy can guide the adaptation adjustment and deployment of the software to be migrated in the target operating environment, achieving a seamless transition from simulation to reality and driving the physically controlled object to perform actions as expected. Attached Figure Description
[0049] Figure 1 A flowchart illustrating the software migration and adaptation method based on a world model;
[0050] Figure 2 A flowchart for assessing the stability margin of physically controlled objects and generating adaptation strategies. Detailed Implementation
[0051] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0052] The technical solution of the present invention will be described in detail below with reference to specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0053] Figure 1 This is a flowchart illustrating the software migration and adaptation method based on a world model according to an embodiment of the present invention.
[0054] World model-based software migration and adaptation methods include:
[0055] Acquire execution behavior data of the software to be migrated, response data of the physically controlled objects interacting with the software to be migrated, and characteristic data of the target operating environment;
[0056] A world model is constructed based on execution behavior data and response data. Candidate adaptation configurations are generated based on the differences between execution behavior data and target operating environment characteristic data. The world model simulates the candidate adaptation configurations and outputs the predicted response trajectory and prediction confidence.
[0057] When the prediction confidence level is lower than the preset security judgment condition, a detection command within the security boundary is issued to the physical controlled object, and the actual response data is obtained to correct the world model, thus obtaining the corrected world model.
[0058] The candidate adaptation configurations are simulated using the modified world model to obtain the modified predicted response trajectory. The stability margin requirement of the physically controlled object is transformed into the constraint condition of the predicted response trajectory. Based on the degree of conformity of the modified predicted response trajectory with respect to the constraint condition, the target adaptation configuration is selected from the candidate adaptation configurations to generate an adaptation strategy.
[0059] The software to be migrated is adjusted according to the adaptation strategy to obtain the adapted software. The adapted software is then deployed to the target operating environment and interacts with the physical controlled object to drive the physical controlled object to perform actions.
[0060] Optionally, the software to be migrated is run in the original operating environment. Control command sequences, sending times, task scheduling information, and resource usage data are collected through a log system or bus monitoring device. The state time series of the physically controlled objects are collected through a sensor network or state feedback interface to ensure that the timestamps are synchronized with the software command clock. Standard load tasks are executed in the target operating environment through a benchmark test program to measure the hardware response characteristics and resource constraints of the target platform, such as interrupt response latency, bus bandwidth, processor frequency, and memory capacity, to form a target operating environment characteristic dataset.
[0061] A world model is constructed based on execution behavior data and response data. Candidate adaptation configurations are generated based on the differences between the execution behavior data and the target operating environment characteristic data. The world model simulates the candidate adaptation configurations and outputs the predicted response trajectory and prediction confidence, including:
[0062] Extract the sequence of control commands and the command sending time from the execution behavior data, extract the sequence of physical controlled object state changes and the state acquisition time from the response data, align the command sending time and the state acquisition time in time, establish the pairing relationship between each control command and the corresponding state change to form a command-state sample set, and perform function fitting on the command-state sample set to generate a state transition function as a world model.
[0063] Extract hardware response characteristics and resource constraints from the target operating environment feature data, extract hardware dependency characteristics and resource occupancy conditions from the execution behavior data, calculate the response deviation of hardware response characteristics and hardware dependency characteristics and the capacity deviation of resource constraints and resource occupancy conditions, and generate candidate adaptation configurations based on the response deviation and capacity deviation.
[0064] The candidate adaptation configuration is applied to the control command sequence to generate the correction command sequence. The correction command sequence and the initial state are input into the world model for iterative calculation. At each step, the world model takes the output state of the previous step as the current input state and outputs the predicted state and the deviation value.
[0065] The predicted states from the iterative outputs of the world model are connected to form the predicted response trajectory, and the prediction confidence is obtained by accumulating the deviation values of the iterative outputs.
[0066] When extracting control command sequences from execution behavior data, it is necessary to parse the software operation logs or bus communication records to identify the type, parameter values, and corresponding transmission time of each control command, forming a control command sequence indexed by timestamps. Simultaneously, a state change sequence is extracted from the sensor acquisition records or state feedback interfaces of the physically controlled object. Each state acquisition time corresponds to a set of state vectors describing the physical quantities of the controlled object, such as observables like position, velocity, temperature, or current. Since the transmission times of control commands and state acquisition times usually come from different clock domains or have inconsistent sampling frequencies, the two time series need to be aligned. The specific method for time alignment is to use the control command transmission time as a reference and find the nearest acquisition time in the state change sequence, or to resample the state sequence to the same time resolution as the command sequence through linear interpolation. This establishes a one-to-one correspondence between each control command and the state change of the physically controlled object after its trigger, forming a command-state sample set.
[0067] When performing function fitting on the command-state sample set, each sample record is considered as an input-output pair, where the input is the current control command and the current state, and the output is the state at the next moment. Let the current state be... The current control command is The state at the next moment is The fitting objective of the state transition function is to find the mapping relationship. This minimizes the error between the function output and the next state measured in the sample set. Function fitting can employ methods such as multinomial regression, Gaussian process regression, or neural networks, the specific choice depending on the dynamic complexity of the physically controlled object. For linear or approximately linear controlled objects, multinomial regression can capture the state transition patterns well; for controlled objects with nonlinear and strongly coupled characteristics, neural network fitting is preferred to ensure model accuracy. The state transition function obtained after fitting constitutes the core of the world model, representing a mathematical description of the dynamic behavior of the physically controlled object.
[0068] During the candidate adaptation configuration generation phase, hardware response characteristics are extracted from the target runtime environment feature data, including the target platform's interrupt response latency, communication bus bandwidth, and actuator driver interface response time constant. Simultaneously, resource constraints are extracted, including the target platform's processor frequency, memory capacity, and real-time task scheduling cycle. Hardware dependency characteristics of the software to be migrated in the original runtime environment are extracted from execution behavior data, including the software's assumed interrupt response time, peak bus bandwidth usage, and expected actuator interface response time; as well as resource usage conditions, including the software's CPU utilization, memory usage, and task scheduling cycle configuration in the original environment. The hardware response characteristics of the target environment are subtracted from the software's hardware dependency characteristics item by item to obtain the response deviation; the resource constraints of the target environment are compared with the software's resource usage conditions item by item to obtain the capacity deviation. The response deviation reflects the difference in timing response between the target and original environments, while the capacity deviation reflects the degree of surplus or deficiency in resource supply in the target environment relative to the software's needs. Based on response deviation and capacity deviation, a set of candidate adaptation configurations is generated. Each candidate configuration is a specific combination of values for adjustable items such as software control parameters, scheduling cycle, and instruction compensation amount. The aim is to compensate for the impact of environmental differences on software behavior by adjusting these parameters.
[0069] When applying candidate adaptation configurations to the original control command sequence, for each candidate configuration, the command parameters or command transmission timing in the control command sequence are modified. For example, compensation is made for the lead or lag of commands based on response deviations, and the amplitude or frequency of commands is scaled based on capacity deviations, thereby generating a modified command sequence. The modified command sequence represents the actual flow of control commands issued by the software to the physical controlled object when running in the target operating environment according to the candidate configuration. The modified command sequence, along with the initial state of the physical controlled object, is input into the world model and iteratively calculated according to time steps. In each iteration step, the predicted state output from the previous step is... As the input state for the current step, along with the correction instructions for the current step. Substituting into the state transition function, we obtain the predicted state for the current step. and the corresponding deviation value Deviation value The uncertainty arises from the state transition function's estimation of the input region during fitting. For example, Gaussian process regression directly outputs the prediction variance, while neural networks can estimate the prediction uncertainty through ensemble prediction or Monte Carlo dropout.
[0070] After the iterative calculation is completed, the predicted state output at each step will be... Connecting these parameters chronologically forms a complete predicted response trajectory, which describes the expected state evolution of the physically controlled object under the target operating environment according to the candidate adaptation configuration. The deviation values of each step are accumulated to obtain the prediction confidence level corresponding to that candidate configuration. ,Right now ,in Total number of iterations. Prediction confidence. The larger the value, the higher the uncertainty of the world model's prediction under that candidate configuration, and the lower the reliability of the predicted response trajectory. By performing the above iterative simulation process on each candidate adaptation configuration, the set of predicted response trajectories and the set of prediction confidence scores corresponding to each candidate configuration can be obtained, providing a quantitative basis for subsequent security determination and configuration selection.
[0071] In real-world engineering scenarios, physically controlled objects may involve multiple coupled state components. For example, a robotic arm may simultaneously possess multidimensional states such as joint angles, angular velocities, and torques. In such cases, the input and output of the state transition function are both multidimensional vectors. During fitting, it is necessary to normalize the dimensions of each state component to avoid bias in the fitting result towards the component with the larger numerical value due to differences in dimensions. For multidimensional state scenarios, the bias value... Similarly, when the prediction confidence is calculated by accumulating the output in vector form, the weighted norm of the deviation of each dimension can be taken as the scalarized single-step deviation. The weight coefficients are preset according to the importance of each state component to the safe operation of the controlled object, so that the prediction confidence can comprehensively reflect the overall uncertainty level of the multi-dimensional state prediction.
[0072] The world model is generated by fitting a function to a set of instruction-state samples to produce a state transition function, which includes:
[0073] The response delay is identified from the instruction-state sample set as the time difference between the sending time of each control instruction and the time when the state change of the corresponding physical controlled object occurs. The response delay distribution characteristics corresponding to different instruction types are statistically analyzed, and the response delay distribution characteristics are encoded into a delay embedding vector. The delay embedding vector is concatenated with the instruction parameters of the control instruction to form a delay-aware input feature vector.
[0074] A multi-layer neural network consisting of an encoding layer, a state prediction layer, and a delay prediction layer is constructed as the state transition function. The encoding layer receives the delay-aware input feature vector and extracts the state transition pattern. The state prediction layer outputs the predicted state change based on the state transition pattern, and the delay prediction layer outputs the predicted delay based on the state transition pattern.
[0075] Calculate the state deviation between the predicted state change and the state change of the physical controlled object in the command-state sample set, as well as the time delay deviation between the prediction delay and the response delay. Based on the weighted combination of the state deviation and the time delay deviation, adjust the connection weights of the encoding layer, the state prediction layer and the delay prediction layer in the multilayer neural network in reverse. Repeat the training until the state deviation and the time delay deviation converge simultaneously to generate a state transition function as the world model.
[0076] After obtaining the instruction-state sample set, it is necessary to deeply analyze the temporal relationships within it to extract the inherent delay characteristics of the physical controlled object in responding to control instructions. Specifically, for each record in the sample set, the difference between the actual time the control instruction is issued and the time when the observable change in the state of the physical controlled object occurs is identified; this difference represents the response delay of that interaction. This delay is not a fixed constant but exhibits statistical distribution characteristics depending on the instruction type, instruction magnitude, and the current working state of the controlled object. Therefore, the response delay is grouped and statistically analyzed according to instruction type, and the mean, variance, quantiles, and other distributional characteristics of the delay under each type are calculated to form a delay distribution feature description that can characterize the response rhythm of this type of instruction.
[0077] The aforementioned delay distribution features are transformed into fixed-dimensional delay embedding vectors through a learnable embedding mapping. The purpose of these delay embedding vectors is to compress statistically significant temporal distribution information into a dense representation that the neural network can directly process, enabling the network to perceive the temporal differences between different instruction types when learning state transition patterns. The delay embedding vectors are then concatenated with the instruction parameters of the current control instruction (including numerical features such as instruction type encoding, amplitude, and direction) along the feature dimension to obtain a delay-aware input feature vector. This concatenation method fuses spatial domain instruction information with temporal domain delay information into a unified input representation, providing a foundation for subsequent joint modeling of the network.
[0078] A multi-layer neural network is constructed as the state transition function. This network consists of three functional modules: an encoding layer, a state prediction layer, and a delay prediction layer. The encoding layer receives the delay-aware input feature vector and, through multi-layer fully connected transformations and non-linear activations, compresses the high-dimensional input into a low-dimensional state transition pattern vector. This vector centrally expresses the core dynamic features of the controlled object's state changes under the current command. The state prediction layer takes the state transition pattern vector as input and outputs the predicted value of the physical controlled object's state change, i.e., the predicted state change. The delay prediction layer also takes the state transition pattern vector as input and outputs the predicted value of the delay in the response to the current command, i.e., the predicted delay. The encoding layer acts as a shared feature extractor for the two prediction layers, enabling state change prediction and delay prediction to be collaboratively optimized within the same feature space, avoiding feature redundancy and information fragmentation problems that occur when the two are modeled independently.
[0079] During network training, a joint loss function needs to be constructed that simultaneously reflects the accuracy of state prediction and the accuracy of delay prediction. Let the difference between the predicted state change and the actual recorded state change of the physically controlled object in the sample set be called the state bias, and let the difference between the predicted delay and the response delay statistically obtained from the sample set be called the delay bias. The joint loss is a weighted combination of the state bias term and the delay bias term, specifically expressed as follows: ,in For state deviation loss, For time delay deviation loss, and These are the state deviation weighting coefficient and the time delay deviation weighting coefficient, respectively. Their values are set based on the relative sensitivity of the actual physical controlled object to state accuracy and timing accuracy. When the controlled object has strict requirements for response timing (such as in high-speed motion control scenarios), these values can be appropriately increased. The proportion; when the controlled object has higher requirements for the accuracy of state variables (such as in precision position control scenarios), the proportion should be appropriately increased. The percentage.
[0080] Based on joint loss The gradient of the loss with respect to the connection weights in the encoding layer, state prediction layer, and delay prediction layer is calculated using the backpropagation algorithm, and the weights are updated using an adaptive learning rate optimization method. Since the gradient of the encoding layer originates from both the state prediction layer and the delay prediction layer, the encoding layer is naturally forced to extract common features beneficial to both prediction tasks during training, thus forming a more comprehensive representation of the state transition pattern. During training, the state deviation is monitored after each iteration. With time delay deviation The training is considered convergent only when both the state prediction accuracy and delay prediction accuracy no longer decrease significantly in several consecutive iterations. Training is then stopped, and the network parameters at this point are fixed as the final state transition function. This dual convergence criterion ensures that the generated world model achieves a stable and usable level in both state prediction accuracy and delay prediction accuracy, rather than overfitting in only one dimension.
[0081] The state transition function obtained through the above training process constitutes the core component of the world model. During subsequent simulations of candidate adaptation configurations, the control command sequence generated under each candidate adaptation configuration is sequentially input into this state transition function. The state prediction layer outputs the predicted state change at each step, and the delay prediction layer outputs the predicted delay at each step, thus constructing a complete predicted response trajectory. The introduction of prediction delay information ensures that the predicted response trajectory includes not only the sequence of state changes but also the predicted time of each state change, thereby providing a more accurate depiction of the dynamic behavior of the physically controlled object on the timeline. This is particularly important for physically controlled objects requiring strict timing guarantees (such as joint control in industrial robots and precision transmission mechanisms), because in these scenarios, even if the state prediction is accurate, deviations in timing prediction can lead to a mismatch between the command sequence issued by the adapted software and the actual response rhythm of the controlled object, potentially causing control instability. By directly embedding the delay characteristics into the modeling structure of the world model, rather than adding them as a post-processing compensation term, the reliability of the adaptation strategy at the timing level can be fundamentally guaranteed.
[0082] The world model is revised by obtaining actual response data, resulting in the revised world model, which includes:
[0083] The detection command is input into the world model and the physical controlled object respectively. The predicted response data is obtained from the world model and the actual response data is obtained from the physical controlled object. The response deviation between the predicted response data and the actual response data is calculated. When the response deviation exceeds the preset allowable threshold, the corresponding detection command, predicted response data and actual response data are marked as inaccurate samples.
[0084] The detection commands from the inaccurate samples are re-inputted into the world model and the extrapolation process is tracked. The network layer that contributes the most to the response bias during the extrapolation process is identified as the inaccurate network layer. The detection commands from the inaccurate samples and the actual response data are used to construct a corrected sample set.
[0085] The corrected sample set is input into the misaligned network layer for training. The connection weights of the misaligned network layer are adjusted according to the error between the actual response data and the output of the misaligned network layer. The connection weights of the other network layers are frozen. The training is repeated until the error converges. The world model with the updated connection weights is used as the corrected world model.
[0086] After receiving the detection command within the safety boundary, the command is simultaneously input into both the world model and the physical controlled object, resulting in two separate response paths. The world model uses its internal state transition network to perform forward extrapolation of the detection command, outputting predicted response data. The physical controlled object executes the detection command under actual operating conditions, returning real sensor data and actuator feedback, forming actual response data. The predicted and actual response data are aligned point-by-point over time, and the response deviation between them is calculated. The measurement of response deviation considers both amplitude and phase deviation, comparing the weighted cumulative value of the deviation at each time step with a preset tolerance threshold. When the response deviation exceeds the preset tolerance threshold, it indicates a significant inaccuracy in the world model within the operating range covered by the detection command. The corresponding detection command, predicted response data, and actual response data are collectively marked as inaccurate samples and included in subsequent correction processes. When the response deviation does not exceed the preset tolerance threshold, this data indicates that the world model has sufficient prediction accuracy under the current operating conditions, requiring no correction and remaining only as a verification sample.
[0087] After identifying the inaccurate samples, the probe commands from these samples are re-inputted into the world model, and the intermediate outputs of each network layer during the extrapolation process are recorded using a layer-by-layer activation tracking method. For each network layer in the world model, the gradient contribution of each layer's output to the final response deviation is calculated to quantify the proportion of responsibility each layer bears in generating the inaccurate results. Specifically, the deviation between the actual response data and the predicted response data is used as the error signal, propagated back along the network, and the norm of the gradient of each layer's parameters is statistically analyzed. The larger the gradient norm, the higher the sensitivity of the layer's parameters to the deviation, i.e., the greater the contribution of that layer to the response deviation. The network layer with the largest contribution is identified as the inaccurate network layer. The inaccurate network layer usually corresponds to the key sub-network in the world model responsible for capturing the nonlinear dynamic characteristics of the physically controlled object, and its parameters are most prone to systematic deviations when the operating conditions of the target environment shift. After locating the inaccurate network layer, the probe commands from the inaccurate samples are used as input, and the corresponding actual response data is used as supervision labels to construct a correction sample set, providing a data foundation for subsequent targeted training.
[0088] After the corrected sample set is constructed, the targeted training phase for the misaligned network layer begins. The connection weights of all network layers in the world model except the misaligned layer are frozen, keeping them constant during training to avoid interfering with already converged and accurate network layers and prevent catastrophic forgetting. Only the connection weights of the misaligned network layer are allowed to participate in gradient updates. Probe commands from the corrected sample set are input into the world model batch by batch, reaching the misaligned network layer via forward propagation through the frozen layer. The error between the output of the misaligned network layer and the corresponding actual response data is used as the training loss signal, driving the connection weights of the misaligned network layer to adjust according to the gradient descent direction. After each training round, the mean training loss of the current batch is calculated and compared with the previous round to determine if the error is converging. This training process is repeated until the error variation within several consecutive rounds falls below the preset convergence threshold or reaches the preset maximum training round limit, at which point training terminates. At this point, the connection weights of the misaligned network layer have been updated, while the connection weights of the remaining network layers remain in their original state. The complete world model with updated connection weights is output as the corrected world model for subsequent simulation verification of candidate adaptation configurations.
[0089] The core advantage of the aforementioned correction mechanism lies in its precise localization and local update design. Traditional full-scale retraining requires training the entire model by mixing all historical and new samples, resulting in high computational costs and a risk of compromising existing modeling accuracy. However, by using gradient contribution analysis to locate inaccurate network layers and then combining this with a freeze strategy for local updates, targeted repair of inaccuracies under specific operating conditions can be achieved with minimal parameter adjustments. In real-world applications, the dynamic characteristics of a physically controlled object may drift within a local operating condition range due to factors such as temperature, load, and mechanical wear in the target's operating environment. The overall structure of the world model remains valid, and prediction accuracy can be restored simply by correcting the specific network layers that perceive the drift. This mechanism also ensures that the correction process is minimally invasive to the physically controlled object; the detection commands used are always confined within safe boundaries, posing no risk to the normal operation of the physically controlled object.
[0090] After the local weight update, the revised world model effectively improves the modeling accuracy of the dynamic characteristics of physically controlled objects in the target operating environment. It can more accurately predict the response trajectory of candidate adaptation configurations after actual deployment, thereby providing a reliable simulation basis for the subsequent selection of target adaptation configurations and reducing the risk of deviation in the adaptation strategy during the actual deployment stage.
[0091] like Figure 2 The diagram illustrates the flowchart for evaluating the stable operation margin of the physically controlled object and generating the adaptation strategy according to the present invention.
[0092] The stability margin requirements of the physically controlled object are transformed into constraints for the predicted response trajectory. Based on the degree to which the modified predicted response trajectory conforms to the constraints, a target adaptation configuration is selected from the candidate adaptation configurations, and the adaptation strategy is generated, including:
[0093] Obtain the limits on the amplitude of state fluctuations and the limits on the rate of state change from the design specification documents of the physically controlled object as the stability margin requirements for the physical controlled object;
[0094] The state fluctuation amplitude limit is transformed into upper and lower limits of the state value in the corrected predicted response trajectory, and the state change rate limit is transformed into gradient constraints of the change amount of adjacent states in the corrected predicted response trajectory. The upper limit constraint, lower limit constraint and gradient constraint are combined to form the constraint conditions.
[0095] Calculate the number and magnitude of default points that exceed the upper limit constraint, lower limit constraint, and gradient constraint in each corrected predicted response trajectory, and calculate the compliance score of each corrected predicted response trajectory based on the number and magnitude of default points.
[0096] The adaptation configuration corresponding to the corrected predicted response trajectory with the highest conformity score is selected as the target adaptation configuration. The target adaptation configuration is then converted into parameter adjustment instructions and resource allocation instructions for the software to be migrated to generate an adaptation strategy.
[0097] Extracting stability margin requirements from the design specifications of physically controlled objects is a crucial prerequisite for transforming engineering constraints into calculable criteria. Design specifications typically include the equipment's rated operating range, safety protection thresholds, and dynamic response indicators. Among these, the state fluctuation amplitude limit describes the maximum allowable deviation of each state variable (such as temperature, speed, pressure, and current) from its baseline value during normal operation. This limit directly stems from the equipment's physical tolerance boundaries or process quality requirements. The state change rate limit describes the maximum permissible amplitude of state variable changes between adjacent sampling times, reflecting the controlled object's ability to withstand rapid disturbances. Excessive state change rates often lead to problems such as mechanical shock, thermal fatigue, or control instability. By analyzing the design specifications, these two types of indicators are extracted in numerical form, providing a quantitative basis for constructing subsequent constraints.
[0098] To address the limitation on the amplitude of state fluctuations, it is transformed into upper and lower bound constraints on the state values at each moment in the corrected predicted response trajectory. Let the allowable upper bound of fluctuation for a certain state dimension be... Allowing fluctuations to have a lower bound of 1. Then, the predicted state value of the corrected predicted response trajectory at each time step in this dimension must satisfy... ,in This indicates that the state dimension is at the 1st level. The state values for each prediction step are given. To address the rate of state change constraint, it is transformed into a gradient constraint on the amount of state change between adjacent prediction steps. Let the maximum allowable rate of state change be... Then the state difference between adjacent prediction steps must satisfy ,in Indicates the first The state values of each prediction step. When the controlled object has multiple state dimensions, the above constraints are applied independently to each dimension. The upper limit constraint, lower limit constraint, and gradient constraint are combined to form a complete set of constraints, thereby mapping the engineering margin requirements to verifiable criteria at the trajectory level.
[0099] After obtaining the constraints, a compliance score relative to the constraints is calculated for each corrected predicted response trajectory. Specifically, each prediction step in the trajectory is traversed, and it is determined whether the state value at that moment violates the upper bound constraint, lower bound constraint, or gradient constraint. All prediction steps that violate the constraints are recorded as violation points. The number of violation points reflects the overall frequency of trajectory violations, while the violation magnitude measures the degree to which each violation point deviates from the constraint boundary. Let the th... The set of default points for each candidate trajectory is For the set of the first Each default point is denoted as a default margin. This represents the absolute deviation of the predicted state value from the corresponding constraint boundary. (Compliance score) Taking into account both the number of default points and the magnitude of default, it can be expressed as:
[0100]
[0101] in This is used as a reference for normalization, to unify the dimensions of the default magnitude to between 0 and 1. To prevent extremely small positive numbers with a denominator of zero, For the first The total number of default points in the trajectory. The set of default points is empty when the trajectory fully satisfies all constraints. Taking the maximum value of 1 indicates that the constraints are fully met; the more default points there are, the greater the default magnitude. The lower the score, the worse the operational safety of the adaptation configuration corresponding to the trajectory on the physically controlled object. A compliance score is calculated for each corrected predicted response trajectory corresponding to all candidate adaptation configurations to obtain a score sequence, which is then used to rank the candidate adaptation configurations.
[0102] Select compliance score The candidate adaptation configuration corresponding to the highest corrected predicted response trajectory is used as the target adaptation configuration. The target adaptation configuration exists in the form of a structured parameter set, containing various adjustable parameter values required for software operation, such as control cycle, sampling rate, filter cutoff frequency, and gain coefficient. When converting the target adaptation configuration into an adaptation strategy, the parameter values need to be decomposed into two types of specific instructions: parameter adjustment instructions and resource allocation instructions. Parameter adjustment instructions specify the target value to be modified for each parameter's control logic parameters in the software to be migrated, and provide the execution order of parameter modifications to avoid inconsistencies in intermediate states due to parameter dependencies. Resource allocation instructions specify the resource limits and priorities allocated to each functional module of the software to be migrated, including computing resources, communication bandwidth, and memory quotas in the target operating environment, ensuring that the actual execution sequence of the software in the target operating environment matches the predictive assumptions in the world model.
[0103] When generating parameter adjustment instructions, the impact of hardware differences between the target and original operating environments on software behavior must also be considered. For example, if the processor frequency of the target operating environment is lower than that of the original environment, the control cycle parameter may need to be extended accordingly to ensure that the control algorithm can complete the calculation in each cycle; if the communication bus latency of the target operating environment is high, the sampling rate parameter may need to be appropriately reduced to avoid control lag caused by data backlog. These adjustment logics have all been considered in the generation stage of candidate adaptation configurations through difference analysis between execution behavior data and target operating environment feature data. The parameter values in the target adaptation configuration have already internalized the compensation amount for the above-mentioned environmental differences. Therefore, parameter adjustment instructions can be directly generated based on the parameter values in the target adaptation configuration without the need for manual correction of environmental differences again in the instruction generation stage.
[0104] The generation of resource allocation instructions relies on the resource topology description in the target operating environment's characteristic data. Based on the load capacity, memory bandwidth, and communication interface throughput limits of each processing core in the target operating environment, each functional subtask of the software to be migrated is mapped to a corresponding resource unit, and a resource quota is set for each subtask. The resource quota setting must meet two conditions: first, the sum of the resource requirements of all subtasks does not exceed the total resource supply of the target operating environment; second, subtasks on the critical control path receive sufficient resource priority to ensure their execution latency meets the real-time requirements of the control cycle. The parameter adjustment instructions and resource allocation instructions are arranged according to their execution dependencies to form an ordered adaptation strategy. Subsequent adjustments to the software to be migrated according to this strategy result in adapted software capable of safely driving physically controlled objects in the target operating environment.
[0105] The conformity score for each revised predicted response trajectory is calculated based on the number of default points and the magnitude of defaults, including:
[0106] Traverse the default points in each corrected predicted response trajectory, select the corresponding constraint boundary according to the type of constraint violated by the default point, calculate the deviation distance between the default point and the corresponding constraint boundary as the single-point default amount, and sum up the single-point default amounts of each default point after normalization to obtain the cumulative default magnitude.
[0107] The proportion of default points in each corrected predicted response trajectory to the total number of predicted states is used as the default point density. A weighted combination function of cumulative default magnitude and default point density is constructed, and the cumulative default magnitude and default point density are mapped to default penalty values through the weighted combination function.
[0108] The difference between the preset benchmark score and the default penalty value is used to obtain the conformity score of each corrected predicted response trajectory.
[0109] After simulating candidate fit configurations using the corrected world model, each corrected predicted response trajectory needs to be quantitatively scored to determine its compliance with constraints. This scoring process uses the distribution and deviation of violation points as core inputs, and a structured computational workflow transforms the constraint violation status of the trajectory into a numerical indicator that can be directly used for configuration selection.
[0110] Iterate through each predicted state point in a corrected predicted response trajectory and determine if there is a constraint violation at that state point. Constraint types typically include three categories: upper bound amplitude constraints, lower bound amplitude constraints, and rate of change constraints. Different types of constraints correspond to different boundary reference values. For upper bound amplitude constraints, the corresponding constraint boundary is the maximum allowable amplitude in that state dimension; for lower bound amplitude constraints, the corresponding constraint boundary is the minimum allowable amplitude in that state dimension; and for rate of change constraints, the corresponding constraint boundary is the maximum allowable rate of change in the state. When a state point is detected to have violated a constraint, extract the actual value of that state point in the corresponding constraint dimension, calculate the absolute difference between this value and the selected constraint boundary, and use this absolute difference as the single-point violation amount for that point in that constraint dimension, reflecting the original distance of that point from the compliant region.
[0111] Because the dimensions and numerical ranges of different constraint dimensions differ, directly summing the original individual default values for each default point can lead to a disproportionately dominant influence of dimensions with larger dimensions on the overall score. To eliminate the difference in dimensions, the individual default value for each default point is normalized. Let the individual default value for a certain default point be... The reference range used for normalization is To prevent the introduction of extremely small positive numbers when the denominator is zero. Then the normalized single-point default value at that default point for The cumulative default magnitude of the trajectory is obtained by summing the normalized single-point default values of all default points in a corrected predicted response trajectory. ,Right now The summation range covers all default points in the trajectory. Cumulative default magnitude. It reflects the total amount of deviation of the trajectory from the constraint boundary during the overall prediction process. The larger the value, the more severe the cumulative drift of the trajectory outside the constraint range.
[0112] Relying solely on the cumulative default magnitude is insufficient to fully characterize the constraint compliance of a trajectory. For example, one trajectory may experience significant defaults only at a few moments, while another trajectory may experience minor defaults at numerous moments. Their cumulative default magnitudes may be similar, but their impact on the stable operation of the physically controlled object will be drastically different. To capture the density of default points along the time axis, a default point density index is introduced. Let the total number of predicted states for a modified predicted response trajectory be... The number of default points in this trajectory is Then the density of default points Defined as The range of values is .when near When this occurs, it indicates that the trajectory is in a constraint violation state for the vast majority of prediction times, and the risk of the physically controlled object continuously being in an unsafe region under this configuration is extremely high; when near This indicates that the breach of contract only occurred at very few moments, and the overall trajectory quality was relatively good.
[0113] Constructing cumulative default margin With default point density The weighted combination function merges the two into a single default penalty value. Let the weighting factor for the cumulative default rate be... The weighting coefficient for the density of default points is Then the penalty value for breach of contract The calculation method is as follows Weighting coefficients and The value is set based on the relative sensitivity of the physically controlled object to the magnitude and frequency of default. For physically controlled objects with high inertia, insensitive to transient shocks but highly sensitive to sustained deviations, the value can be appropriately increased. The proportion can be appropriately increased for physically controlled objects with fast response times and low tolerance for frequent defaults. The weighting function maps default information from both dimensions to the same numerical space, making the default penalty values of different trajectories directly comparable.
[0114] After obtaining the penalty value for breach of contract Next, the preset benchmark score will be set. With default penalty value Perform the interpolation operation to obtain the conformity score of the corrected predicted response trajectory. ,Right now Benchmark score This represents the maximum score that can be obtained from the trajectory under completely non-default conditions. Its value is preset according to the scoring range required in the specific application scenario. A typical value can be set to . When a trajectory fully satisfies all constraints, its cumulative default magnitude is... With default point density All Default penalty value Also Compliance score equal to the benchmark score This indicates that the trajectory fully meets the stability margin requirements of the physically controlled object. As the penalty value for breach increases, the compliance score... The value decreases accordingly, until it becomes negative, indicating that the trajectory corresponding to the candidate adaptation configuration deviates significantly from the constraint requirements and is not qualified to be selected as the target adaptation configuration.
[0115] After calculating the compliance score for the corrected predicted response trajectory corresponding to all candidate adaptation configurations, the compliance score is then used to determine the appropriate matching criteria. The candidate adaptation configurations are sorted from highest to lowest conformity score. The candidate adaptation configuration with the highest conformity score is the optimal target adaptation configuration, whose corresponding corrected predicted response trajectory exhibits the best overall performance under constraints, ensuring the stable operation of the physically controlled object under software-driven conditions after migration to the greatest extent possible. When the conformity scores of multiple candidate adaptation configurations are close, other auxiliary indicators (such as prediction confidence or trajectory smoothness) can be combined for further screening to ultimately determine a unique target adaptation configuration and generate the corresponding adaptation strategy.
[0116] The software to be migrated is adjusted according to the adaptation strategy to obtain adapted software. The adapted software is then deployed to the target runtime environment and interacts with the physical controlled object to drive the physical controlled object to perform actions, including:
[0117] The parameter adjustment instructions and resource allocation instructions in the adaptation strategy are parsed. Based on the parameter adjustment instructions and resource allocation instructions, the configuration of the software to be migrated is modified and resources are reallocated to obtain the adapted software. The adapted software is then deployed to the target runtime environment and started.
[0118] When the adapted software sends control commands to the physical controlled object, it synchronously inputs the control commands and the current state of the physical controlled object into the modified world model for real-time simulation. The modified world model outputs the expected response data of the corresponding control commands. After receiving the control commands, the physical controlled object executes the actions and returns the actual response data. The real-time deviation between the expected response data and the actual response data is calculated.
[0119] When the real-time deviation exceeds the preset deviation threshold, the control command and actual response data are input into the corrected world model to track the simulation path, identify the parameter mismatch items in the simulation path that cause the real-time deviation, generate parameter correction commands based on the parameter mismatch items, adjust the operating parameters of the adapted software according to the parameter correction commands, and the adjusted adapted software continues to send subsequent control commands to the physical controlled object.
[0120] After selecting the target adaptation configuration and generating the adaptation strategy, the software enters the actual deployment and online operation phase. The adaptation strategy typically consists of two types of instructions: parameter adjustment instructions and resource allocation instructions. Parameter adjustment instructions record the software configuration items that need to be modified and their target values, such as control cycle, communication timeout threshold, data sampling rate, filter cutoff frequency, and other specific parameters that match the target operating environment. Resource allocation instructions describe the computing resources, memory quotas, thread priorities, and scheduling strategies allocated to the software to be migrated in the target operating environment. After parsing these two types of instructions, the configuration file or runtime parameter table of the software to be migrated is modified item by item according to the parameter adjustment instructions. Simultaneously, according to the resource allocation instructions, operations such as memory space allocation, CPU core binding, and I / O channel reservation are completed in the target operating environment, resulting in the adapted software. After completing the above configuration modifications and resource reallocation, the adapted software is deployed to the target operating environment and the startup process is executed, including initializing the runtime environment, loading configuration parameters, establishing a communication link with the physically controlled object, and completing a self-check process to confirm that the adapted software has entered a normal operating state.
[0121] After adaptation, the software continuously sends control commands to the physically controlled object during operation. Each time a control command is generated, the current state of the physically controlled object is synchronously read. The control command and the current state are input into the modified world model, which performs real-time simulations and outputs the expected response data for that control command. The expected response data covers the trajectory of the expected state changes of the physically controlled object after receiving the control command, including the predicted values of each key state dimension at several subsequent time points. Simultaneously, the physically controlled object executes the corresponding action after receiving the control command and returns the actual response data through sensors or feedback interfaces. After aligning the timestamps of the actual response data and the expected response data, the difference between the two is calculated dimension by dimension. The differences in each dimension are then weighted and aggregated to obtain the real-time deviation. The real-time deviation reflects the accuracy of the modified world model's prediction of the current operating state and indirectly characterizes the degree of agreement between the parameter configuration of the adapted software and the actual dynamic characteristics of the physically controlled object.
[0122] Let the calculation result of the real-time deviation be The preset deviation threshold is .when At that time, it was assumed that the interaction between the adapted software and the physically controlled object was within the normal range. The adapted software continued to run according to the current parameters and sent subsequent control commands. The corrected world model continued to perform real-time simulations to maintain online monitoring. When this occurs, the parameter mismatch identification process is triggered.
[0123] After triggering the parameter mismatch identification process, the control command that caused the real-time deviation to exceed the limit, along with its corresponding actual response data, is re-input into the corrected world model. This causes the corrected world model to trace the deduction path from the moment the control command was executed. The process of tracing the deduction path involves using the actual response data as a new initial state to drive the corrected world model forward step by step, while simultaneously comparing it with the intermediate states of the corrected world model on the original deduction path. By comparing the original deduction path with the re-deduction path starting from the actual response data, the time nodes and state dimensions where the two paths significantly diverge are gradually located. At the divergence node, the parameter terms associated with that state dimension within the corrected world model are extracted. The differences between the current values of these parameter terms and the values required for the actual response data to match the deduction results are analyzed. Parameter terms with differences exceeding the allowable range are marked as parameter mismatch terms. Parameter mismatch terms may involve various types, such as control gain, response delay compensation, actuator dead zone width, and sensor calibration bias. Each type of parameter mismatch term corresponds to different adjustment directions and adjustment magnitudes.
[0124] After identifying parameter mismatches, parameter correction instructions are generated based on the direction and magnitude of each mismatch. These instructions are expressed incrementally, meaning the correction amount is added to the current operating parameters of the adapted software to prevent large jumps that could cause unstable responses in the physically controlled object. Let the current operating parameter value corresponding to a certain parameter mismatch be... The target correction value obtained from the tracking and deduction path analysis is The corrected increment is then... To prevent excessively large corrections, a limit is imposed on the correction increment; the actual correction amount issued is... ,in This is the preset maximum correction range per operation. The correction will be performed according to the parameter correction command. The updated parameters are then superimposed onto the corresponding operating parameters of the adapted software to complete the online parameter adjustment. After adjustment, the adapted software continues to send subsequent control commands to the physical controlled object with the updated operating parameters. The corrected world model synchronously re-establishes the simulation baseline with the updated parameter state, and subsequent calculations of real-time deviations will be based on the updated expected response data.
[0125] The aforementioned online adjustment mechanism forms a closed-loop feedback loop: after adaptation, the software sends control commands; the corrected world model simulates the expected response in real time; the physical controlled object returns the actual response; real-time deviations are calculated; if the deviation exceeds the limit, parameter mismatches are identified and correction commands are generated; and operation continues after adjusting the operating parameters. This loop operates continuously throughout the entire lifecycle of the adapted software, enabling it to adaptively adjust parameters in the target operating environment according to subtle changes in the dynamic characteristics of the physical controlled object, maintaining effective control over the object and ensuring that it continues to perform the expected actions within a stable operating margin. During online adjustment, the historical record of each parameter correction is saved and can be used to further update the corrected world model, allowing the predictive ability of the world model to continuously improve with the accumulation of operating time.
[0126] A second aspect of this invention provides a software migration and adaptation system based on a world model, comprising:
[0127] The data acquisition unit is used to acquire the execution behavior data of the software to be migrated, the response data of the physically controlled objects that interact with the software to be migrated, and the characteristic data of the target operating environment.
[0128] The model simulation unit is used to build a world model based on execution behavior data and response data, generate candidate adaptation configurations based on the differences between execution behavior data and target operating environment feature data, simulate the candidate adaptation configurations by the world model, and output the predicted response trajectory and prediction confidence.
[0129] The model correction unit is used to issue a detection command within the safety boundary to the physical controlled object when the prediction confidence is lower than the preset safety judgment condition, obtain the actual response data to correct the world model, and obtain the corrected world model.
[0130] The strategy generation unit is used to simulate candidate adaptation configurations using the modified world model to obtain the modified predicted response trajectory. It transforms the stability margin requirement of the physically controlled object into the constraint condition of the predicted response trajectory. Based on the degree of conformity of the modified predicted response trajectory with respect to the constraint condition, it selects the target adaptation configuration from the candidate adaptation configurations and generates the adaptation strategy.
[0131] The deployment and implementation unit is used to adjust the software to be migrated according to the adaptation strategy to obtain the adapted software, deploy the adapted software to the target operating environment and interact with the physical controlled object to drive the physical controlled object to perform actions.
[0132] A third aspect of the present invention provides an electronic device, comprising:
[0133] processor;
[0134] Memory used to store processor-executable instructions;
[0135] The processor is configured to invoke instructions stored in the memory to execute the aforementioned method.
[0136] A fourth aspect of the present invention provides a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement the aforementioned method.
[0137] This invention can be a method, apparatus, system, and / or computer program product. The computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for performing various aspects of the invention.
[0138] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A software migration and adaptation method based on a world model, characterized in that, include: Acquire execution behavior data of the software to be migrated, response data of the physically controlled objects interacting with the software to be migrated, and characteristic data of the target operating environment; A world model is constructed based on execution behavior data and response data. Candidate adaptation configurations are generated based on the differences between execution behavior data and target operating environment characteristic data. The world model simulates the candidate adaptation configurations and outputs the predicted response trajectory and prediction confidence. When the prediction confidence level is lower than the preset security judgment condition, a detection command within the security boundary is issued to the physical controlled object, and the actual response data is obtained to correct the world model, thus obtaining the corrected world model. The candidate adaptation configurations are simulated using the modified world model to obtain the modified predicted response trajectory. The stability margin requirement of the physically controlled object is transformed into the constraint condition of the predicted response trajectory. Based on the degree of conformity of the modified predicted response trajectory with respect to the constraint condition, the target adaptation configuration is selected from the candidate adaptation configurations to generate an adaptation strategy. The software to be migrated is adjusted according to the adaptation strategy to obtain the adapted software. The adapted software is then deployed to the target operating environment and interacts with the physical controlled object to drive the physical controlled object to perform actions.
2. The method according to claim 1, characterized in that, A world model is constructed based on execution behavior data and response data. Candidate adaptation configurations are generated based on the differences between the execution behavior data and the target operating environment characteristic data. The world model simulates the candidate adaptation configurations and outputs the predicted response trajectory and prediction confidence, including: Extract the sequence of control commands and the command sending time from the execution behavior data, extract the sequence of physical controlled object state changes and the state acquisition time from the response data, align the command sending time and the state acquisition time in time, establish the pairing relationship between each control command and the corresponding state change to form a command-state sample set, and perform function fitting on the command-state sample set to generate a state transition function as a world model. Extract hardware response characteristics and resource constraints from the target operating environment feature data, extract hardware dependency characteristics and resource occupancy conditions from the execution behavior data, calculate the response deviation of hardware response characteristics and hardware dependency characteristics and the capacity deviation of resource constraints and resource occupancy conditions, and generate candidate adaptation configurations based on the response deviation and capacity deviation. The candidate adaptation configuration is applied to the control command sequence to generate the correction command sequence. The correction command sequence and the initial state are input into the world model for iterative calculation. At each step, the world model takes the output state of the previous step as the current input state and outputs the predicted state and the deviation value. The predicted states from the iterative outputs of the world model are connected to form the predicted response trajectory, and the prediction confidence is obtained by accumulating the deviation values of the iterative outputs.
3. The method according to claim 2, characterized in that, The world model is generated by fitting a function to a set of instruction-state samples to produce a state transition function, which includes: The response delay is identified from the instruction-state sample set as the time difference between the sending time of each control instruction and the time when the state change of the corresponding physical controlled object occurs. The response delay distribution characteristics corresponding to different instruction types are statistically analyzed, and the response delay distribution characteristics are encoded into a delay embedding vector. The delay embedding vector is concatenated with the instruction parameters of the control instruction to form a delay-aware input feature vector. A multi-layer neural network consisting of an encoding layer, a state prediction layer, and a delay prediction layer is constructed as the state transition function. The encoding layer receives the delay-aware input feature vector and extracts the state transition pattern. The state prediction layer outputs the predicted state change based on the state transition pattern, and the delay prediction layer outputs the predicted delay based on the state transition pattern. Calculate the state deviation between the predicted state change and the state change of the physical controlled object in the command-state sample set, as well as the time delay deviation between the prediction delay and the response delay. Based on the weighted combination of the state deviation and the time delay deviation, adjust the connection weights of the encoding layer, the state prediction layer and the delay prediction layer in the multilayer neural network in reverse. Repeat the training until the state deviation and the time delay deviation converge simultaneously to generate a state transition function as the world model.
4. The method according to claim 1, characterized in that, The world model is revised by obtaining actual response data, resulting in the revised world model, which includes: The detection command is input into the world model and the physical controlled object respectively. The predicted response data is obtained from the world model and the actual response data is obtained from the physical controlled object. The response deviation between the predicted response data and the actual response data is calculated. When the response deviation exceeds the preset allowable threshold, the corresponding detection command, predicted response data and actual response data are marked as inaccurate samples. The detection commands from the inaccurate samples are re-inputted into the world model and the extrapolation process is tracked. The network layer that contributes the most to the response bias during the extrapolation process is identified as the inaccurate network layer. The detection commands from the inaccurate samples and the actual response data are used to construct a corrected sample set. The corrected sample set is input into the misaligned network layer for training. The connection weights of the misaligned network layer are adjusted according to the error between the actual response data and the output of the misaligned network layer. The connection weights of the other network layers are frozen. The training is repeated until the error converges. The world model with the updated connection weights is used as the corrected world model.
5. The method according to claim 1, characterized in that, The stability margin requirements of the physically controlled object are transformed into constraints for the predicted response trajectory. Based on the degree to which the modified predicted response trajectory conforms to the constraints, a target adaptation configuration is selected from the candidate adaptation configurations, and the adaptation strategy is generated, including: Obtain the limits on the amplitude of state fluctuations and the limits on the rate of state change from the design specification documents of the physically controlled object as the stability margin requirements for the physical controlled object; The state fluctuation amplitude limit is transformed into upper and lower limits of the state value in the corrected predicted response trajectory, and the state change rate limit is transformed into gradient constraints of the change amount of adjacent states in the corrected predicted response trajectory. The upper limit constraint, lower limit constraint and gradient constraint are combined to form the constraint conditions. Calculate the number and magnitude of default points that exceed the upper limit constraint, lower limit constraint, and gradient constraint in each corrected predicted response trajectory, and calculate the compliance score of each corrected predicted response trajectory based on the number and magnitude of default points. The adaptation configuration corresponding to the corrected predicted response trajectory with the highest conformity score is selected as the target adaptation configuration. The target adaptation configuration is then converted into parameter adjustment instructions and resource allocation instructions for the software to be migrated to generate an adaptation strategy.
6. The method according to claim 5, characterized in that, The conformity score for each revised predicted response trajectory is calculated based on the number of default points and the magnitude of defaults, including: Traverse the default points in each corrected predicted response trajectory, select the corresponding constraint boundary according to the type of constraint violated by the default point, calculate the deviation distance between the default point and the corresponding constraint boundary as the single-point default amount, and sum up the single-point default amounts of each default point after normalization to obtain the cumulative default magnitude. The proportion of default points in each corrected predicted response trajectory to the total number of predicted states is used as the default point density. A weighted combination function of cumulative default magnitude and default point density is constructed, and the cumulative default magnitude and default point density are mapped to default penalty values through the weighted combination function. The difference between the preset benchmark score and the default penalty value is used to obtain the conformity score of each corrected predicted response trajectory.
7. The method according to claim 1, characterized in that, The software to be migrated is adjusted according to the adaptation strategy to obtain adapted software. The adapted software is then deployed to the target runtime environment and interacts with the physical controlled object to drive the physical controlled object to perform actions, including: The parameter adjustment instructions and resource allocation instructions in the adaptation strategy are parsed. Based on the parameter adjustment instructions and resource allocation instructions, the configuration of the software to be migrated is modified and resources are reallocated to obtain the adapted software. The adapted software is then deployed to the target runtime environment and started. When the adapted software sends control commands to the physical controlled object, it synchronously inputs the control commands and the current state of the physical controlled object into the modified world model for real-time simulation. The modified world model outputs the expected response data of the corresponding control commands. After receiving the control commands, the physical controlled object executes the actions and returns the actual response data. The real-time deviation between the expected response data and the actual response data is calculated. When the real-time deviation exceeds the preset deviation threshold, the control command and actual response data are input into the corrected world model to track the simulation path, identify the parameter mismatch items in the simulation path that cause the real-time deviation, generate parameter correction commands based on the parameter mismatch items, adjust the operating parameters of the adapted software according to the parameter correction commands, and the adjusted adapted software continues to send subsequent control commands to the physical controlled object.
8. A software migration and adaptation system based on a world model, used to implement the method as described in any one of claims 1-7, characterized in that, include: The data acquisition unit is used to acquire the execution behavior data of the software to be migrated, the response data of the physically controlled objects that interact with the software to be migrated, and the characteristic data of the target operating environment. The model simulation unit is used to build a world model based on execution behavior data and response data, generate candidate adaptation configurations based on the differences between execution behavior data and target operating environment feature data, simulate the candidate adaptation configurations by the world model, and output the predicted response trajectory and prediction confidence. The model correction unit is used to issue a detection command within the safety boundary to the physical controlled object when the prediction confidence is lower than the preset safety judgment condition, obtain the actual response data to correct the world model, and obtain the corrected world model. The strategy generation unit is used to simulate candidate adaptation configurations using the modified world model to obtain the modified predicted response trajectory. It transforms the stability margin requirement of the physically controlled object into the constraint condition of the predicted response trajectory. Based on the degree of conformity of the modified predicted response trajectory with respect to the constraint condition, it selects the target adaptation configuration from the candidate adaptation configurations and generates the adaptation strategy. The deployment and implementation unit is used to adjust the software to be migrated according to the adaptation strategy to obtain the adapted software, deploy the adapted software to the target operating environment and interact with the physical controlled object to drive the physical controlled object to perform actions.
9. An electronic device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to invoke instructions stored in the memory to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, When the computer program instructions are executed by the processor, they implement the method described in any one of claims 1 to 7.