A method, device and medium for evaluating distillation strategy based on reinforcement learning
By introducing the distillation strategy evaluation method based on reinforcement learning in satellite attitude control, and using the performance evaluation of the teacher's strategy and the target error value to optimize the student strategy, the problems of difficult transfer and high variance of deep reinforcement learning in satellite attitude control are solved, and the performance is improved. Robustness and generalization of control strategies.
Patent Information
- Application Number
- CN202210680169.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-15
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-06-15
AI Technical Summary
In the field of satellite attitude control, deep reinforcement learning algorithms are difficult to transfer from simulated environments to real environments, and the domain parameter distribution range is too wide, resulting in high variance, which affects the robustness and transfer generalization of the control strategy.
The distillation strategy evaluation method based on reinforcement learning is adopted. Through the performance evaluation of the teacher's strategy, the target error value is introduced into the distillation loss function and the student strategy is updated to improve the robustness and transfer generalization of the control strategy.
It improves the ability of the control strategy to judge the performance of the teacher's strategy, so that it can imitate the teacher's strategy with better performance as much as possible, enhances the robustness and transfer generalization of the control strategy, and reduces the error between simulation and reality.
Smart Images

Figure CN115057006B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of satellite attitude control. Specifically, embodiments of the present application relate to a method, device, and medium for evaluating a distillation strategy based on reinforcement learning. Background Art
[0002] While deep reinforcement learning has achieved significant results in robotic control in recent years, its application in satellite attitude control is still under research. Currently, training robotic devices with deep reinforcement learning requires testing in simulated environments. However, successfully migrating deep reinforcement learning algorithms and models to real-world environments remains a challenging problem in robotic control. Testing satellite attitude control in the real world is even more challenging. The biggest obstacle is the inherent differences between simulated and real-world environments. For example, satellite hardware in real-world environments can experience wear, delays, and unstable frictional resistance. These uncertainties can lead to policy transfer failures.
[0003] To maximize the simulation of the diverse uncertainties found in real-world environments, a prominent approach is domain randomization. This approach parameterizes the physical simulation environment, such as the mass of objects in the environment, the damping or friction coefficient between links, and other parameters. Randomizing these parameters allows the agent to adapt to diverse environmental transformations, thereby achieving better performance in the real world. The simulation environment with the randomized set of parameters is called the source domain, and the real-world environment to which the policy is ultimately transferred is called the target domain. Each parameter in the source domain is randomly selected from a specific distribution. Each source domain with different randomized parameters represents a different simulation environment. The agent is trained in multiple source domains. When the source domains are sufficiently broad, the target domain conditions are fully covered, meaning that the trained policy generalizes to the real world. Because domain randomization does not require real-world data as a reference for policy training, it significantly alleviates the difficulty of obtaining real-world data in satellite attitude control applications and can simulate as many uncertain satellite states as possible.
[0004] However, the resulting problem is that the distribution range of domain parameters is always difficult to determine. To ensure that the parameter distribution covers the real environment as much as possible, the distribution is usually set to a large value. This can cause the agent to learn some meaningless data, resulting in high variance and poor convergence. In the field of satellite attitude control, high variance can lead to unstable satellite attitude, significantly affecting accuracy.
[0005] In order to improve this problem, some studies have introduced policy distillation technology into the domain randomization method, distilling a model that integrates multiple policies into a smaller untrained control policy, so that it imitates the performance of the integrated multiple policies, and is more robust to the error between simulation and reality. Policy distillation is a variant of knowledge distillation in the field of reinforcement learning, and is more widely used in multi-task learning. The integrated policies are trained as teacher policies in different domains, where each domain is an instance of the same environment generated by randomizing different parameters. The control policy then imitates these teacher policies and learns the knowledge in the teacher policies. Usually this control policy is the same as the student policy, that is, the knowledge of the teacher policy is distilled into the control policy, that is, the student policy. After distillation, the student policy integrates the performance of multiple teacher policies to achieve compression of the teacher policy model, so that the generalization of the student policy is good enough and the error between simulation and reality is reduced. The algorithm flow chart is as follows Figure 1 shown.
[0006] When performing attitude control on a satellite, the satellite's attitude control model is usually designed to be very large. The policy distillation method is applied to learn the satellite's attitude control and compress it into a smaller model, which is easier to optimize and update subsequently and can reduce the model variance. Summary of the Invention
[0007] The purpose of the embodiments of the present application is to provide a method, device and medium for evaluating distillation strategies based on reinforcement learning. The method of the embodiments of the present application can solve the problem in the prior art that some teacher strategies are not optimal strategies, thereby affecting the robustness of the student strategies after distillation. By evaluating the teacher strategy, the control strategy's ability to discriminate the teacher strategy performance is improved, so that the control strategy can imitate the teacher strategy with better performance as much as possible, thereby enhancing the robustness of the control strategy and the generalization of transfer.
[0008] In the first aspect, an embodiment of the present application provides a method for evaluating a distillation strategy based on reinforcement learning, which can be applied to satellite attitude control. The method includes: obtaining N teacher strategies through a teacher training process based on a constructed satellite simulation environment and a designed domain parameter distribution interval, wherein N is an integer greater than 1; completing the update of the student strategy according to the distillation loss function to obtain a control strategy, wherein the distillation loss function is related to the target error value, and the target error value is determined by the performance evaluation results of each teacher strategy in the N teacher strategies, and the performance evaluation results of each teacher strategy are determined by the average reward value and the average trajectory length of each iteration; completing the attitude control of the satellite in a real environment according to the control strategy.
[0009] Some embodiments of the present application introduce a target error value for evaluating the performance of the teacher strategy into the distillation loss function. The target error value is determined by the average reward value and the average trajectory length of each iteration. These embodiments of the present application improve the control strategy's ability to discriminate the performance of the teacher strategy by evaluating the teacher strategy, so that the control strategy can imitate the teacher strategy with better performance as much as possible, thereby enhancing the robustness of the control strategy and the generalization of transfer.
[0010] In some embodiments, the target error value is calculated as follows:
[0011]
[0012] in, represents the performance evaluation result of the nth teacher strategy, where n is greater than or equal to 1 and less than or equal to N, and p s represents the performance evaluation result of the student strategy, which is related to the average reward value and average trajectory length of each iteration.
[0013] Some embodiments of the present application provide a method for obtaining a target error value based on evaluation results processed by N teachers.
[0014] In some embodiments, the updating of the student strategy is completed based on the distillation loss function to obtain the control strategy, including: obtaining the performance evaluation results of each teacher strategy among the N teacher strategies, wherein one teacher strategy corresponds to an environment of a domain parameter value, and the N teacher strategies correspond to environments of N different domain parameter values; obtaining N student strategy evaluation results; calculating the difference between the performance evaluation results of the N teacher strategies corresponding to the environments of N domain parameter values and the corresponding student strategy evaluation results to obtain N differences; and taking the maximum value from the N differences as the target error value.
[0015] Some embodiments of the present application provide a method for obtaining a target error value.
[0016] In some embodiments, obtaining the performance evaluation results of each teacher strategy among the N teacher strategies includes: normalizing the average reward value and the average trajectory length of the nth teacher strategy corresponding to each iteration in the K iterations according to the range method to obtain K processing results; performing dimensionality reduction processing on the K processing results to obtain a component matrix, wherein the rows of the component matrix represent the two indicators of the average reward value and the average trajectory length, and the columns of the component matrix represent two principal components; calculating the indicator linear combination coefficient matrix according to each element value in the component matrix; calculating the weight value of each indicator of the two indicators according to each linear combination coefficient in the indicator linear combination coefficient matrix, wherein the weight value includes a first weight value and a second weight value; normalizing the first weight value to obtain a first normalized weight value, and normalizing the second weight value to obtain a second normalized weight value; obtaining a performance evaluation result of a teacher strategy according to the first normalized weight value, the second normalized weight value and the average reward value and average trajectory length of each iteration in the kth iteration.
[0017] Some embodiments of the present application provide an evaluation method for obtaining the performance results of a teacher strategy based on average reward value and average trajectory length.
[0018] In some embodiments, the weight value of each indicator is calculated based on each linear combination coefficient in the indicator linear combination coefficient matrix, including: calculating the sum of the linear combination coefficient of each principal component corresponding to each indicator multiplied by the variance contribution rate of the corresponding principal component, and then dividing it by the sum of the variance contribution rates of all principal components to obtain the weight value corresponding to each indicator.
[0019] In some embodiments, obtaining a performance evaluation result of a teacher strategy based on the weight value includes: normalizing the weight value to obtain a normalized weight value; and obtaining a performance evaluation result of the teacher strategy based on the normalized weight value.
[0020] Some embodiments of the present application provide a method for normalizing weight values to improve the versatility of the technical solution.
[0021] In some embodiments, obtaining the performance evaluation result of the teacher strategy based on the normalized weight value includes: multiplying the kth average reward value of the kth iteration by the weight corresponding to the kth average reward value to obtain a first product; multiplying the kth average trajectory length corresponding to the kth iteration by the weight corresponding to the kth average trajectory length to obtain a second product; solving the sum of the first product and the second product, and repeating the above process to obtain the sum of all iterations to obtain a comprehensive result; dividing the comprehensive result by the total number of all iterations to obtain the performance evaluation result of the teacher strategy.
[0022] In some embodiments, the formula of the distillation loss function is:
[0023]
[0024] Among them, the represents the target error value, n represents any teacher strategy number, τ 1:N characterizes the trajectory of the student policy trained in each teacher environment, Represents the nth teacher strategy obtained through training, θ s Characterize the student strategy, Characterize the trajectory τ produced by the student strategy in the same environment instance as the nth teacher strategy n The first action distribution generated under the teacher strategy; π θ s(τ n ) represents the trajectory τ produced by the student strategy in the nth teacher environment n The second action distribution generated under the student strategy, KL representation calculates the divergence value of the first action distribution and the second action distribution, and N represents the number of teacher strategies.
[0025] In some embodiments, the calculation formula for the performance evaluation result of the nth teacher strategy is as follows:
[0026]
[0027] Where I is the total number of iterations, k is the kth iteration, is the nth teacher strategy.
[0028] In some embodiments, according to the constructed satellite simulation environment and the designed domain parameter distribution interval, N teacher strategies are obtained through a teacher training process, including: establishing a training environment for satellite attitude control tasks, determining the distribution of each domain parameter, wherein the domain parameter types include: the mass of the satellite, the windward area of the satellite, the sun-exposed area of the satellite, the initial attitude angle and the target attitude angle of the satellite, the maximum control torque of the flywheel, the speed of the flywheel, and the operating temperature of the magnetic torquer; randomly taking values within the distribution interval of each domain parameter to obtain N environment instances ξ, wherein one environment instance is obtained by randomly taking a value of the domain parameters of all classes within the distribution interval; according to the N environment instances, and using a reinforcement learning algorithm to train the teacher strategy network, the N teacher strategies are obtained, wherein one environment instance corresponds to one teacher strategy.
[0029] In some embodiments, the teacher strategy network includes: a radial basis neural network (RBF), a convolutional neural network (CNN), or a recurrent neural network (RNN).
[0030] In a second aspect, some embodiments of the present application provide a device for evaluating distillation strategies based on reinforcement learning, the device comprising: a construction module, configured to obtain N teacher strategies through a teacher training process based on a constructed satellite simulation environment and a designed domain parameter distribution interval, wherein N is an integer greater than 1; a control processing acquisition module, configured to update the student strategy according to a distillation loss function to obtain a control strategy, wherein the distillation loss function is related to a target error value, and the target error value is determined by a performance evaluation result of each teacher strategy among the N teacher strategies; an attitude control module, configured to complete attitude control of a satellite in a real environment according to the control strategy.
[0031] In a third aspect, some embodiments of the present application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, can implement the method described in any embodiment of the first aspect.
[0032] In a fourth aspect, some embodiments of the present application provide an electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein when the processor executes the program, the method described in any embodiment of the first aspect can be implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work.
[0034] Figure 1 A diagram of the system architecture for obtaining a control strategy according to an embodiment of the present application;
[0035] Figure 2 This is a flowchart of a method for evaluating a distillation strategy based on reinforcement learning provided in an embodiment of the present application;
[0036] Figure 3 This is a second flow chart of the method for evaluating distillation strategies based on reinforcement learning provided in an embodiment of the present application;
[0037] Figure 4 A block diagram of the device composition for evaluating a distillation strategy based on reinforcement learning provided in an embodiment of the present application;
[0038] Figure 5 A schematic diagram of the electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0039] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0040] It should be noted that similar reference numerals and letters represent similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined or explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and should not be understood as indicating or implying relative importance.
[0041] Existing methods combining policy distillation with domain randomization for simulation-to-real-world transfer can effectively address the high variance problem caused by the wide distribution of domain parameters, but lack a clear assessment of the performance of the teacher policy. Although the teacher policy is a policy model trained in a different domain, it can be suboptimal. Specifically, if the teacher policy does not converge to optimality or converges poorly during training, it can negatively impact the control policy during the subsequent distillation process, resulting in less robust transfer results.
[0042] This application proposes an evaluation method for the teacher strategy. After the teacher strategy is trained, the reward value and average trajectory length of the teacher strategy and the student strategy are evaluated separately. The two are compressed into a value that can represent the strategy performance according to a certain proportional weight. The difference between the two values is used as a supplementary term in the distillation loss function to determine the performance of the teacher strategy.
[0043] It is understandable that if the satellite attitude control strategy model is not robust enough, it will produce large uncertainties and affect the control accuracy. Therefore, it is necessary to conduct a trust evaluation of the teacher strategy to determine the degree of trust in each teacher strategy.
[0044] Please see Figure 1 , Figure 1 A system architecture diagram for acquiring control strategies provided in some embodiments of the present application, including a teacher training module and a student training module.
[0045] Figure 1 The strategy evaluation module in is used to calculate the weights according to N teacher strategies, and perform distillation processing based on the weights (that is, input the weight values into the distillation processing module), update the relevant parameters according to the weight values and the distillation processing results, and adjust the trajectory results according to the updated parameters until the student training process is completed and the control strategy is obtained. It should be noted that for Figure 1 The specific meanings of the relevant parameters in the teacher training process can be found in the following description. To avoid repetition, these parameters will not be described in detail here.
[0046] That is to say, in some embodiments of the present application, after the teacher strategy is trained, the average reward value and average trajectory length of the teacher strategy and the student strategy are evaluated respectively, and the two indicators are compressed into a value that can represent the performance of the teacher strategy and the student strategy according to a certain proportion of weights. The difference between the values of the two strategies is used as a supplementary term in the distillation loss function to determine the degree of trust in the teacher strategy. This method can solve the problem that some teacher strategies in the prior art are not optimal strategies, thereby affecting the robustness of the student strategy after distillation. By evaluating the teacher strategy, the control strategy's ability to discriminate the teacher strategy's performance is improved, so that the control strategy can imitate the teacher strategy with better performance as much as possible, thereby enhancing the robustness of the control strategy and the generalization of transfer.
[0047] The model is divided into teacher strategy training process and student strategy training process. The control strategy mentioned above is the same as the student strategy in this method. The algorithm flow chart is as follows: Figure 1 shown.
[0048] Combine Figure 1 It can be seen that for each environment instance ξ, it is assumed that the domain parameter distribution is p φ (ξ), each domain parameter of each teacher strategy randomly takes a value within the distribution, N teacher strategies Corresponding to N environment instances ξ1…ξ N , N teacher strategies are trained according to N environments. This is the teacher training process. The student strategy is trained in each teacher environment, and each teacher environment instance ξ n Corresponding to a trajectory result, the trajectory generated by teacher training and the N trajectories generated by student training τ 1:N Perform strategy evaluation. Then calculate the maximum target error based on the strategy evaluation, combine the KL divergence of the action distribution generated by the trajectory results of the teacher strategy and the student strategy, and form a distillation loss function as the distillation process. The distillation process has an impact on the student strategy θ s After the student strategy is updated, it continues to sample in N teacher environments to generate new trajectory results.
[0049] The following combination Figure 2 The following exemplifies the method for evaluating a distillation strategy based on reinforcement learning provided by some embodiments of the present application.
[0050] like Figure 2As shown, some embodiments of the present application provide a method for evaluating a distillation strategy based on reinforcement learning, which exemplarily includes: S101, obtaining N teacher strategies through a teacher training process according to a constructed satellite simulation environment and a designed domain parameter distribution interval, wherein N is an integer greater than 1; S102, completing the update of the student strategy according to the distillation loss function to obtain a control strategy, wherein the distillation loss function is related to a target error value, and the target error value is determined by a performance evaluation result of each teacher strategy in the N teacher strategies, and the performance evaluation result of each teacher strategy is determined by the average reward value and the average trajectory length of each iteration; S103, completing the attitude control of the satellite in a real environment according to the control strategy.
[0051] Some embodiments of the present application introduce a target error value for evaluating the performance of the teacher strategy into the distillation loss function. The target error value is determined by the average reward value and the average trajectory length of each iteration. These embodiments of the present application improve the control strategy's ability to discriminate the performance of the teacher strategy by evaluating the teacher strategy, so that the control strategy can imitate the teacher strategy with better performance as much as possible, thereby enhancing the robustness of the control strategy and the generalization of transfer.
[0052] The above steps are exemplarily described below.
[0053] In some embodiments of the present application, S101 illustratively includes the following two steps:
[0054] The first step is to establish a training environment for the satellite attitude control mission and determine the distribution of various domain parameters. The domain parameter types include: satellite mass, satellite frontal area, satellite sunlit area, satellite initial attitude angle and target attitude angle, flywheel maximum control torque, flywheel speed, and magnetic torquer operating temperature.
[0055] For example, the domain parameters in the distribution of domain parameters described above include the satellite's mass, its windward area, its sunlit area, its initial and target attitude angles, the maximum control torque of the flywheel, the flywheel's rotational speed, and the operating temperature of the magnetic torquer. The satellite's initial and target attitude angles are both calculated using the projection of the attitude quaternion of the body coordinate system relative to the orbital coordinate system. The satellite mass is designed to have a uniform distribution, its windward area and sunlit area both have a normal distribution, its initial and target attitude angles have a uniform distribution, the flywheel's control torque has a uniform distribution, the flywheel's rotational speed has a normal distribution, and the magnetic torquer's operating temperature has a uniform distribution.
[0056] For example, assuming that the satellite mass satisfies a uniform distribution with a minimum value of 15 kg and a maximum value of 25 kg, the distribution of the satellite mass parameter is between 15 and 25, and the satellite mass parameter takes a random value between 15 and 25.
[0057] In the second step, a random value is taken within the distribution interval of each domain parameter to obtain N environment instances ξ, where one environment instance is obtained by randomly taking a value of all domain parameters in the environment within the distribution interval.
[0058] Secondly, we randomly select the value of each domain parameter within its distribution range. Initialize the teacher environment and simulate various possible changes of satellite missions. For each environment instance ξ, we assume that the domain parameter distribution is p φ (ξ), each domain parameter of each teacher strategy randomly takes a value within the distribution, N teacher strategies Corresponding to N environment instances ξ1,……,ξ N Specific examples: Figure 1 Related parameters.
[0059] It's understandable that only by first determining the range of parameter distribution can the random values for each parameter be chosen within the set range. Each parameter value has a specific meaning. For example, a satellite mass is approximately 20 kg. If the value is set too high, such as 200 kg, it will not match the actual mass and will be meaningless for simulation training. Therefore, it is necessary to ensure that the value of each parameter is within a certain meaningful range.
[0060] In the third step, a teacher policy network is trained using a reinforcement learning algorithm based on the N environment instances to obtain the N teacher policies, where one teacher policy corresponds to one environment instance. For example, in some embodiments, the teacher policy network includes a radial basis function neural network (RBF), a convolutional neural network (CNN), or a recurrent neural network (RNN).
[0061] For example, the reinforcement learning algorithm DDPG is used to train a teacher policy. The policy network uses an RBF neural network (or alternatively, CNN, RNN, LSTM, or FNN neural networks, including CNN (Convolutional Neural Networks), RNN (Recurrent Neural Networks), LSTM (Long Short Term Memory), and FNN (Feedforward Neural Networks). This yields N trained teacher policies. For example, during training, the total number of samples per iteration is set to 8,000. When the total number of samples is less than 8,000, sampling continues to generate new trajectories. When the sum of the sample counts for all trajectories exceeds 8,000, sampling for that iteration ends, and the number of trajectories obtained is the number of trajectories sampled in that iteration. Each trajectory contains a certain number of samples. The sum of the reward values for all samples and the sum of the number of samples are calculated to obtain the reward and trajectory length for that trajectory. The reward and trajectory length for all trajectories in an iteration are calculated, and the average reward and trajectory length for that iteration are calculated.
[0062] S102 is described below as an example.
[0063] In some embodiments of the present application, the target error value is calculated as follows:
[0064]
[0065] in, represents the performance evaluation result of the nth teacher strategy, where n is greater than or equal to 1 and less than or equal to N, and p s represents the performance evaluation result of the student strategy, which is trained in an environment with the same domain parameter values as the nth teacher strategy, and is related to the average reward value and the average trajectory length of each iteration.
[0066] Some embodiments of the present application provide a method for obtaining a target error value based on evaluation results processed by N teachers.
[0067] In some embodiments of the present application, obtaining the performance evaluation results of each teacher strategy among the N teacher strategies includes: normalizing the average reward value and the average trajectory length of the nth teacher strategy corresponding to each iteration in the K iterations according to the range method to obtain K processing results; performing dimensionality reduction processing on the K processing results to obtain a component matrix, wherein the rows of the component matrix represent the two indicators of the average reward value and the average trajectory length, and the columns of the component matrix represent two principal components; calculating the indicator linear combination coefficient matrix according to each element value in the component matrix; calculating the weight value of each indicator of the two indicators according to each linear combination coefficient in the indicator linear combination coefficient matrix, wherein the weight value includes a first weight value and a second weight value; normalizing the first weight value to obtain a first normalized weight value, and normalizing the second weight value to obtain a second normalized weight value; obtaining a performance evaluation result of a teacher strategy according to the first normalized weight value, the second normalized weight value and the average reward value and average trajectory length of each iteration in the kth iteration.
[0068] In some embodiments of the present application, the weight value of the indicator is calculated based on each linear combination coefficient of the K linear combination coefficients to obtain K pairs of weight values, including: calculating the sum of the linear combination coefficient of each principal component corresponding to each indicator multiplied by the variance contribution rate of the corresponding principal component, and then dividing it by the sum of the variance contribution rates of all principal components to obtain the weight value corresponding to each indicator.
[0069] In some embodiments of the present application, obtaining a performance evaluation result of a teacher strategy based on the weight value includes: normalizing the weight value to obtain a normalized weight value; and obtaining a performance evaluation result of the teacher strategy based on the normalized weight value.
[0070] Some embodiments of the present application provide a method for normalizing weight values to improve the versatility of the technical solution.
[0071] In some embodiments of the present application, the performance evaluation result of the teacher strategy obtained according to the normalized weight value includes: multiplying the kth average reward value of the kth iteration by the weight corresponding to the kth average reward value to obtain a first product; multiplying the kth average trajectory length corresponding to the kth iteration by the weight corresponding to the kth average trajectory length to obtain a second product; solving the sum of the first product and the second product, and repeating the above process to obtain the sum of all iterations, and then adding the sum to obtain a comprehensive result; dividing the comprehensive result by the total number of all iterations to obtain the performance evaluation result of the teacher strategy.
[0072] It should be noted that one iteration yields an average reward value and average trajectory length. K iterations yield K average reward values and K average trajectory lengths. Therefore, the matrix is originally a 2*K matrix, where 2 represents the average reward value and average trajectory length, and K represents the K values corresponding to K iterations. These K average reward values and K average trajectory lengths are then reduced to represent the K values using two principal components. This results in a 2*2 matrix, or component matrix. In other words, one teacher strategy corresponds to one component matrix. This dimensionality reduction also yields an eigenvalue and a variance contribution for each principal component value. These two values are used to calculate the linear combination coefficients and weights.
[0073] The following is an example of obtaining the specific calculation formula calculation process.
[0074] The N teacher strategies are evaluated based on the average return value and average trajectory length of the teacher strategy. First, the average return value and average trajectory length of the teacher strategy are standardized according to the range method, where the average return value is a positive indicator. Calculate the normalized value; the average trajectory length is a negative indicator, according to Calculate the standardized value. Then, use the PCA dimensionality reduction method (i.e., reduce the dimension of the N average return values and N average trajectory lengths obtained by N iterations of a teacher strategy. After dimensionality reduction, the average return value and average trajectory length are respectively obtained as two principal component values, and the two principal component values correspond to a characteristic root and a variance contribution rate). The extraction factor parameter is set to 0.99 to ensure that the data after dimensionality reduction retains 99% of the information. After PCA dimensionality reduction, the standardized average return value and average trajectory length are compressed into a 2*2 matrix, namely the component matrix. The rows of the matrix represent the two indicators of average return value and average trajectory length, and the columns of the matrix represent the two principal components (the principal components are generated by PCA dimensionality reduction, and the characteristic root and variance contribution rate of each principal component are generated at the same time). The linear combination coefficient matrix of the indicators is calculated according to formula (1), where the linear combination coefficient [i][j] represents the coefficient of the jth principal component of the i-th indicator, and the component matrix [i][j] represents the value of the jth principal component of the i-th indicator.
[0075]
[0076] The weight values of the indicators are calculated according to formula (2), and each indicator corresponds to a weight value. The weight of each indicator is obtained by multiplying the linear combination coefficient of each principal component of each indicator by the variance contribution rate of the corresponding principal component and dividing it by the sum of the variance contribution rates of all principal components.
[0077]
[0078] The weights are normalized according to the following formula (3) so that the sum of the weights of all indicators is 1. It should be noted that the weights obtained by formula (2) are normalized. There are as many weights as there are indicators. Some embodiments of the present application set two indicators, the average return value and the average trajectory length, so there are two weights, and the value range of i is (1, 2). The purpose of normalization is to make the sum of the weights 1. The sum of the weights calculated by formula (2) is not 1, so normalization is required. This normalized weight is then multiplied by the average return value and the average trajectory length to calculate the performance value.
[0079] Normalized weight[i] = weight[i] / (weight[1]+weight[2]) Formula (3)
[0080] The performance value of the teacher strategy is calculated according to formula (4). The first weight is the weight of the average return value, the second weight is the weight of the average trajectory length, and k represents the kth iteration. The average return value of one iteration is multiplied by its corresponding weight, and the average trajectory length is multiplied by its corresponding weight. All iterations are added up and then divided by the total number of iterations I to finally get the performance value of the nth teacher strategy.
[0081] It should be noted that the student strategy is trained once in N teacher environments to obtain N training trajectories. The average reward value and average trajectory length of the student strategy are calculated for these N training trajectories (the way to obtain the average reward value and average trajectory length is slightly different from that of the teacher strategy). The student strategy does not have the calculation process of formula (1), formula (2), and formula (3). It directly multiplies the average reward value and average trajectory length just calculated by the weight value of the average reward value and average trajectory length calculated by the corresponding teacher strategy at this time to obtain the performance of the student strategy. That is to say, when calculating the performance of the nth teacher strategy, the calculated weight value is also applied to the performance calculation of the student strategy, that is, the performance of the student strategy = the first weight value of the nth teacher strategy multiplied by the average reward value of the student strategy and the second weight value of the nth teacher strategy multiplied by the average trajectory length of the student strategy. Similar to formula (4), but without the steps of summation and division.
[0082] In some embodiments of the present application, the process of completing the student strategy update based on the distillation loss function to obtain the control strategy recorded in the above S102 exemplarily includes: obtaining the performance evaluation results of each teacher strategy among the N teacher strategies, wherein one teacher strategy corresponds to an environment of one domain parameter value, and the N teacher strategies correspond to environments of N different domain parameter values; respectively obtaining the student strategy evaluation results in the environments of the N different domain parameter values to obtain N student strategy evaluation results; calculating the difference between the performance evaluation results of the N teacher strategies corresponding to the environments of the N domain parameter values and the corresponding student strategy evaluation results to obtain N differences; and taking the maximum value from the N differences as the target error value.
[0083] For example, in some embodiments of the present application, the formula of the distillation loss function is:
[0084]
[0085] Among them, the represents the target error value, n represents any teacher strategy number, τ 1:N represents the trajectory of the student policy trained in each teacher environment, Represents the nth teacher strategy obtained through training, θ s Characterizing student strategies, Characterize the trajectory τ produced by the student strategy in the same environment instance as the nth teacher strategy n The first action distribution generated under the teacher strategy; π θ s(τ n ) represents the trajectory τ produced by the student strategy in the nth teacher environment n The second action distribution generated under the student strategy is calculated, and the KL divergence value of the two action distributions is minimized, and the sum of the KL divergence of the action distribution of each teacher-student pair is minimized. That is, the distillation loss of some embodiments of the present application is composed of the auxiliary loss term and the KL divergence of the loss term. During the update process, the loss function gradually becomes smaller, and the student strategy gradually approaches the optimal teacher strategy.
[0086] It should be noted that the teacher-student pairs trained in the environment with the same domain parameter values. Calculate the error of each teacher-student pair and obtain the maximum value of all errors, that is, As an auxiliary loss term of KL loss in the distillation loss function (the distillation loss function is used when the student strategy is updated to estimate the consistency between the student strategy and the teacher strategy, so that the student strategy is as close as possible to the teacher strategy), where represents the performance of the nth teacher strategy, p sDenotes the performance of the student strategy. The formula of the distillation loss function is shown in formula (5). Where n represents the nth teacher strategy and N represents the total number of teacher strategies. In each iteration of the student strategy, the student strategy is trained in each teacher environment to obtain the trajectory τ 1:N , represents the nth teacher strategy, θ s represents student strategies, represents the trajectory τ produced by the student strategy in the nth teacher environment n The distribution of actions generated under the teacher's strategy; represents the trajectory τ produced by the student strategy in the nth teacher environment n The action distribution generated under the student strategy. Calculate the KL divergence value of the two action distributions and minimize the sum of the KL divergence of the action distribution of each teacher-student pair. The maximum error with the teacher-student pair Add them together to get the distillation loss function. Update the student strategy θ according to the distillation loss function s .
[0087] After completing the training in the above simulation environment, the student strategy of the compressed teacher strategy model is used as the reinforcement learning strategy in the satellite attitude control task, and applied to the real environment task of satellite attitude control based on reinforcement learning algorithm research. The application process is as follows: Figure 3 shown.
[0088] In summary, the process of obtaining the control strategy in the embodiment of the present application is as follows: Figure 3 As shown in the figure, the process includes: building a satellite simulation environment; designing satellite domain parameters and their distribution; applying the domain randomized distillation strategy evaluation algorithm to obtain the student strategy (i.e., control strategy); and applying it in the real satellite environment.
[0089] Please refer to Figure 4 , Figure 4 The embodiment of the present application provides a device for evaluating distillation strategies based on reinforcement learning. It should be understood that the device is similar to the above-mentioned Figure 2 The method embodiment corresponds to the method embodiment and is capable of executing each step involved in the above method embodiment. The specific functions of the device can be found in the description above, and a detailed description is omitted here to avoid repetition. The device includes at least one software functional module that can be stored in a memory in the form of software or firmware or embedded in the device's operating system. The authentication device includes: a construction module 101, a control processing acquisition module 102, and a posture control module 103.
[0090] The construction module 101 is configured to obtain N teacher strategies through a teacher training process according to the constructed satellite simulation environment and the designed domain parameter distribution interval, where N is an integer greater than 1.
[0091] The control processing acquisition module 102 is configured to complete the student strategy update based on the distillation loss function to obtain the control strategy, wherein the distillation loss function is related to the target error value, and the target error value is determined by the performance evaluation results of each teacher strategy in the N teacher strategies.
[0092] The attitude control module 103 is configured to perform attitude control of the satellite in a real environment according to the control strategy.
[0093] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working process of the device described above can refer to the corresponding process in the aforementioned method, and will not be described in detail here.
[0094] Some embodiments of the present application provide a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, the method described in the above method embodiments can be implemented.
[0095] like Figure 5 As shown, some embodiments of the present application provide an electronic device 500, including a memory 510, a processor 520, and a computer program stored on the memory 510 and executable on the processor 520, wherein the processor 520 can implement the method described in any of the above method embodiments when reading the program from the memory 510 through a bus 530 and executing the program.
[0096] Processor 520 can process digital signals and can include various computing architectures, such as a complex instruction set computer architecture, a reduced instruction set computer architecture, or an architecture that implements a combination of multiple instruction sets. In some examples, processor 520 can be a microprocessor.
[0097] The memory 510 may be used to store instructions executed by the processor 520 or data related to the execution of instructions. These instructions and / or data may include code for implementing some or all functions of one or more modules described in the embodiments of the present application. The processor 520 of the present disclosure may be used to execute the instructions in the memory 510 to implement Figure 2 The memory 510 includes a dynamic random access memory, a static random access memory, a flash memory, an optical memory or other memory known to those skilled in the art.
[0098] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions and operations of the devices, methods and computer program products according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, program segment or a part of the code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or can be implemented using a combination of dedicated hardware and computer instructions.
[0099] In addition, the functional modules in each embodiment of the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0100] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0101] The foregoing is merely an embodiment of the present application and is not intended to limit the scope of protection of the present application. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included within the scope of protection of the present application. It should be noted that similar reference numerals and letters represent similar items in the following figures. Therefore, once an item is defined in one figure, it does not need to be further defined or explained in subsequent figures.
[0102] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
[0103] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.
Claims
1. A method for evaluating a distillation strategy based on reinforcement learning, which can be applied in satellite attitude control, characterized in that: The method comprises: According to the constructed satellite simulation environment and the designed domain parameter distribution interval, N teacher strategies are obtained through the teacher training process, where N is an integer greater than 1; Complete the updating of the student strategy according to the distillation loss function to obtain the control strategy, wherein the distillation loss function is related to the target error value, and the target error value is determined by the performance evaluation result of each teacher strategy in the N teacher strategies, and the performance evaluation result of each teacher strategy is determined by the average reward value and the average trajectory length of each iteration; Performing attitude control of a satellite in a real environment according to the control strategy; in: The updating of the student strategy according to the distillation loss function to obtain the control strategy includes: The average return value and average trajectory length of the nth teacher strategy corresponding to each iteration in k iterations are standardized according to the range method to obtain K processing results; Performing dimensionality reduction processing on the K processing results to obtain a component matrix, wherein the rows of the component matrix represent the two indicators of the average return value and the average trajectory length, and the columns of the component matrix represent two principal components; Calculate the index linear combination coefficient matrix according to the value of each element in the component matrix; Calculating a weight value of each indicator in the two indicators according to each linear combination coefficient in the indicator linear combination coefficient matrix, wherein the weight value includes a first weight value and a second weight value; Normalizing the first weight value to obtain a first normalized weight value, and normalizing the second weight value to obtain a second normalized weight value; Obtaining a performance evaluation result of a teacher strategy according to the first normalized weight value, the second normalized weight value, and the average reward value and the average trajectory length of each iteration in the k iterations; Obtaining the performance evaluation results of each teacher strategy among the N teacher strategies, including: The average return value and average trajectory length of the nth teacher strategy are standardized according to the range method to obtain the processing results; Performing dimensionality reduction processing on the processing result to obtain a component matrix, wherein the rows of the component matrix represent the two indicators of the average return value and the average trajectory length, and the columns of the component matrix represent two principal components; Calculate the index linear combination coefficient matrix according to the component matrix to obtain the linear combination coefficient; Calculate the weight value of the indicator according to the linear combination coefficient, and each indicator corresponds to a weight value; A performance evaluation result of a teacher strategy is obtained according to the weight value; According to the satellite simulation environment constructed and the domain parameter distribution interval designed, N teacher strategies are obtained through the teacher training process, including: Establishing a training environment for satellite attitude control tasks and determining the distribution of various domain parameters, wherein the domain parameter types include: satellite mass, windward area of the satellite, sunlit area of the satellite, initial attitude angle and target attitude angle of the satellite, maximum control torque of the flywheel, speed of the flywheel, and operating temperature of the magnetic torquer; Randomly select a value within the distribution interval of each domain parameter to obtain N environment instances ξ, where one environment instance is obtained by randomly selecting a value for the domain parameters of all classes within the distribution interval; According to the N environment instances, a teacher strategy network is trained using a reinforcement learning algorithm to obtain the N teacher strategies, wherein one environment instance corresponds to one teacher strategy.
2. The method according to claim 1, characterized in that The calculation formula of the target error value is as follows: in, Represents the performance evaluation result of the nth teacher strategy, where n is greater than or equal to 1 and less than or equal to N, p s Represents the performance of the student’s strategy.
3. The method according to claim 1, characterized in that The weight values of the indicators are calculated according to the linear combination coefficients, and each indicator corresponds to a weight value, including: The sum of the linear combination coefficient of each principal component corresponding to each indicator multiplied by the variance contribution rate of the corresponding principal component is calculated, and then divided by the sum of the variance contribution rates of all principal components to obtain the weight value corresponding to each indicator.
4. The method according to claim 1, characterized in that The performance evaluation result of a teacher strategy is obtained according to the weight value, including: Normalizing the weight value to obtain a normalized weight value; A performance evaluation result of the teacher strategy is obtained according to the normalized weight value.
5. The method according to claim 4, characterized in that The performance evaluation result obtained according to the normalized weight value and the teacher strategy includes: Multiplying the kth average reward value of the kth iteration by the weight corresponding to the kth average reward value to obtain a first product; Multiplying the kth average trajectory length corresponding to the kth iteration by the weight corresponding to the kth average trajectory length to obtain a second product; Solving the sum of the first product and the second product, and repeating the above process to obtain the sum of all iterations to obtain a comprehensive result; The comprehensive result is divided by the total number of all iterations to obtain the performance evaluation result of the teacher strategy.
6. The method according to claim 2, characterized in that The formula of the distillation loss function is: Among them, the represents the target error value, n represents any teacher strategy number, τ 1:N represents the trajectory of the student policy trained in each teacher environment, Represents the nth teacher strategy obtained through training, θ s Characterize the student strategy, Characterize the trajectory τ produced by the student strategy in the same environment instance as the nth teacher strategy n The first action distribution generated under the teacher strategy; π θ s(τ n ) represents the trajectory τ produced by the student strategy in the nth teacher environment n The second action distribution generated under the student strategy, KL represents the divergence value calculated between the first action distribution and the second action distribution, and N represents the number of teacher strategies.
7. The method according to claim 6, characterized in that The calculation formula for the performance evaluation result of the nth teacher strategy is as follows: Where I is the total number of iterations, k is the kth iteration, is the nth teacher strategy.
8. The method according to claim 7, characterized in that The teacher strategy network includes: a radial basis neural network RBF, a convolutional neural network CNN or a recurrent neural network RNN.
9. A device for evaluating a distillation strategy based on reinforcement learning, characterized in that: A method for evaluating a distillation strategy based on reinforcement learning as described in any one of claims 1 to 8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method described in any one of claims 1 to 8 can be implemented.
11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method described in any one of claims 1 to 8 can be implemented.
Citation Information
Patent Citations
Solid micro thruster array and magnetic moment device joint control method
CN108891625A
A deep reinforcement learning method and equipment based on a plurality of historical optimal Q networks
CN109919319A
Satellite capacity allocation method and device and electronic equipment
CN111491382A
Satellite orbit operation parameter learning system, equipment and system operation method
CN111563326A
Unmanned aerial vehicle stability control algorithm based on integral compensation reinforcement learning
CN112148025A
