Federal learning optimization method and system in smart power grid

By adopting federated learning optimization methods in smart grids and updating federated learning models using GWO algorithms, the instability of model operation caused by communication bandwidth limitations and malicious behavior of nodes is solved, the convergence efficiency of the model is improved, and the reliable operation and management of the smart grid is ensured.

CN119808893APending Publication Date: 2025-04-11YANCHENG INST OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411893085.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-20
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

The federated learning model in the smart grid is unable to operate as expected due to communication bandwidth limitations and the problem of nodes that may perform malicious behavior, which reduces the convergence efficiency of the model.

Method used

A federated learning optimization method is adopted to initialize the federated learning model in the smart grid and set the Grey Wolf Optimization Algorithm (GWO) parameters according to the maximum number of iterations, build a local model, filter and calibrate the local model, calculate iteration location, and update the federated learning model through the GWO algorithm to obtain the optimized model.

Benefits of technology

The convergence efficiency of the model is improved, the model operation instability caused by communication bandwidth limitation and malicious behavior of nodes is solved, and the federated learning model is optimized to ensure the reliable operation and management of the smart grid.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119808893A_ABST
    Figure CN119808893A_ABST
Patent Text Reader

Abstract

The invention discloses a federated learning optimization method and system in a smart power grid. The method comprises the following steps: initializing a federated learning model in the smart power grid and setting parameters of a GWO algorithm according to the maximum number of iterations of the federated learning model; constructing a local model of each client, determining the fitness of each local model, and screening out a calibrated local model according to the fitness; calculating the position of the calibration local model during each iteration, and determining the iteration position of each residual local model according to the position of the calibration local model during each iteration and the surrounding behaviors of the residual local models; and updating the federated learning model through a GWO algorithm according to the iteration position of each remaining local model to obtain an optimized federated learning model. Parameter combination capable of optimizing model performance can be combined, so that parameters of the client model gradually approach to an optimal solution, optimization of the federated learning model is realized, and convergence efficiency of the model is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of smart grid technology, and in particular to a federated learning optimization method and system in a smart grid. Background Art

[0002] At present, as a core component of modern power systems, smart grids aim to improve the monitoring, analysis and management capabilities of power grids by integrating advanced information and communication technologies, and to achieve efficient, reliable and safe energy supply. Centralized machine learning methods in smart grids require data to be stored in a central server. This has raised concerns about privacy and security. Federated learning has been applied to smart grids due to its privacy protection and distributed computing performance. However, in practical applications, there are problems such as communication bandwidth limitations and nodes that may perform malicious behaviors, which cause the model to fail to operate as expected and cannot provide reliable support for the operation and management of smart grids, reducing the convergence efficiency of the model. Summary of the invention

[0003] In response to the above-mentioned problems, the present invention provides a federated learning optimization method in a smart grid to solve the problems mentioned in the background technology, such as the limitation of communication bandwidth and the possibility that nodes may perform malicious behaviors, which causes the model to fail to operate as expected, fails to provide reliable support for the operation and management of the smart grid, and reduces the convergence efficiency of the model.

[0004] A federated learning optimization method in a smart grid comprises the following steps:

[0005] Initialize the federated learning model in the smart grid and set the parameters of the GWO algorithm according to the maximum number of iterations of the federated learning model;

[0006] Build a local model for each client, determine the fitness of each local model, and select and calibrate the local model based on the fitness;

[0007] The position of the calibrated local model at each iteration is calculated, and the iteration position of each remaining local model is determined according to the position of the calibrated local model at each iteration and the encirclement behavior of the remaining local models;

[0008] The federated learning model is updated through the GWO algorithm according to the iteration position of each remaining local model to obtain the optimized federated learning model.

[0009] Preferably, the initializing the federated learning model in the smart grid and setting the parameters of the GWO algorithm according to the maximum number of iterations of the federated learning model includes:

[0010] Determine the number of clients, allocate initial training tasks and training process hyperparameters according to the number of clients, and perform model training using a fixed machine learning algorithm to obtain an initialized federated learning global model;

[0011] Get the maximum number of training iterations for initializing the federated learning global model, and calculate the position update calculation coefficient based on the maximum number of training iterations:

[0012] A=2ar1-a

[0013] C=2r2

[0014]

[0015] Among them, A represents the first position update calculation coefficient, C represents the second position update calculation coefficient, r1 and r2 are random numbers in the range of [0,1], t represents the current iteration number, and T represents the maximum training iteration number for initializing the global model of federated learning.

[0016] Preferably, the step of constructing a local model of each client, determining the fitness of each local model, and selecting a calibrated local model according to the fitness comprises:

[0017] The global model parameters of the federated learning model are sent by the server. Each client trains the model with a local data set based on the global model parameters to generate a local model:

[0018]

[0019] Among them, D j Represented as the local model of the jth client, is the local model of the jth client after training for the maximum number of iterations, η is the learning rate, It is represented as the gradient of the loss function calculated based on the data of the jth customer j;

[0020] Determine the communication cost and data transmission cost of each local model, and determine the fitness of each local model according to the communication cost and data transmission cost;

[0021] The top three local models α, β and δ in terms of fitness are selected and used as calibration local models.

[0022] Preferably, the calculating the position of the calibrated local model at each iteration, and determining the iteration position of each remaining local model according to the position of the calibrated local model at each iteration and the surrounding behavior of the remaining local models, comprises:

[0023] Determine the spatial dimension and determine the position representation of each iteration of the calibration local model based on the spatial dimension: D represents the spatial dimension;

[0024] The model for the surrounding behavior of the remaining local model is:

[0025]

[0026] in, It is represented as the position of the kth remaining local model after t+1 iterations, It represents the iterative position after t times of calibrating the local model, It is represented as the position of the kth remaining local model after t iterations;

[0027] The iteration position of each remaining local model is determined according to the surrounding behavior model of each remaining local model combined with the position of the calibrated local model at each iteration.

[0028] Preferably, updating the federated learning model by using a GWO algorithm according to the iteration position of each remaining local model to obtain an optimized federated learning model includes:

[0029] Obtain the model optimization parameters after each client iteration according to the iteration position of each remaining local model;

[0030] The federated learning model is updated through the GWO algorithm based on the model optimization parameters after each client iteration:

[0031]

[0032] in, is represented by the updated federated learning model, Q is the number of clients, m is the mth client, Represents the model optimization parameters after the mth client iteration;

[0033] After updating the federated learning model for the maximum number of iterations, the optimized federated learning model is output.

[0034] A federated learning optimization system in a smart grid, the system comprising:

[0035] A setting module is used to initialize the federated learning model in the smart grid and set the parameters of the GWO algorithm according to the maximum number of iterations of the federated learning model;

[0036] The screening module is used to build a local model for each client, determine the fitness of each local model, and screen out the calibrated local model based on the fitness;

[0037] A determination module, used to calculate the position of the calibrated local model at each iteration, and determine the iteration position of each remaining local model according to the position of the calibrated local model at each iteration and the surrounding behavior of the remaining local models;

[0038] The updating module is used to update the federated learning model through the GWO algorithm according to the iteration position of each remaining local model to obtain an optimized federated learning model.

[0039] Preferably, the setting module includes:

[0040] The first training submodule is used to determine the number of clients, allocate initial training tasks and training process hyperparameters according to the number of clients, and perform model training through a fixed machine learning algorithm to obtain an initialized federated learning global model;

[0041] The first calculation submodule is used to obtain the maximum number of training iterations for initializing the federated learning global model, and calculate the position update calculation coefficient according to the maximum number of training iterations:

[0042] A=2ar1-a

[0043] C=2r2

[0044]

[0045] Among them, A represents the first position update calculation coefficient, C represents the second position update calculation coefficient, r1 and r2 are random numbers in the range of [0,1], t represents the current iteration number, and T represents the maximum training iteration number for initializing the global model of federated learning.

[0046] Preferably, the screening module comprises:

[0047] The second training submodule is used to send the global model parameters of the federated learning model through the server. Each client trains the model through the local data set according to the global model parameters to generate a local model:

[0048]

[0049] Among them, D j Represented as the local model of the jth client, is the local model of the jth client after training for the maximum number of iterations, η is the learning rate, It is represented as the gradient of the loss function calculated based on the data of the jth customer j;

[0050] A first determination submodule is used to determine the communication cost and the data transmission cost of each local model, and determine the fitness of each local model according to the communication cost and the data transmission cost;

[0051] The screening submodule is used to screen out the top three local models α, β and δ in terms of fitness and use them as calibration local models.

[0052] Preferably, the determining module includes:

[0053] The second determination submodule is used to determine the spatial dimension, and determine the position representation of each iteration of the calibration local model according to the spatial dimension: D represents the spatial dimension;

[0054] The model for the surrounding behavior of the remaining local model is:

[0055]

[0056] in, It is represented as the position of the kth remaining local model after t+1 iterations, It represents the iterative position after t times of calibrating the local model, It is represented as the position of the kth remaining local model after t iterations;

[0057] The third determination submodule is used to determine the iteration position of each remaining local model according to the surrounding behavior model of each remaining local model combined with the position of the calibrated local model at each iteration.

[0058] Preferably, the root update module includes:

[0059] An acquisition submodule, used to acquire the model optimization parameters after each client iteration according to the iteration position of each remaining local model;

[0060] The update submodule is used to update the federated learning model through the GWO algorithm according to the model optimization parameters after each client iteration:

[0061]

[0062] in, is represented by the updated federated learning model, Q is the number of clients, m is the mth client, Represents the model optimization parameters after the mth client iteration;

[0063] The output submodule is used to output the optimized federated learning model after updating the federated learning model for the maximum number of iterations.

[0064] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description and the accompanying drawings.

[0065] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention.

[0067] Figure 1 A flowchart of a federated learning optimization method in a smart grid provided by the present invention;

[0068] Figure 2 Another working flow chart of a federated learning optimization method in a smart grid provided by the present invention;

[0069] Figure 3 A schematic diagram of the structure of a federated learning optimization system in a smart grid provided by the present invention. DETAILED DESCRIPTION

[0070] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0071] At present, as a core component of modern power systems, smart grids aim to improve the monitoring, analysis and management capabilities of power grids by integrating advanced information and communication technologies, and to achieve efficient, reliable and safe energy supply. Centralized machine learning methods in smart grids require data to be stored in a central server. This has raised concerns about privacy and security. Federated learning has been applied to smart grids due to its privacy protection and distributed computing performance. However, in practical applications, there are problems such as communication bandwidth limitations and the possibility that nodes may perform malicious behaviors, which cause the model to fail to operate as expected, fail to provide reliable support for the operation and management of smart grids, and reduce the convergence efficiency of the model. In order to solve the above problems, this embodiment discloses a federated learning optimization method in a smart grid.

[0072] A federated learning optimization method in smart grid, such as Figure 1 As shown, the following steps are included:

[0073] Step S101, initializing the federated learning model in the smart grid and setting the parameters of the GWO algorithm according to the maximum number of iterations of the federated learning model;

[0074] Step S102: construct a local model of each client, determine the fitness of each local model, and select a calibrated local model according to the fitness;

[0075] Step S103, calculating the position of the calibrated local model at each iteration, and determining the iteration position of each remaining local model according to the position of the calibrated local model at each iteration and the surrounding behavior of the remaining local models;

[0076] Step S104: Update the federated learning model through the GWO algorithm according to the iteration position of each remaining local model to obtain an optimized federated learning model.

[0077] In this embodiment, the iteration position is represented as a model parameter for each client;

[0078] In this embodiment, the fitness is represented by the degree of fit between the local model of each client and the global model. The higher the data quality, the higher the fitness.

[0079] The working principle of the above technical solution is as follows: initialize the federated learning model in the smart grid and set the parameters of the GWO algorithm according to the maximum number of iterations of the federated learning model; build a local model of each client, determine the fitness of each local model, and screen out a calibrated local model according to the fitness; calculate the position of the calibrated local model at each iteration, and determine the iteration position of each remaining local model according to the position of the calibrated local model at each iteration and the surrounding behavior of the remaining local models; update the federated learning model through the GWO algorithm according to the iteration position of each remaining local model to obtain an optimized federated learning model.

[0080] The beneficial effects of the above technical solution are: by screening out the calibrated local model and then updating the iteration position of the remaining local models according to the iteration position of the calibrated local model, that is, the model parameters can be combined with the parameter combination that can optimize the model performance so that the parameters of the client model gradually approach the optimal solution, thereby realizing the optimization of the federated learning model, improving the convergence efficiency of the model, and realizing dynamic adjustment of the weight of the client, solving the problems mentioned in the prior art of communication bandwidth limitations and the possibility of nodes performing malicious behaviors, which cause the model to fail to operate as expected, fail to provide reliable support for the operation and management of the smart grid, and reduce the convergence efficiency of the model.

[0081] In this embodiment, before initializing the federated learning model in the smart grid and setting the parameters of the GWO algorithm according to the maximum number of iterations of the federated learning model, the following steps are also included:

[0082] Determine a data structured configuration for each client, and determine a data security computing protocol for a data object of each client based on the data structured configuration;

[0083] Determine the encryption feature configuration of each client's data object according to the data security computing protocol of each client;

[0084] Determine the global model data integration feature of the federated learning model based on the encrypted feature configuration, and determine the model parameter gradient reference of the global model based on the data integration feature;

[0085] Select target gradient parameter data according to the model parameter gradient reference of the global model and the preset model task of the federated learning model;

[0086] The target gradient parameter data is used as reference samples to initialize the federated learning model in smart grid.

[0087] The beneficial effects of the above data solution are: it can achieve the encryption stability of the data of each client and the reliability of the model accuracy and stability of the federated learning model, improve the practicality, and lay the foundation for subsequent model updates.

[0088] In one embodiment, the initializing the federated learning model in the smart grid and setting the parameters of the GWO algorithm according to the maximum number of iterations of the federated learning model includes:

[0089] Determine the number of clients, allocate initial training tasks and training process hyperparameters according to the number of clients, and perform model training using a fixed machine learning algorithm to obtain an initialized federated learning global model;

[0090] Get the maximum number of training iterations for initializing the federated learning global model, and calculate the position update calculation coefficient based on the maximum number of training iterations:

[0091] A=2ar1-a

[0092] C=2r2

[0093]

[0094] Among them, A represents the first position update calculation coefficient, C represents the second position update calculation coefficient, r1 and r2 are random numbers in the range of [0,1], t represents the current iteration number, and T represents the maximum training iteration number for initializing the global model of federated learning.

[0095] The beneficial effect of the above technical solution is: by obtaining the initialized federated learning global model, a basic model that maintains the model performance can be generated according to the number of clients, thereby laying the foundation for subsequent model optimization.

[0096] In one embodiment, Figure 2 As shown, the construction of the local model of each client, determining the fitness of each local model, and selecting the calibrated local model according to the fitness include:

[0097] Step S201: The global model parameters of the federated learning model are sent by the server, and each client trains the model using a local data set according to the global model parameters to generate a local model:

[0098]

[0099] Among them, D j Represented as the local model of the jth client, is the local model of the jth client after training for the maximum number of iterations, η is the learning rate, It is represented as the gradient of the loss function calculated based on the data of the jth customer j;

[0100] Step S202: determining the communication cost and the data transmission cost of each local model, and determining the fitness of each local model according to the communication cost and the data transmission cost;

[0101] Step S203: Filter out the top three local models α, β and δ in terms of fitness and use them as calibrated local models.

[0102] The beneficial effect of the above technical solution is: by determining the fitness of the local model of each client based on the communication cost and data transmission cost, the client with the highest weight can be intuitively selected according to the data volume and data quality of each client and used as the leader for other models to optimize parameters, thereby ensuring the efficiency and stability of subsequent model optimization and further improving the model convergence speed.

[0103] In this embodiment, the communication cost and the data transmission cost of each local model are determined, and the fitness of each local model is determined according to the communication cost and the data transmission cost, including:

[0104] Determine cloud resource environment configuration parameters of the server, and determine communication execution characteristics of the server based on the cloud resource environment configuration parameters;

[0105] Determine the communication link according to the number of clients, and determine the traffic allocation parameters of the server on the communication link according to the communication execution characteristics;

[0106] Obtain model upload parameters of each local model, and allocate a communication link to each local model according to the communication protocol of the model upload parameters;

[0107] Determine the target communication link of each local model according to the allocation result, and determine the communication signal sparsity of the target communication link according to the traffic allocation parameter of the server on the communication link;

[0108] The communication cost and the data transmission cost of each local model are determined according to the sparsity of the communication signal, and the fitness of each local model is determined based on the communication cost and the data transmission cost.

[0109] The beneficial effect of the above technical solution is: by determining the allocated communication link of each client's local model and then determining the communication cost and data transmission cost according to the sparsity of the communication signal, the communication cost and data transmission cost can be intuitively evaluated based on the complexity of each client's own upload parameters and the link traffic distribution characteristics, thereby ensuring the accuracy of the evaluation results.

[0110] In one embodiment, calculating the position of the calibrated local model at each iteration, and determining the iteration position of each remaining local model according to the position of the calibrated local model at each iteration and the surrounding behavior of the remaining local models, includes:

[0111] Determine the spatial dimension and determine the position representation of each iteration of the calibration local model based on the spatial dimension: D represents the spatial dimension;

[0112] The model for the surrounding behavior of the remaining local model is:

[0113]

[0114] in, It is represented as the position of the kth remaining local model after t+1 iterations, It represents the iterative position after t times of calibrating the local model, It is represented as the position of the kth remaining local model after t iterations;

[0115] The iteration position of each remaining local model is determined according to the surrounding behavior model of each remaining local model combined with the position of the calibrated local model at each iteration.

[0116] The beneficial effect of the above technical solution is: by determining the iteration position according to the surrounding behavior model of the local model, the iteration position of the local model, that is, the model optimization parameter, can be quickly located based on the position tracking coefficient of the surrounding behavior, thereby improving work efficiency and stability.

[0117] In one embodiment, updating the federated learning model by using the GWO algorithm according to the iteration position of each remaining local model to obtain an optimized federated learning model includes:

[0118] Obtain the model optimization parameters after each client iteration according to the iteration position of each remaining local model;

[0119] The federated learning model is updated through the GWO algorithm based on the model optimization parameters after each client iteration:

[0120]

[0121] in, is represented by the updated federated learning model, Q is the number of clients, m is the mth client, Represents the model optimization parameters after the mth client iteration;

[0122] After updating the federated learning model for the maximum number of iterations, the optimized federated learning model is output.

[0123] The beneficial effects of the above technical solution are: by updating the federated learning model through the GWO algorithm according to the model optimization parameters, the position update coefficient can be updated in real time, and then the best calibrated local model in each iteration number can be screened out as a reference model to realize dynamic model parameter update of other local models, thereby maximizing the convergence speed of the model.

[0124] In one embodiment, this embodiment also discloses a federated learning optimization system in a smart grid, such as Figure 3 As shown, the system includes:

[0125] A setting module 301 is used to initialize the federated learning model in the smart grid and set the parameters of the GWO algorithm according to the maximum number of iterations of the federated learning model;

[0126] The screening module 302 is used to construct a local model of each client, determine the fitness of each local model, and screen out a calibration local model according to the fitness;

[0127] A determination module 303 is used to calculate the position of the calibrated local model at each iteration, and determine the iteration position of each remaining local model according to the position of the calibrated local model at each iteration and the surrounding behavior of the remaining local models;

[0128] The updating module 304 is used to update the federated learning model through the GWO algorithm according to the iteration position of each remaining local model to obtain an optimized federated learning model.

[0129] The working principle and beneficial effects of the above technical solution have been explained in the method embodiment and will not be repeated here.

[0130] In one embodiment, the setting module includes:

[0131] The first training submodule is used to determine the number of clients, allocate initial training tasks and training process hyperparameters according to the number of clients, and perform model training through a fixed machine learning algorithm to obtain an initialized federated learning global model;

[0132] The first calculation submodule is used to obtain the maximum number of training iterations for initializing the federated learning global model, and calculate the position update calculation coefficient according to the maximum number of training iterations:

[0133] A=2ar1-a

[0134] C=2r2

[0135]

[0136] Among them, A represents the first position update calculation coefficient, C represents the second position update calculation coefficient, r1 and r2 are random numbers in the range of [0,1], t represents the current iteration number, and T represents the maximum training iteration number for initializing the global model of federated learning.

[0137] In one embodiment, the screening module comprises:

[0138] The second training submodule is used to send the global model parameters of the federated learning model through the server. Each client trains the model through the local data set according to the global model parameters to generate a local model:

[0139]

[0140] Among them, D j Represented as the local model of the jth client, is the local model of the jth client after training for the maximum number of iterations, η is the learning rate, It is represented as the gradient of the loss function calculated based on the data of the jth customer j;

[0141] A first determination submodule is used to determine the communication cost and the data transmission cost of each local model, and determine the fitness of each local model according to the communication cost and the data transmission cost;

[0142] The screening submodule is used to screen out the top three local models α, β and δ in terms of fitness and use them as calibration local models.

[0143] In one embodiment, the determining module includes:

[0144] The second determination submodule is used to determine the spatial dimension, and determine the position representation of each iteration of the calibration local model according to the spatial dimension: D represents the spatial dimension;

[0145] The model for the surrounding behavior of the remaining local model is:

[0146]

[0147] in, It is represented as the position of the kth remaining local model after t+1 iterations, It represents the iterative position after t times of calibrating the local model, It is represented as the position of the kth remaining local model after t iterations;

[0148] The third determination submodule is used to determine the iteration position of each remaining local model according to the surrounding behavior model of each remaining local model combined with the position of the calibrated local model at each iteration.

[0149] In one embodiment, the root update module includes:

[0150] An acquisition submodule, used to acquire the model optimization parameters after each client iteration according to the iteration position of each remaining local model;

[0151] The update submodule is used to update the federated learning model through the GWO algorithm according to the model optimization parameters after each client iteration:

[0152]

[0153] in, is represented by the updated federated learning model, Q is the number of clients, m is the mth client, Represents the model optimization parameters after the mth client iteration;

[0154] The output submodule is used to output the optimized federated learning model after updating the federated learning model for the maximum number of iterations.

[0155] Those skilled in the art should understand that the first and second in the present invention merely refer to different application stages.

[0156] Other embodiments of the present disclosure will be readily apparent to those skilled in the art after considering the specification and practicing the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0157] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A federated learning optimization method in a smart grid, characterized in that: The following steps are involved: Initialize the federated learning model in the smart grid and set the parameters of the GWO algorithm according to the maximum number of iterations of the federated learning model; Build a local model for each client, determine the fitness of each local model, and select and calibrate the local model based on the fitness; The position of the calibrated local model at each iteration is calculated, and the iteration position of each remaining local model is determined according to the position of the calibrated local model at each iteration and the encirclement behavior of the remaining local models; The federated learning model is updated through the GWO algorithm according to the iteration position of each remaining local model to obtain the optimized federated learning model.

2. The method for optimizing federated learning in a smart grid according to claim 1, characterized in that: Initializing the federated learning model in the smart grid and setting the parameters of the GWO algorithm according to the maximum number of iterations of the federated learning model include: Determine the number of clients, allocate initial training tasks and training process hyperparameters according to the number of clients, and perform model training using a fixed machine learning algorithm to obtain an initialized federated learning global model; Get the maximum number of training iterations for initializing the federated learning global model, and calculate the position update calculation coefficient based on the maximum number of training iterations: A=2ar1-a C=2r2 Where A represents the first position update calculation coefficient, C represents the second position update calculation coefficient, r1 and r2 are random numbers in the range [0,1], t represents the current iteration number, and T represents the maximum training iteration number for initializing the global model of federated learning.

3. The method for optimizing federated learning in a smart grid according to claim 1, characterized in that: The step of constructing a local model of each client, determining the fitness of each local model, and selecting a calibrated local model according to the fitness includes: The global model parameters of the federated learning model are sent by the server. Each client trains the model with a local data set based on the global model parameters to generate a local model: Among them, D j Represented as the local model of the jth client, is the local model of the jth client after training for the maximum number of iterations, η is the learning rate, It is represented as the gradient of the loss function calculated based on the data of the jth customer j; Determine the communication cost and data transmission cost of each local model, and determine the fitness of each local model according to the communication cost and data transmission cost; The top three local models α, β and δ in terms of fitness are selected and used as calibration local models.

4. The method for optimizing federated learning in a smart grid according to claim 1, characterized in that: The calculating the position of the calibrated local model at each iteration, and determining the iteration position of each remaining local model according to the position of the calibrated local model at each iteration and the surrounding behavior of the remaining local models, includes: Determine the spatial dimension and determine the position representation of each iteration of the calibration local model based on the spatial dimension: D represents the spatial dimension; The model for the surrounding behavior of the remaining local model is: in, It is represented as the position of the kth remaining local model after t+1 iterations, It represents the iterative position after t times of calibrating the local model, It is represented as the position of the kth remaining local model after t iterations; The iteration position of each remaining local model is determined according to the surrounding behavior model of each remaining local model combined with the position of the calibrated local model at each iteration.

5. The method for optimizing federated learning in a smart grid according to claim 1, characterized in that: The updating of the federated learning model by using the GWO algorithm according to the iteration position of each remaining local model to obtain an optimized federated learning model includes: Obtain the model optimization parameters after each client iteration according to the iteration position of each remaining local model; The federated learning model is updated through the GWO algorithm based on the model optimization parameters after each client iteration: in, is represented by the updated federated learning model, Q is the number of clients, m is the mth client, Represents the model optimization parameters after the mth client iteration; After updating the federated learning model for the maximum number of iterations, the optimized federated learning model is output.

6. A federated learning optimization system in a smart grid, characterized in that: The system includes: A setting module is used to initialize the federated learning model in the smart grid and set the parameters of the GWO algorithm according to the maximum number of iterations of the federated learning model; The screening module is used to build a local model for each client, determine the fitness of each local model, and screen out the calibrated local model based on the fitness; A determination module, used to calculate the position of the calibrated local model at each iteration, and determine the iteration position of each remaining local model according to the position of the calibrated local model at each iteration and the surrounding behavior of the remaining local models; The updating module is used to update the federated learning model through the GWO algorithm according to the iteration position of each remaining local model to obtain an optimized federated learning model.

7. The federated learning optimization system in the smart grid according to claim 6, characterized in that: The setting module includes: The first training submodule is used to determine the number of clients, allocate initial training tasks and training process hyperparameters according to the number of clients, and perform model training through a fixed machine learning algorithm to obtain an initialized federated learning global model; The first calculation submodule is used to obtain the maximum number of training iterations for initializing the federated learning global model, and calculate the position update calculation coefficient according to the maximum number of training iterations: A=2ar1-a C=2r2 Where A represents the first position update calculation coefficient, C represents the second position update calculation coefficient, r1 and r2 are random numbers in the range [0,1], t represents the current iteration number, and T represents the maximum training iteration number for initializing the global model of federated learning.

8. The federated learning optimization system in the smart grid according to claim 6, characterized in that: The screening module comprises: The second training submodule is used to send the global model parameters of the federated learning model through the server. Each client trains the model through the local data set according to the global model parameters to generate a local model: Among them, D j Represented as the local model of the jth client, is the local model of the jth client after training for the maximum number of iterations, η is the learning rate, It is represented as the gradient of the loss function calculated based on the data of the jth customer j; A first determination submodule is used to determine the communication cost and the data transmission cost of each local model, and determine the fitness of each local model according to the communication cost and the data transmission cost; The screening submodule is used to screen out the top three local models α, β and δ in terms of fitness and use them as calibration local models.

9. The federated learning optimization system in the smart grid according to claim 6, characterized in that: The determining module comprises: The second determination submodule is used to determine the spatial dimension, and determine the position representation of each iteration of the calibration local model according to the spatial dimension: D represents the spatial dimension; The model for the surrounding behavior of the remaining local model is: in, It is represented as the position of the kth remaining local model after t+1 iterations, It represents the iterative position after t times of calibrating the local model, It is represented as the position of the kth remaining local model after t iterations; The third determination submodule is used to determine the iteration position of each remaining local model according to the surrounding behavior model of each remaining local model combined with the position of the calibrated local model at each iteration.

10. The federated learning optimization system in the smart grid according to claim 6, characterized in that: The update module comprises: An acquisition submodule, used to acquire the model optimization parameters after each client iteration according to the iteration position of each remaining local model; The update submodule is used to update the federated learning model through the GWO algorithm according to the model optimization parameters after each client iteration: in, is represented by the updated federated learning model, Q is the number of clients, m is the mth client, Represents the model optimization parameters after the mth client iteration; The output submodule is used to output the optimized federated learning model after updating the federated learning model for the maximum number of iterations.