A Flexible Production Planning and Forecasting System and Method Based on Knowledge Graphs and Large Language Models
By combining knowledge graphs with large language models, integrating multimodal data and performing self-updating, the problems of data flow breakpoints and insufficient adaptability in flexible production decision-making systems are solved, achieving efficient and transparent flexible production planning and forecasting.
Patent Information
- Application Number
- CN202411490178.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2044-10-24
AI Technical Summary
Existing flexible production decision-making systems face problems such as data flow breakpoints, lack of multimodal data, insufficient knowledge iteration, and insufficient adaptability and interpretability of large models, resulting in slow response and poor decision-making effects.
A flexible production planning prediction system based on knowledge graphs and large language models is adopted. Through the establishment of feature network graphs, training of flexible production large language models, stacking of flexible production planning models and construction of knowledge graphs, multimodal data is integrated and self-updated and optimized to achieve real-time decision-making and efficient production.
It significantly improves the real-time responsiveness of flexible production decisions, data processing accuracy, and production efficiency, reduces costs, and enhances the transparency and interpretability of decisions, ensuring the system operates efficiently and stably in complex environments.
Smart Images

Figure CN119623911B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of flexible production decision-making technology, specifically to a flexible production planning and forecasting system and method based on knowledge graphs and large language models. Background Technology
[0002] First, flexible manufacturing, as a key technology in intelligent manufacturing, faces the challenge of data flow disruptions. Currently, intelligent manufacturing systems suffer from slow response times due to poor data flow between the external market and internal production, making it difficult to meet immediate customer needs and limiting the real-time decision-making capabilities of flexible manufacturing. For example, Chinese patent application CN118261741A, published on May 30, 2024, entitled "A Flexible Production Management System and Method Based on Digital Twins," constructs a flexible production management system including a target time period marking module, a processable line set construction module, a usage priority analysis module, a new raw material comparison module, an optimal waiting line generation module, and an AGV equipment operation module. However, this invention does not base flexible production management on customer needs, resulting in a disconnect between flexible production decisions and actual requirements.
[0003] Secondly, the existing data foundation for flexible production decision-making is relatively singular, lacking multimodal data. It largely relies on textual and numerical data such as orders, production logs, and sensor data. However, reality involves more complex influencing factors, such as customer behavior and production line monitoring, resulting in multimodal data. For example, Chinese patent application CN219861615U, published on May 24, 2023, entitled "A Flexible Production System for Aluminum Electrolysis Cells," controls flexible production through power, temperature, and flow monitoring modules. However, this invention only considers sensor data, making the data somewhat singular. Therefore, it is necessary to integrate multimodal data such as IoT, customer feedback, and market dynamics to improve the accuracy of flexible production decisions while increasing production efficiency and reducing costs through richer data.
[0004] Secondly, existing flexible manufacturing decision-making knowledge lacks real-time updates. Currently, flexible manufacturing technologies face a rapidly changing environment, including fluctuating customer demands and rapid product market iterations. However, most existing flexible manufacturing technologies are based on fixed knowledge and lack iterative updates to adapt to environmental changes, resulting in insufficient dynamic adaptability. Faced with a complex and volatile market environment, existing flexible manufacturing decision-making systems often malfunction or fail, severely impacting decision-making effectiveness. For example, Chinese patent application CN116993126A, published on September 14, 2023, entitled "A Flexible Production Scheduling Method and Device Based on a Hybrid Genetic Algorithm," uses a hybrid genetic algorithm for flexible production scheduling. However, this algorithm itself lacks a self-updating mechanism and cannot dynamically adapt to changes in the market environment. Therefore, there is an urgent need to introduce advanced multimodal large-scale models to enhance data processing efficiency and decision-making effectiveness.
[0005] Finally, while existing multimodal large-scale models are widely used, they suffer from bottlenecks in adaptability, update mechanisms, and interpretability in specific intelligent manufacturing scenarios. They are insufficient in flexibly responding to complex changes in production environments and cannot capture market dynamics in real time; the decision-making process is opaque, making it difficult to provide decision-makers with intuitive and reliable decision-making basis. For example, Chinese patent application number CN117610896A, published on January 24, 2024, entitled "Intelligent Scheduling System Based on Industrial Large-Scale Model," describes a solution that uses industrial large-scale model data for efficient and resource-saving scheduling control analysis to achieve real-time and efficient scheduling control to meet changing industrial production needs. However, the large-scale model used in this solution lacks domain-specific knowledge, resulting in poor interpretability of the model output. Therefore, there is an urgent need to introduce advanced large-scale model knowledge enhancement technologies to improve domain-specific adaptability and interpretability. Summary of the Invention
[0006] The purpose of this invention is to address the shortcomings of existing technologies by providing a flexible production planning and forecasting system and method based on knowledge graphs and large language models.
[0007] This invention provides a flexible production planning and forecasting system based on knowledge graphs and large language models, comprising:
[0008] The feature network graph building module is used to aggregate historical production data of the flexible factory to obtain feature network graph data;
[0009] The flexible production large language model building module is used to train natural language algorithms using feature network graph data to obtain a flexible production large language model;
[0010] The flexible production planning model building module is used to combine several modern heuristic algorithm layers as stacked modules to form a stacked framework, and use feature network graph data to train the stacked framework to obtain a flexible production planning model.
[0011] The knowledge graph building module is used to input image data from the feature network graph data into the flexible production big language model and convert it into text data. Then, the text data obtained from the image data conversion is merged with the text data from the feature network graph data and classified according to the data meaning to obtain customer demand text data and comprehensive flexible production plan text data. The feature network graph data is input into the flexible production big language model to obtain demand-production relationship text data. Event extraction is performed on the customer demand text data and comprehensive flexible production plan text data from the flexible factory's historical production data to obtain customer demand events and comprehensive flexible production plan events. Based on the demand-production relationship text data, the customer demand events and comprehensive flexible production plan events are linked to obtain the knowledge graph.
[0012] The flexible production planning forecasting module is used to input the flexible production language model, flexible production planning model, knowledge graph and current customer demand into the language model development framework and make predictions based on the current customer demand to obtain comprehensive flexible production planning forecast results.
[0013] Furthermore, in the feature network graph establishment module, the specific method for aggregating historical production data of the flexible factory to obtain feature network graph data is as follows:
[0014] Establish a feature matrix E representing historical data i The formula is as follows:
[0015]
[0016] in, Let a represent the text data feature vector a, the image data feature vector b, and the code data feature vector c, respectively. Construct a feature network graph consisting of nodes and edges between nodes, and use the feature matrix E representing historical data. i As the initial representation of each node, the weights between nodes are the edges of the feature network graph, and i represents the sequence number of the historical data and the sequence number of its corresponding node.
[0017] The GCN aggregator is used to aggregate the information of node i and all its neighboring nodes j, and the node representation is updated. The specific steps are as follows: using the weight matrix W l The representations of node i and all its neighboring nodes j are linearly transformed and then normalized. The normalized representations of all neighboring nodes j of node i are summed. Then, the representation of node i in the next layer of the GCN aggregator is processed by an activation function to obtain the node representation of node i after aggregation by the GCN aggregator. The formula is as follows:
[0018]
[0019] in, This represents the (l+1)th layer of node i in the GCN aggregator. Let σ represent the representation of node i's neighbor node j in the l-th layer of the GCN aggregator, and let W represent the activation function. l N represents the weight matrix of the l-th layer in the GCN aggregator. i Let d(i,j) represent the set of neighboring nodes j of node i, and let d(i,j) represent the distance between node i and its neighboring node j.
[0020] The GAT aggregator uses an attention mechanism to aggregate the information of node i and all its neighboring nodes j, and updates the node representation. The specific steps are as follows: Calculate the attention weights between node i and all its neighboring nodes j using an additive attention mechanism, and then weight the neighboring nodes j of node i. Sum the weighted representations of all neighboring nodes j to obtain the representation of node i in the next layer of the GAT aggregator. Then, apply an activation function to obtain the node representation of node i after aggregation by the GAT aggregator. The formula is as follows:
[0021]
[0022] in, This represents the attention weight between node i and its neighbor node j. Let j represent the neighboring node j of node i in the l-th layer of the GAT aggregator. This represents the (l+1)th layer representation of node i in the GAT aggregator;
[0023] Aggregation is performed using HAN aggregators and GNN aggregators based on the homogeneity and heterogeneity relationships between node i and its neighboring nodes j, respectively. The specific steps are as follows: In the HAN aggregator, a content attention mechanism is used to calculate the attention weights between homogeneous nodes and then aggregate them; in the GNN aggregator, a key-value attention mechanism is used to calculate the attention weights between heterogeneous nodes and then aggregate them. The formula is expressed as follows:
[0024]
[0025] in, Let represent the attention scores between node i and its neighbor node j (for nodes with homogeneous relationships) and node i and its neighbor node j (for nodes with heterogeneous relationships), respectively. This represents the representation of node i in the l-th layer of the HAN aggregator. This represents the representation of node i's neighbor node j in the l-th layer of the HAN aggregator. This represents the representation of node i in the l-th layer of the GNN aggregator. Let j represent the neighbor node j of node i in the l-th layer of the GNN aggregator. and Let represent the weight matrix for converting the representation of node i into a query vector and the weight matrix for converting the representation of node i's neighbor node j into a query vector, respectively. This represents the weight matrix used to convert the representations of node i's neighbor node j into key vectors. This represents the weight matrix that converts the representation of node i into a value vector, and softmax represents the softmax function. This represents the (l+1)th layer representation of node i obtained by aggregating homogeneous nodes in the HAN aggregator. Let represent the (l+1)th layer representation of node i obtained by heterogeneous node aggregation in the GNN aggregator, and T denotes transpose;
[0026] Finally, an asynchronous update is performed. The specific steps are as follows: using the update gate selection mechanism, the best aggregation method is selected based on the representation of node i, and then the representation of node i is updated using the selected best aggregation method. The formula is expressed as:
[0027]
[0028] Where β represents the update gate selection mechanism, and δ is a parameterized function of the multilayer perceptron. The function δ is used to select the best node representation from the node representations obtained by the GCN aggregator, GAT aggregator, HAN aggregator, and GNN aggregator through the update gate selection mechanism as the final node representation. The final representation of node i is... Determined by the update gate selection mechanism, Z i The function δ represents the selection result of the final representation of node i. The weight in the aggregator corresponding to the final representation of node i is the final representation of the edge. The final representation of node i and the final representation of the edge constitute the feature network graph data. According to the meaning of the final representation of node i, the feature network graph data is divided into customer demand data and comprehensive flexible production plan data.
[0029] Furthermore, in the flexible production large language model building module, the specific method for training the natural language algorithm using feature network graph data to obtain the flexible production large language model is as follows:
[0030] The flexible production large language model adopts the Transformer algorithm, in which the TTT layer is used to replace the self-attention mechanism in the Transformer algorithm. The TTT layer includes a multilayer perceptron.
[0031] The forward propagation function of the flexible production large language model is as follows: First, by improving the encoder in the Transformer algorithm, the input sequence of the current time step is combined with the hidden state of the previous time step to obtain the context vector. The context vector is then input into a multilayer perceptron with a TTT layer. For a multilayer perceptron with l layers, the output z of the l-th layer... l and activate output a l It can be represented as:
[0032]
[0033] a l-1 =φ l (z l )
[0034] in, b is the weight matrix of the l-th layer in a multilayer perceptron. l It is the bias vector of the l-th layer in a multilayer perceptron, and the hidden state includes the weight matrix. and bias vector b l a l-1 It is the activation output of the (l-1)th layer. When the input layer l = 1, a 0 φ is the activation output of layer 1. l It is the ReLU activation function of the l-th layer;
[0035] Then, in the TTT layer, the hidden state is updated using gradient descent, where the hidden state consists of a weight matrix and a bias vector. The loss function is calculated using backpropagation, and the gradient of the multilayer perceptron parameters is:
[0036]
[0037] in, To represent the loss function L with respect to the weight matrix W of the l-th layer l gradient, To represent the loss function L with respect to the bias vector b of the l-th layer l The gradient of L is the loss function;
[0038] Then, the weight matrix and bias vector of the multilayer perceptron are updated using gradient descent:
[0039]
[0040] in, This indicates that the weight matrix of the l-th layer is updated using gradient descent. To represent updating the bias vector of the l-th layer using gradient descent, η is the learning rate;
[0041] The context vector output by the encoder and the updated hidden state in the multilayer perceptron of the TTT layer are input into the softmax function of the decoder in the improved Transformer algorithm. The softmax function obtains the output of the Transformer algorithm based on the context vector and the updated hidden state.
[0042] The feature network graph data is divided into training and validation sets to train the improved Transformer algorithm. During training, the input sequence of the improved Transformer algorithm is the customer demand data in the feature network graph data, and the corresponding output is the comprehensive flexible production plan. During training, the customer demand data in the feature network graph data is transformed into the input sequence of the improved Transformer algorithm: the final representation of all nodes is serialized, node indices are added to the sequence to identify specific nodes, and weight matrices representing the final representation of edges are added to the sequence to obtain the input sequence for training. After the improved Transformer algorithm is trained, a flexible production large language model is obtained.
[0043] Furthermore, in the flexible production planning model building module, several modern heuristic algorithm layers are stacked as modules to form a stacked framework. The specific method for training the stacked framework using feature network graph data to obtain the flexible production planning model is as follows:
[0044] First, a stacked framework is selected as the structure of the flexible production planning model, and the genetic algorithm layer, particle swarm optimization layer, and simulated annealing layer are used as stacked modules of the stacked framework. Each stacked module adopts a linear stacking method: the output of one stacked module is used as the input of the next stacked module, and the target performance parameters of the flexible production planning model are determined.
[0045] Then, the customer demand data in the feature network graph data is serialized and input into the flexible production large language model for generative language augmentation to obtain feature-enhanced customer demand data as input to the flexible production planning model. The feature-enhanced customer demand data is in text modality. The genetic algorithm layer, particle swarm optimization layer, and simulated annealing layer are arranged and combined in sequence. The stacked frameworks of different sequences of the stacked modules obtained by the arrangement and combination are input into the feature-enhanced input sequence for training. Finally, cross-validation is used to evaluate the model's generalization ability to the target performance based on the target performance parameters. The stacked framework with the largest generalization ability is selected as the trained flexible production planning model.
[0046] Furthermore, the knowledge graph building module inputs the image data from the feature network graph data into the flexible production language model and converts it into text data. Then, it merges the text data obtained from the image data conversion with the text data from the feature network graph data and categorizes them according to data meaning to obtain customer demand text data and comprehensive flexible production plan text data. The feature network graph data is then input into the flexible production language model to obtain demand-production relationship text data. Event extraction is performed on the customer demand text data and comprehensive flexible production plan text data to obtain customer demand events and comprehensive flexible production plan events. The specific method for linking customer demand events and comprehensive flexible production plan events based on the demand-production relationship text data to obtain the knowledge graph is as follows:
[0047] Text data and image data of customer demand and integrated flexible production plan are extracted from feature network graph data. The image data of customer demand and integrated flexible production plan are input into the flexible production big language model to obtain customer demand text data and integrated flexible production plan text data converted from image data. The customer demand text data obtained from image conversion and the customer demand text data extracted from feature network graph data are merged to obtain a customer demand text database. The integrated production plan text data obtained from image conversion and the integrated production plan text data extracted from feature network graph data are merged to obtain an integrated flexible production plan text database. The feature network dataset is input into the flexible production big language model to obtain demand-production relationship text data. A demand-production relationship text database is established based on the demand-production relationship text data. The demand-production relationship text data is text data representing the relationship between customer demand and integrated flexible production plan.
[0048] Based on the relationship between customer demand and integrated flexible production planning in the demand-production relationship text database, events are extracted from the customer demand text data and integrated flexible production planning text data to obtain customer demand events and integrated flexible production planning events. The content of each event includes subject, type, time, location, attribute, and relationship. Customer demand event vectors and integrated flexible production planning event vectors are established according to the content of customer demand events and integrated flexible production planning events, respectively. The customer demand event vectors and integrated flexible production planning event vectors are linked to construct a knowledge graph.
[0049] The event is an action or state change with clear temporal and spatial attributes; the subject is an entity that participates in the event and has a causal relationship with the occurrence of the event; the relationship is the causal connection between events; and the attribute is a characteristic that describes the event.
[0050] In a knowledge graph, nodes represent events with entity and attribute labels. These events include customer demand events and comprehensive flexible production planning events. Edges between nodes represent the relationships between events. These edges are directed edges and include direct and indirect relationships.
[0051] The specific method for constructing a knowledge graph by linking customer demand event vectors and integrated flexible production planning event vectors is as follows:
[0052] The K-means clustering algorithm is used to identify and merge similar events. The specific method is as follows: In the K-means clustering algorithm, the silhouette coefficient is used to determine the K value, and the K-means++ algorithm is used to initialize the centroid. The following two steps are iterated until convergence: (1) Assign each node to the nearest centroid to form K clusters; (2) Recalculate the centroid of each cluster.
[0053] Each node is assigned a cluster label, which indicates the cluster to which it belongs. Nodes with the same or similar cluster labels are merged to obtain the final vector of each node. Edges are then added between the nodes according to the relationships between events to obtain the knowledge graph.
[0054] Furthermore, it also includes: a training adjustment and knowledge enhancement module, used to train and adjust the flexible production large language model using knowledge graph data; inputting a customer demand data from the feature network graph data into the trained and adjusted flexible production large language model to obtain several first flexible production plans, and inputting the obtained several first flexible production plans into a flexible production simulation model built using the DQN algorithm for reward value evaluation; inputting the first flexible production plan with the highest reward value among the several first flexible production plans into the knowledge graph, and traversing all customer demand data in the feature network graph data according to the above process;
[0055] Furthermore, in the training adjustment and knowledge enhancement module, the specific method for training and adjusting the flexible production large language model using knowledge graph data is as follows:
[0056] First, the feature network graph data and knowledge graph dataset are respectively input into different TTT layers in the flexible production large language model to obtain weighted features of the feature network graph data and weighted features of the knowledge graph data. Then, the weighted features of the feature network graph data and the weighted features of the knowledge graph data from different TTT layers are concatenated into vectors to form a fused feature representation, which is used as training data to train the flexible production large language model.
[0057] The process involves inputting a specific customer demand data point from the feature network graph data into a trained and adjusted flexible production language model to generate several first flexible production plans. These plans are then fed into a DQN algorithm for reward evaluation. The first flexible production plan with the highest reward value is then input into a knowledge graph. The specific method for traversing all customer demand data points in the feature network graph data following this process is as follows:
[0058] A flexible production simulation model is established, which employs the DQN algorithm to predict actions within the comprehensive flexible production plan based on the states in the plan. Actions are defined as machine adjustment parameters and movements within the comprehensive flexible production plan, while states are defined as material and environmental variables. The input to the flexible production simulation model is the state, and the output is the action. The flexible production simulation model is represented as follows:
[0059] Define a multidimensional vector S t S represents the state of the machine at time t, expressed by the formula: t =[s t1 ,s t2 ,...,s tn ], where s tn Let A represent the nth feature in the machine's state vector at time t, and define a multidimensional vector A. t Let A be a multidimensional vector representing the probability distribution of machine actions at time t. t Each dimension corresponds to an action, expressed by the formula: A t =[a t1 ,a t2 ,...,a tm ], where a tm This represents the probability of the m-th action in the machine's action vector at time t;
[0060] In the DQN algorithm, the Q-network will convert the state S t Mapped to action probability distribution A t The formula is expressed as: Q(S) t A t ;θ), where θ represents the parameter set of the DQN algorithm;
[0061] The reward obtained by the flexible production simulation model upon completing the current action is defined as the immediate reward, and the total reward obtained by the flexible production simulation model after a series of actions is defined as the cumulative reward. The formula for the reward function is as follows:
[0062]
[0063] Among them, G T′ R is the cumulative reward within time period T′. T′+k+1 The instant reward obtained within the time period T′+k+1, γ k It is the instant reward obtained by completing the current action within time step k;
[0064] The flexible production simulation model is trained, and the specific training process is as follows: Initialize the current network Q(S) t A t Define a target network Q′(S) with the same structure as the current network but different parameters.t A t Then, the flexible manufacturing plant interacts with the knowledge graph to record the current state, action, reward, and next state, represented as a tuple (S). t A t ,γ k ,S t+1 The interaction process is as follows: The flexible manufacturing plant executes action A. t After that, the state changed from S t Transfer to S t+1 and receive the current reward γ k The data is stored in the experience replay buffer of the DQN algorithm. A batch of empirically trained Q-networks is randomly selected from the experience replay buffer to update the parameters of the DQN algorithm. The training process includes the following steps: using the target network to calculate the Q-value Q(S) of the next state of the current network. t+1 A t+1 ;θ), the formula is:
[0065]
[0066] Calculate the loss function L using the mean squared error:
[0067] The gradient descent algorithm is used to minimize the loss function in order to update the parameters S of the DQN algorithm. t 、A t After updating θ, we obtain the trained flexible production simulation model;
[0068] The flexible production big data language model is set to output n results corresponding to the input customer demand data. The customer demand data in the feature network graph data is input into the flexible production big data language model to generate n comprehensive flexible production plans. Then, the n flexible production plans are input into the flexible production simulation model to calculate their respective cumulative rewards. The customer demand data in the feature network graph data is traversed, and the comprehensive flexible production plan with the highest cumulative reward value is selected in turn to extract the comprehensive flexible production plan event. The customer demand data corresponding to the comprehensive flexible production plan with the highest cumulative reward value is extracted to obtain the customer demand event. Finally, the comprehensive flexible production plan event and the customer demand event are input into the knowledge graph.
[0069] Simultaneously, the comprehensive flexible production plan predicted by the flexible production planning forecasting module is extracted into events and input into the knowledge graph.
[0070] Furthermore, in the flexible production planning forecasting module, the flexible production large language model, flexible production planning model, knowledge graph, and current customer demand are input into the language model development framework, and predictions are made based on the current customer demand to obtain a comprehensive flexible production planning forecast result. The specific method is as follows:
[0071] The flexible production language model, flexible production planning model, and knowledge graph are input into the langchain framework. Input data templates, constraint templates, short-term memory templates, and long-term memory templates are constructed within the langchain framework. These templates are then encapsulated as prompt words and used as input to the langchain framework. Short-term memory represents the result of each iteration of the langchain framework, while long-term memory represents the result at the end of the iteration. In the first iteration, current customer demand data and actual production constraints are input into the data template and constraint template, respectively. The current customer demand data is multimodal data including text, image, and code data. In the second iteration and subsequent iterations, the short-term memory obtained in each iteration is stored in the short-term memory template, and the long-term memory obtained at the end of the iteration is stored in the long-term memory template. The long-term memory represents the final comprehensive flexible production plan.
[0072] First, the langchain architecture invokes the knowledge graph. Based on the current customer demand data in the Prompt prompt, the langchain architecture retrieves the corresponding comprehensive flexible production plan from the knowledge graph. If a corresponding comprehensive flexible production plan is found, the langchain architecture outputs that comprehensive flexible production plan as the prediction result. If no corresponding comprehensive flexible production plan is found, the langchain architecture invokes the flexible production language model and the flexible production plan model to predict the flexible production plan. The prediction process is as follows:
[0073] The Prompt prompt is input into the flexible production language model. The flexible production language model makes predictions based on the customer demand data in the Prompt prompt to obtain the first flexible production plan. At the same time, the flexible production language model also performs generative language expansion on the customer demand data in the Prompt prompt to obtain feature-enhanced customer demand data. The feature-enhanced customer demand data is in text modality. The langchain architecture inputs the feature-enhanced customer demand data into the flexible production planning model to obtain the second flexible production plan. The langchain architecture then merges the first flexible production plan and the second flexible production plan to obtain the comprehensive flexible production plan.
[0074] After each iteration, the langchain architecture determines whether the comprehensive flexible production plan obtained in this iteration meets customer needs based on the constraints in the Prompt prompt. If the comprehensive flexible production plan obtained in this iteration does not meet customer needs, it is stored as short-term memory in the Prompt prompt. Based on the customer demand data in the Prompt prompt and all short-term memories, the langchain architecture calls the flexible production language model and the flexible production plan model for a new iteration. During the prediction process, the langchain architecture optimizes the flexible production language model and the flexible production plan model based on all short-term memories to obtain the result of the next iteration. If the comprehensive flexible production plan obtained in this iteration meets customer needs, it is output as the prediction result.
[0075] A flexible production planning forecasting method based on knowledge graphs and large language models includes the following steps:
[0076] The historical production data of the flexible factory is aggregated to obtain feature network graph data;
[0077] A flexible production large language model is obtained by training natural language algorithms using feature network graph data;
[0078] Several modern heuristic algorithm layers are stacked as modules to form a stacked framework. The stacked framework is trained using feature network graph data to obtain a flexible production planning model.
[0079] Image data from the feature network graph data is input into the flexible production big language model and converted into text data. The text data obtained from the image data conversion is then merged with the text data from the feature network graph data and classified according to data meaning to obtain customer demand text data and comprehensive flexible production plan text data. The feature network graph data is input into the flexible production big language model to obtain demand-production relationship text data. Event extraction is performed on the customer demand text data and comprehensive flexible production plan text data from the flexible factory's historical production data to obtain customer demand events and comprehensive flexible production plan events. Based on the demand-production relationship text data, the customer demand events and comprehensive flexible production plan events are linked to obtain a knowledge graph.
[0080] The flexible production language model, flexible production planning model, knowledge graph, and current customer needs are input into the language model development framework, and predictions are made based on current customer needs to obtain comprehensive flexible production planning prediction results.
[0081] A computer program product includes a computer program / instructions that, when executed by a processor, implement the aforementioned flexible production planning prediction method based on knowledge graphs and large language models.
[0082] The beneficial effects of this invention are as follows:
[0083] 1. By generating a knowledge graph, the problem of data flow breakpoints in traditional flexible production decision-making systems is effectively overcome. This method significantly improves the system's real-time decision-making capabilities by integrating and analyzing customer demand data and flexible production decision-making data, ensuring that flexible production decisions can respond to market changes more quickly and accurately.
[0084] 2. A multimodal data processing method based on feature network graphs can simultaneously process heterogeneous data from multiple sources, including the Internet of Things (IoT), customer feedback, and market dynamics. By optimizing the data processing workflow, this method not only improves the accuracy of flexible production decisions but also promotes increased production efficiency and reduced costs, significantly enhancing enterprise operational effectiveness.
[0085] 3. By training a large-scale, flexible production language model, the system achieves self-updating and continuous optimization. This model can automatically learn and adapt to new production environments and market demands, thereby improving processing efficiency and decision-making efficiency. This self-evolutionary capability ensures that the system maintains a highly efficient and stable operating state when facing complex and ever-changing production environments.
[0086] 4. By self-updating and training the flexible production planning model using the knowledge graph, the system further enhances the knowledge reserves and decision-making capabilities of the flexible production big data model within its professional domain. Through the synergistic effect of these three elements, more specific flexible production plans can be predicted. Simultaneously, the interpretability of the flexible production big data model and the flexible production planning model is improved, making the decision-making process more transparent and easier to understand, and strengthening trust and cooperation between humans and machines. These advantages collectively enhance the system's application effectiveness and value in actual production. Attached Figure Description
[0087] Figure 1 This is a block diagram of a flexible production planning and forecasting system based on knowledge graphs and large language models.
[0088] Figure 2 This is the overall route of the system of the present invention.
[0089] Figure 3 The method and process for obtaining feature network graph data.
[0090] Figure 4 This describes the workflow for training and adjusting a flexible production large language model using a knowledge graph.
[0091] Figure 5 This describes the training process and decision-making flow of the present invention. Detailed Implementation
[0092] To make the technical problems, technical solutions, and beneficial effects to be solved by this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and are not intended to limit the scope of this application.
[0093] Example 1
[0094] refer to Figure 1 A flexible production planning and forecasting system based on knowledge graphs and large language models includes:
[0095] The feature network diagram generation module aggregates historical production data from the flexible factory to obtain feature network diagram data. Both historical data and feature network diagram data are categorized by data modality, including text data, image data, and code data. Both are also categorized by data meaning, including customer demand data and comprehensive flexible production plan data. Figure 2 As shown;
[0096] The flexible production large language model building module is used to replace the self-attention mechanism in the Transformer algorithm with a TTT layer to obtain an improved Transformer algorithm, and to train the improved Transformer algorithm using feature network graph data to obtain a flexible production large language model.
[0097] The flexible production planning model building module is used to combine several modern heuristic algorithm layers as stacked modules to form a stacked framework, and use feature network graph data to train the stacked framework to obtain a flexible production planning model.
[0098] The knowledge graph building module is used to input image data from the feature network graph data into the flexible production big language model and convert it into text data. Then, the text data obtained from the image data conversion is merged with the text data from the feature network graph data and classified according to the data meaning to obtain customer demand text data and comprehensive flexible production plan text data. The feature network graph data is input into the flexible production big language model to obtain demand-production relationship text data. Event extraction is performed on the customer demand text data and comprehensive flexible production plan text data to obtain customer demand events and comprehensive flexible production plan events. Based on the demand-production relationship text data, the customer demand events and comprehensive flexible production plan events are linked to obtain the knowledge graph.
[0099] The flexible production planning forecasting module is used to input the flexible production language model, flexible production planning model, knowledge graph and current customer demand into the language model development framework and make predictions based on the current customer demand to obtain comprehensive flexible production planning forecast results.
[0100] (1) The specific method by which the feature network graph building module aggregates historical production data of the flexible factory to obtain feature network graph data is as follows:
[0101] Historical data is collected from IoT devices, including customer multimodal data and historical production line multimodal data. Customer multimodal data includes text data such as order information and basic customer information, as well as image and video data such as customer behavior. Production line multimodal data includes text data such as production logs, image and video data such as equipment operating status, and code data for controlling equipment operation.
[0102] Establish a feature matrix E representing historical data i The formula is as follows:
[0103]
[0104] in, Let a represent the text data feature vector a, the image data feature vector b, and the code data feature vector c, respectively. Construct a feature network graph consisting of nodes and edges between nodes, and use the feature matrix E representing historical data. i As the initial representation of each node, the weights between nodes are the edges of the feature network graph, and i represents the sequence number of the historical data and the sequence number of its corresponding node.
[0105] The GCN aggregator is used to aggregate the information of node i and all its neighboring nodes j, and the node representation is updated. The specific steps are as follows: using the weight matrix W l The representations of node i and all its neighboring nodes j are linearly transformed and then normalized. The normalized representations of all neighboring nodes j of node i are summed. Then, the representation of node i in the next layer of the GCN aggregator is processed by an activation function to obtain the node representation of node i after aggregation by the GCN aggregator. The formula is as follows:
[0106]
[0107] in, This represents the (l+1)th layer of node i in the GCN aggregator. Let σ represent the representation of node i's neighbor node j in the l-th layer of the GCN aggregator, and let W represent the activation function. l N represents the weight matrix of the l-th layer in the GCN aggregator. i Let d(i,j) represent the set of neighboring nodes j of node i, and let d(i,j) represent the distance between node i and its neighboring node j.
[0108] The GAT aggregator uses an attention mechanism to aggregate the information of node i and all its neighboring nodes j, and updates the node representation. The specific steps are as follows: Calculate the attention weights between node i and all its neighboring nodes j using an additive attention mechanism, and then weight the neighboring nodes j of node i. Sum the weighted representations of all neighboring nodes j to obtain the representation of node i in the next layer of the GAT aggregator. Then, apply an activation function to obtain the node representation of node i after aggregation by the GAT aggregator. The formula is as follows:
[0109]
[0110] in, This represents the attention weight between node i and its neighbor node j. Let j represent the neighboring node j of node i in the l-th layer of the GAT aggregator. This represents the (l+1)th layer representation of node i in the GAT aggregator;
[0111] Aggregation is performed using HAN aggregators and GNN aggregators based on the homogeneity and heterogeneity relationships between node i and its neighboring nodes j, respectively. The specific steps are as follows: In the HAN aggregator, a content attention mechanism is used to calculate the attention weights between homogeneous nodes and then aggregate them; in the GNN aggregator, a key-value attention mechanism is used to calculate the attention weights between heterogeneous nodes and then aggregate them. The formula is expressed as follows:
[0112]
[0113] in, Let represent the attention scores between node i and its neighbor node j (for nodes with homogeneous relationships) and node i and its neighbor node j (for nodes with heterogeneous relationships), respectively. This represents the representation of node i in the l-th layer of the HAN aggregator. This represents the representation of node i's neighbor node j in the l-th layer of the HAN aggregator. This represents the representation of node i in the l-th layer of the GNN aggregator. Let j represent the neighbor node j of node i in the l-th layer of the GNN aggregator. and Let represent the weight matrix for converting the representation of node i into a query vector and the weight matrix for converting the representation of node i's neighbor node j into a query vector, respectively. This represents the weight matrix used to convert the representations of node i's neighbor node j into key vectors. This represents the weight matrix that converts the representation of node i into a value vector, and softmax represents the softmax function. This represents the (l+1)th layer representation of node i obtained by aggregating homogeneous nodes in the HAN aggregator. Let represent the (l+1)th layer representation of node i obtained by heterogeneous node aggregation in the GNN aggregator, and T denotes transpose;
[0114] Finally, an asynchronous update is performed. The specific steps are as follows: using the update gate selection mechanism, the best aggregation method is selected based on the representation of node i, and then the representation of node i is updated using the selected best aggregation method. The formula is expressed as:
[0115]
[0116]
[0117] Where β represents the update gate selection mechanism, and δ is a parameterized function of the multilayer perceptron. The function δ is used to select the best node representation from the node representations obtained by the GCN aggregator, GAT aggregator, HAN aggregator, and GNN aggregator through the update gate selection mechanism as the final node representation. The final representation of node i is... Determined by the update gate selection mechanism, Z i The function δ represents the selection result of the final representation of node i. The weight in the aggregator corresponding to the final representation of node i is the final representation of the edge. The final representation of node i and the final representation of the edge constitute the feature network graph data. According to the meaning of the final representation of node i, the feature network graph data is divided into customer demand data and comprehensive flexible production plan data.
[0118] Because historical data has a rich variety of modalities, feature network graphs can be built to process heterogeneous data from multiple sources, such as the Internet of Things, customer feedback, and market dynamics, thereby improving information processing capabilities and enhancing generalization capabilities.
[0119] GCN, GAT, HAN, and GNN are all aggregation algorithms for constructing feature network graphs. By employing these four algorithms to build the feature network graph, and then asynchronously updating the node representations obtained from the four algorithms, the optimal aggregation algorithm is determined. The feature network graph obtained using the optimal aggregation algorithm is more suitable for the flexible manufacturing technology background of this patent. By establishing the correlation information between different modal data through the feature network graph, preprocessed modal data is obtained. This correlation information is used to characterize the inherent connections or interrelationships between different modal data. This method not only improves the accuracy of flexible production decisions but also promotes increased production efficiency and reduced costs, significantly improving enterprise operational efficiency.
[0120] (2) The specific method for obtaining the flexible production large language model from the flexible production large language model building module is as follows:
[0121] The flexible production large language model adopts the Transformer algorithm, in which the TTT layer is used to replace the self-attention mechanism in the Transformer algorithm. The TTT layer includes a multilayer perceptron.
[0122] The forward propagation function of the flexible production large language model is as follows: First, by improving the encoder in the Transformer algorithm, the input sequence of the current time step is combined with the hidden state of the previous time step to obtain the context vector. The context vector is then input into a multilayer perceptron with a TTT layer. For a multilayer perceptron with l layers, the output z of the l-th layer... l and activate output a l It can be represented as:
[0123]
[0124] a l-1 =φ l (z l )
[0125] in, b is the weight matrix of the l-th layer in a multilayer perceptron. l It is the bias vector of the l-th layer in a multilayer perceptron, and the hidden state includes the weight matrix. and bias vector b l a l-1 It is the activation output of the (l-1)th layer. When the input layer l = 1, a 0 φ is the activation output of layer 1. l It is the ReLU activation function of the l-th layer;
[0126] Then, in the TTT layer, the hidden state is updated using gradient descent, where the hidden state consists of a weight matrix and a bias vector. The loss function is calculated using backpropagation, and the gradient of the multilayer perceptron parameters is:
[0127]
[0128] in, To represent the loss function L with respect to the weight matrix W of the l-th layer l gradient, To represent the loss function L with respect to the bias vector b of the l-th layer l The gradient of L is the loss function;
[0129] Then, the weight matrix and bias vector of the multilayer perceptron are updated using gradient descent:
[0130]
[0131] in, This indicates that the weight matrix of the l-th layer is updated using gradient descent. To represent updating the bias vector of the l-th layer using gradient descent, η is the learning rate;
[0132] The context vector output by the encoder and the updated hidden state in the multilayer perceptron of the TTT layer are input into the softmax function of the decoder in the improved Transformer algorithm. The softmax function obtains the output of the Transformer algorithm based on the context vector and the updated hidden state.
[0133] The feature network graph data is divided into training and validation sets to train the improved Transformer algorithm. During training, the input sequence of the improved Transformer algorithm is the customer demand data in the feature network graph data, and the corresponding output is the comprehensive flexible production plan. During training, the customer demand data in the feature network graph data is transformed into the input sequence of the improved Transformer algorithm: the final representation of all nodes is serialized, node indices are added to the sequence to identify specific nodes, and weight matrices representing the final representation of edges are added to the sequence to obtain the input sequence for training. After the improved Transformer algorithm is trained, a flexible production large language model is obtained.
[0134] The Transformer algorithm is a natural language processing model capable of handling multimodal data. Training a Transformer allows it to focus on a specific domain. Test-Time Training (TTT) is an innovative machine learning model training method. Its core idea is to further train and adjust the model during the testing phase. In the field of natural language processing, TTT can be used for tasks such as text classification, machine translation, and named entity recognition. By adjusting for each test instance, the model can more accurately understand the meaning and contextual information of the text, thereby improving task accuracy. By using TTT layers to replace the self-attention mechanism in the Transformer, the generalization ability and accuracy of flexible production large language models can be improved: by adjusting for each test instance, TTT allows the flexible production large language model to better adapt to the distribution and characteristics of the test data, thereby improving task accuracy. TTT allows the flexible production large language model to be adjusted and optimized in real time during the testing phase, thus better adapting to constantly changing environments and data distributions.
[0135] (3) The specific method for obtaining the flexible production planning model from the flexible production planning model establishment module is as follows:
[0136] First, a stacking framework is selected as the structure of the flexible production planning model, and the genetic algorithm layer, particle swarm optimization layer, and simulated annealing layer are used as stacked modules of the stacking framework. Each stacked module adopts a linear stacking method: the output of one stacked module is used as the input of the next stacked module, and the target performance parameters of the flexible production planning model are determined.
[0137] Then, the customer demand data in the feature network graph data is serialized and input into the flexible production large language model for generative language augmentation to obtain feature-enhanced customer demand data as input to the flexible production planning model. The feature-enhanced customer demand data is in text modality. The genetic algorithm layer, particle swarm optimization layer, and simulated annealing layer are arranged and combined in sequence. The stacked frameworks of different sequences of the stacked modules obtained by the arrangement and combination are input into the feature-enhanced input sequence for training. Finally, cross-validation is used to evaluate the model's generalization ability to the target performance based on the target performance parameters. The stacked framework with the largest generalization ability is selected as the trained flexible production planning model.
[0138] Stacking genetic algorithms, particle swarm optimization, and simulated annealing can combine the advantages of these three optimization algorithms, resulting in more powerful performance when solving complex optimization problems.
[0139] Because flexible manufacturing's large-scale language model has high generalization ability and is applicable to a wide variety of tasks, it cannot provide answers regarding the parameters of specific production lines in flexible manufacturing. Therefore, establishing a flexible manufacturing planning model enhances knowledge reserves and decision-making capabilities within the flexible manufacturing field. Simultaneously, it improves the system's interpretability, making the decision-making process more transparent and easier to understand, and strengthening trust and cooperation between humans and machines.
[0140] (4) The specific methods for obtaining the knowledge graph by the knowledge graph building module are as follows:
[0141] Text data and image data of customer demand and integrated flexible production plan are extracted from feature network graph data. The image data of customer demand and integrated flexible production plan are input into the flexible production big language model to obtain customer demand text data and integrated flexible production plan text data converted from image data. The customer demand text data obtained from image conversion and the customer demand text data extracted from feature network graph data are merged to obtain a customer demand text database. The integrated production plan text data obtained from image conversion and the integrated production plan text data extracted from feature network graph data are merged to obtain an integrated flexible production plan text database. The feature network dataset is input into the flexible production big language model to obtain demand-production relationship text data. A demand-production relationship text database is established based on the demand-production relationship text data. The demand-production relationship text data is text data representing the relationship between customer demand and integrated flexible production plan.
[0142] Based on the relationship between customer demand and integrated flexible production planning in the demand-production relationship text database, events are extracted from the customer demand text data and integrated flexible production planning text data to obtain customer demand events and integrated flexible production planning events. The content of each event includes subject, type, time, location, attribute, and relationship. Customer demand event vectors and integrated flexible production planning event vectors are established according to the content of customer demand events and integrated flexible production planning events, respectively. The customer demand event vectors and integrated flexible production planning event vectors are linked to construct a knowledge graph.
[0143] The event is an action or state change with clear temporal and spatial attributes; the subject is an entity that participates in the event and has a causal relationship with the occurrence of the event; the relationship is the causal connection between events; and the attribute is a characteristic that describes the event.
[0144] In a knowledge graph, nodes represent events with entity and attribute labels. These events include customer demand events and comprehensive flexible production planning events. Edges between nodes represent the relationships between events. These edges are directed edges and include direct and indirect relationships.
[0145] The specific method for constructing a knowledge graph by linking customer demand event vectors and integrated flexible production planning event vectors is as follows:
[0146] The K-means clustering algorithm is used to identify and merge similar events. The specific method is as follows: In the K-means clustering algorithm, the silhouette coefficient is used to determine the K value, and the K-means++ algorithm is used to initialize the centroids. The following two steps are iterated until convergence: 1) Assign each node to the nearest centroid to form K clusters; 2) Recalculate the centroid of each cluster.
[0147] Each node is assigned a cluster label, which indicates the cluster to which it belongs. Nodes with the same or similar cluster labels are merged to obtain the final vector of each node. Edges are then added between the nodes according to the relationships between events to obtain the knowledge graph.
[0148] The purpose of building a knowledge graph is to adjust the logical relationships between historical data through the intervention of experts' professional knowledge, so as to obtain a more professional database. This is different from feature network graphs, which are automatically aggregated by algorithms.
[0149] (5) To better adapt the flexible production language model to the flexible production environment, since the knowledge graph is based on the logic of experts in the field, while the feature network graph is merely generated by an algorithm, further training the flexible production language model using the knowledge graph can make it more consistent with the logic of actual production. Specific steps include: training adjustment and knowledge enhancement modules, used to train and adjust the flexible production language model using knowledge graph data, such as... Figure 3 As shown, the specific method is as follows:
[0150] First, feature graph data and knowledge graph datasets are input into different TTT layers of the flexible production large-scale language model to obtain weighted features from the feature graph data and weighted features from the knowledge graph data, respectively. Then, the weighted features from the feature graph data and knowledge graph data from different TTT layers are concatenated into vectors to form a fused feature representation, which is used as training data to train the flexible production large-scale language model. This allows the flexible production large-scale language model to be trained and adjusted based on a knowledge graph that is more consistent with practical logic, making it more suitable for real-world application scenarios.
[0151] A customer demand data point from the feature network graph data is input into the trained and adjusted flexible production large language model to obtain several first flexible production plans. These first flexible production plans are then input into the DQN algorithm for reward value evaluation. The first flexible production plan with the highest reward value is input into the knowledge graph. This process is repeated to traverse all customer demand data points in the feature network graph data. The specific method is as follows:
[0152] A flexible production simulation model is established, which employs the DQN algorithm to predict actions within the comprehensive flexible production plan based on the states in the plan. Actions are defined as machine adjustment parameters and movements within the comprehensive flexible production plan, while states are defined as material and environmental variables. The input to the flexible production simulation model is the state, and the output is the action. The flexible production simulation model is represented as follows:
[0153] Define a multidimensional vector S t S represents the state of the machine at time t, expressed by the formula: t =[s t1 ,s t2 ,...,s tn ], where s tn Let A represent the nth feature in the machine's state vector at time t, and define a multidimensional vector A. t Let A be a multidimensional vector representing the probability distribution of machine actions at time t. t Each dimension corresponds to an action, expressed by the formula: A t =[a t1 ,a t2 ,...,a tm ], where a tm This represents the probability of the m-th action in the machine's action vector at time t;
[0154] In the DQN algorithm, the Q-network will convert the state S t Mapped to action probability distribution A t The formula is expressed as: Q(S) t A t ;θ), where θ represents the parameter set of the DQN algorithm;
[0155] The reward obtained by the flexible production simulation model upon completing the current action is defined as the immediate reward, and the total reward obtained by the flexible production simulation model after a series of actions is defined as the cumulative reward. The formula for the reward function is as follows:
[0156]
[0157] Among them, G T′ R is the cumulative reward within time period T′. T′+k+1 The instant reward obtained within the time period T′+k+1, γ k It is the instant reward obtained by completing the current action within time step k;
[0158] The flexible production simulation model is trained, and the specific training process is as follows: Initialize the current network Q(S) t A t Define a target network Q′(S) with the same structure as the current network but different parameters. t A t Then, the flexible manufacturing plant interacts with the knowledge graph to record the current state, action, reward, and next state, represented as a tuple (S). t A t ,γ k ,S t+1 The interaction process is as follows: The flexible manufacturing plant executes action A. t After that, the state changed from St Transfer to S t+1 and receive the current reward γ k The data is stored in the experience replay buffer of the DQN algorithm. A batch of empirically trained Q-networks is randomly selected from the experience replay buffer to update the parameters of the DQN algorithm. The training process includes the following steps: using the target network to calculate the Q-value Q(S) of the next state of the current network. t+1 A t+1 ;θ), the formula is:
[0159]
[0160] Calculate the loss function L using the mean squared error:
[0161] The gradient descent algorithm is used to minimize the loss function in order to update the parameters S of the DQN algorithm. t 、A t After updating θ, we obtain the trained flexible production simulation model;
[0162] The flexible production big data language model is set to output n results corresponding to the input customer demand data. The customer demand data in the feature network graph data is input into the flexible production big data language model to generate n comprehensive flexible production plans. Then, the n flexible production plans are input into the flexible production simulation model to calculate their respective cumulative rewards. The customer demand data in the feature network graph data is traversed, and the comprehensive flexible production plan with the highest cumulative reward value is selected to extract the comprehensive flexible production plan event. The customer demand data corresponding to the comprehensive flexible production plan with the highest cumulative reward value is extracted to extract the customer demand event. Finally, the comprehensive flexible production plan event and the customer demand event are input into the knowledge graph. At the same time, the comprehensive flexible production plan event predicted by the flexible production plan prediction module is also extracted and input into the knowledge graph.
[0163] By establishing a flexible production simulation model to simulate the actual production environment, some simulated flexible production plans are obtained. Both the simulated flexible production plans and those generated during the actual prediction process are stored in the knowledge graph, which can greatly increase the richness of the knowledge graph, increase the knowledge storage for future predictions, and improve the accuracy of predictions.
[0164] (6) Figure 4 As shown, the specific method for forecasting by the flexible production planning forecasting module is as follows:
[0165] The flexible production language model, flexible production planning model, and knowledge graph are input into the langchain framework. Input data templates, constraint templates, short-term memory templates, and long-term memory templates are constructed within the langchain framework. These templates are then encapsulated as prompt words and used as input to the langchain framework. Short-term memory represents the result of each iteration of the langchain framework, while long-term memory represents the result at the end of the iteration. In the first iteration, current customer demand data and actual production constraints are input into the data template and constraint template, respectively. The current customer demand data is multimodal data including text, image, and code data. In the second iteration and subsequent iterations, the short-term memory obtained in each iteration is stored in the short-term memory template, and the long-term memory obtained at the end of the iteration is stored in the long-term memory template. The long-term memory represents the final comprehensive flexible production plan.
[0166] First, the langchain architecture invokes the knowledge graph. Based on the current customer demand data in the Prompt prompt, the langchain architecture retrieves the corresponding comprehensive flexible production plan from the knowledge graph. If a corresponding comprehensive flexible production plan is found, the langchain architecture outputs that comprehensive flexible production plan as the prediction result. If no corresponding comprehensive flexible production plan is found, the langchain architecture invokes the flexible production language model and the flexible production plan model to predict the flexible production plan. The prediction process is as follows:
[0167] The Prompt prompt is input into the flexible production language model. The flexible production language model makes predictions based on the customer demand data in the Prompt prompt to obtain the first flexible production plan. At the same time, the flexible production language model also performs generative language expansion on the customer demand data in the Prompt prompt to obtain feature-enhanced customer demand data. The feature-enhanced customer demand data is in text modality. The langchain architecture inputs the feature-enhanced customer demand data into the flexible production planning model to obtain the second flexible production plan. The langchain architecture then merges the first flexible production plan and the second flexible production plan to obtain the comprehensive flexible production plan.
[0168] After each iteration, the langchain architecture determines whether the comprehensive flexible production plan obtained in this iteration meets customer needs based on the constraints in the Prompt prompt. If the comprehensive flexible production plan obtained in this iteration does not meet customer needs, it is stored as short-term memory in the Prompt prompt. Based on the customer demand data in the Prompt prompt and all short-term memories, the langchain architecture calls the flexible production language model and the flexible production plan model for a new iteration. During the prediction process, the langchain architecture optimizes the flexible production language model and the flexible production plan model based on all short-term memories to obtain the result of the next iteration. If the comprehensive flexible production plan obtained in this iteration meets customer needs, it is output as the prediction result.
[0169] The LangChain framework is a powerful framework designed specifically for Natural Language Processing (NLP) and Large Language Modeling (LLM) applications. Its architecture can be divided into multiple layers and modules, each undertaking different functions and responsibilities. This patent utilizes the LangChain framework to call upon a flexible production large language model and a flexible production planning model, using a knowledge graph as a knowledge base. By combining the prediction results of both models, a comprehensive flexible production plan is obtained. This is because the flexible production large language model has strong generalization capabilities but cannot accurately predict the production parameters of specific production lines, being more limited to personnel work arrangements and large-scale production planning. In contrast, the flexible production planning model, combining genetic algorithms, particle swarm optimization, and simulated annealing, can effectively predict optimal production line parameters. Therefore, combining the two yields a complete and comprehensive comprehensive flexible production plan. Furthermore, the more prediction work performed and the more data added to the knowledge graph, the more the knowledge graph can be self-updated, thus achieving self-learning.
[0170] Example 2
[0171] A flexible production planning forecasting method based on knowledge graphs and large language models includes the following steps:
[0172] The historical production data of the flexible factory is aggregated to obtain feature network graph data. Both historical data and feature network graph data include text data, image data and code data based on data modality. Both historical data and feature network graph data include customer demand data and comprehensive flexible production plan data based on data meaning.
[0173] An improved Transformer algorithm is obtained by replacing the self-attention mechanism in the Transformer algorithm with a TTT layer, and a flexible production large language model is obtained by training the improved Transformer algorithm with feature network graph data.
[0174] Several modern heuristic algorithm layers are stacked as modules to form a stacked framework. The stacked framework is trained using feature network graph data to obtain a flexible production planning model.
[0175] Image data from the feature network graph data is input into the flexible production big language model and converted into text data. Then, the text data obtained from the image data conversion is merged with the text data from the feature network graph data and classified according to the data meaning to obtain customer demand text data and comprehensive flexible production plan text data. The feature network graph data is input into the flexible production big language model to obtain demand-production relationship text data. Event extraction is performed on the customer demand text data and comprehensive flexible production plan text data to obtain customer demand events and comprehensive flexible production plan events. Based on the demand-production relationship text data, the customer demand events and comprehensive flexible production plan events are linked to obtain a knowledge graph.
[0176] The flexible production language model, flexible production planning model, knowledge graph, and current customer needs are input into the language model development framework, and predictions are made based on current customer needs to obtain comprehensive flexible production planning prediction results.
[0177] Example 3
[0178] A computer program product includes a computer program / instruction that, when executed by a processor, implements the flexible production planning prediction method based on knowledge graphs and large language models in Embodiment 2.
[0179] The contents not described in detail in this specification are prior art known to those skilled in the art. Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0180] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0181] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0182] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0183] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit its scope of protection. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that after reading the present invention, they can still make various changes, modifications or equivalent substitutions to the specific implementation of the invention, but these changes, modifications or equivalent substitutions are all within the scope of protection of the pending claims of the invention.
Claims
1. A flexible production planning and forecasting system based on knowledge graphs and large language models, characterized in that, include: The feature network graph building module is used to aggregate historical production data of the flexible factory to obtain feature network graph data; The flexible production large language model building module is used to train natural language algorithms using feature network graph data to obtain a flexible production large language model; The flexible production planning model building module is used to combine several modern heuristic algorithm layers as stacked modules to form a stacked framework, and use feature network graph data to train the stacked framework to obtain a flexible production planning model. The knowledge graph building module is used to input image data from the feature network graph data into the flexible production big language model and convert it into text data. Then, the text data obtained from the image data conversion is merged with the text data from the feature network graph data and classified according to the data meaning to obtain customer demand text data and comprehensive flexible production plan text data. The feature network graph data is input into the flexible production big language model to obtain demand-production relationship text data. Event extraction is performed on the customer demand text data and comprehensive flexible production plan text data from the flexible factory's historical production data to obtain customer demand events and comprehensive flexible production plan events. Based on the demand-production relationship text data, the customer demand events and comprehensive flexible production plan events are linked to obtain the knowledge graph. The flexible production planning forecasting module is used to input the flexible production language model, flexible production planning model, knowledge graph and current customer demand into the language model development framework and make predictions based on the current customer demand to obtain comprehensive flexible production planning forecast results. The specific method for training a natural language algorithm using feature network graph data to obtain the flexible production large language model in the flexible production large language model building module is as follows: The flexible production large language model adopts the Transformer algorithm, in which the TTT layer is used to replace the self-attention mechanism in the Transformer algorithm. The TTT layer includes a multilayer perceptron. The forward propagation function of the flexible production large language model is written as follows: First, by improving the encoder in the Transformer algorithm, the input sequence of the current time step is combined with the hidden state of the previous time step to obtain the context vector. The context vector is then input into the multilayer perceptron of the TTT layer. For a given language model with... Multilayer perceptron, layer 1 Layer output and activate output It can be represented as: in, It is the first in the multilayer perceptron The weight matrix of the layer, It is the first in the multilayer perceptron The layer's bias vector, and the hidden state including the weight matrix. and bias vector , It is The activation output of the layer, when the input layer hour The output is the activation value of layer 1. It is The activation function of the layer is ReLU; Then, in the TTT layer, the hidden state is updated using gradient descent, where the hidden state consists of a weight matrix and a bias vector. The loss function is calculated using backpropagation, and the gradient of the multilayer perceptron parameters is: in, To represent the loss function Regarding the first Layer weight matrix gradient, To represent the loss function Regarding the first Layer bias vector gradient, The loss function; Then, the weight matrix and bias vector of the multilayer perceptron are updated using gradient descent: in, This indicates that the gradient descent method is used to update the first... The weight matrix of the layer, To indicate that the gradient descent method is used to update the first... The layer's bias vector, It is the learning rate; The decoder in the Transformer algorithm is improved by combining the context vector output by the encoder with the updated hidden state input from the multilayer perceptron in the TTT layer. function, The function obtains the output of the Transformer algorithm based on the context vector and the updated hidden state; The feature network graph data is divided into training and validation sets to train the improved Transformer algorithm. During training, the input sequence of the improved Transformer algorithm is the customer demand data in the feature network graph data, and the corresponding output is the comprehensive flexible production plan. During training, the customer demand data in the feature network graph data is transformed into the input sequence of the improved Transformer algorithm: the final representation of all nodes is serialized, node indices are added to the sequence to identify specific nodes, and weight matrices representing the final representation of edges are added to the sequence to obtain the input sequence during training. After the improved Transformer algorithm is trained, a flexible production large language model is obtained. In the flexible production planning model building module, several modern heuristic algorithm layers are stacked as modules to form a stacked framework. The specific method for training the stacked framework using feature network graph data to obtain the flexible production planning model is as follows: First, a stacked framework is selected as the structure of the flexible production planning model, and the genetic algorithm layer, particle swarm optimization layer, and simulated annealing layer are used as stacked modules of the stacked framework. Each stacked module adopts a linear stacking method: the output of one stacked module is used as the input of the next stacked module, and the target performance parameters of the flexible production planning model are determined. Then, the customer demand data in the feature network graph data is serialized and input into the flexible production large language model for generative language augmentation to obtain feature-enhanced customer demand data as input to the flexible production planning model. The feature-enhanced customer demand data is in text modality. The genetic algorithm layer, particle swarm optimization layer, and simulated annealing layer are arranged and combined in sequence. The stacked frameworks of different sequences of the stacked modules obtained by the arrangement and combination are input into the feature-enhanced input sequence for training. Finally, cross-validation is used to evaluate the model's generalization ability to the target performance based on the target performance parameters. The stacked framework with the largest generalization ability is selected as the trained flexible production planning model.
2. The flexible production planning and forecasting system based on knowledge graphs and large language models according to claim 1, characterized in that: The specific method for aggregating historical production data of the flexible factory to obtain feature network graph data in the feature network graph building module is as follows: Establish a feature matrix representing historical data , the formula is as follows: in, These represent the feature vectors of the text data. Image data feature vectors and code data feature vectors Construct a feature network graph consisting of nodes and edges between nodes, and use the feature matrix representing historical data. As the initial representation of each node, the weights between nodes are the edges of the feature network graph. This represents the sequence number of historical data and the sequence number of its corresponding node; Using GCN aggregator to combine nodes and all its neighboring nodes The information is aggregated, and the node representation is updated. The specific steps are as follows: using the weight matrix... Node and all its neighboring nodes The representation is linearly transformed, then normalized, and the normalized nodes are... All neighboring nodes Summing is performed on the representation of the nodes, and then the nodes are summed. In the GCN aggregator, the representation of the next layer is processed by an activation function to obtain the nodes. The node representation after aggregation by the GCN aggregator is expressed by the following formula: in, Represents a node In GCN aggregator The representation of +1 layer, Represents a node neighboring nodes In GCN aggregator Layer representation, This represents the activation function. Indicates the first GCN aggregator The weight matrix of the layer, Represents a node neighboring nodes The set, Represents a node and its neighboring nodes The distance between them; Using the GAT aggregator with an attention mechanism to group nodes and all its neighboring nodes The information is aggregated, and the node representation is updated. The specific steps are: using an additive attention mechanism to compute the node... and all its neighboring nodes Attention weights between nodes and neighboring nodes Perform a weighted average, then weight all neighbor nodes. Summing the representations of the nodes yields the node representations. In the GAT aggregator, the representation of the next layer is processed by an activation function to obtain the nodes. The node representation after aggregation by the GAT aggregator is expressed by the following formula: in, Represents a node and its neighboring nodes Attention weights between them Represents a node neighboring nodes In GAT aggregator Layer representation, Represents a node In GAT aggregator The representation of +1 layer; Using HAN aggregator and GNN aggregator respectively based on nodes and its neighboring nodes The aggregation of homogeneous and heterogeneous relationships between nodes is performed through the following steps: The HAN aggregator uses a content attention mechanism to calculate and aggregate the attention weights between homogeneous nodes; the GNN aggregator uses a key-value attention mechanism to calculate and aggregate the attention weights between heterogeneous nodes. The formula is as follows: in, , Nodes representing homogeneity and its neighboring nodes Attention scores and nodes with heterogeneous relationships and its neighboring nodes Attention scores between Represents a node In the HAN aggregator Layer representation, Represents a node neighboring nodes In the HAN aggregator Layer representation, Represents a node In the GNN aggregator, the first Layer representation, Represents a node neighboring nodes In the GNN aggregator, the first Layer representation, and These represent the nodes. The representation is converted into a weight matrix of the query vector and the nodes are... neighboring nodes The representation is converted into a weight matrix of the query vector. Indicates that the node neighboring nodes The representation is converted into a weight matrix of the key vector. Indicates that the node The representation is converted into a weight matrix of value vectors. express function, Represents a node The first one obtained by aggregation through homogeneous nodes in the HAN aggregator Layer representation, Represents a node The first one obtained by aggregating heterogeneous nodes in the GNN aggregator The layer is represented by T, which indicates transpose. Finally, asynchronous updates are performed, specifically through the following steps: using an update gate selection mechanism, based on the node... This indicates that the optimal aggregation method is selected, and then the node is updated using the selected optimal aggregation method. The expression, expressed by the formula, is as follows: in, This indicates the mechanism for updating the door selection. The function is parameterized by the multilayer perceptron. This is used to select the best node representation from the node representations obtained by the GCN aggregator, GAT aggregator, HAN aggregator, and GNN aggregator through an update gate selection mechanism as the final node representation. The final expression Determined by the update gate selection mechanism. Representation function For nodes The final representation of the selected node The final representation of the node corresponds to the weights in the aggregator. The final representation of the nodes and the final representation of the edges constitute the feature network graph data, based on the nodes. The final meaning represents the division of the feature network graph data into customer demand data and comprehensive flexible production planning data.
3. The flexible production planning and forecasting system based on knowledge graphs and large language models according to claim 1, characterized in that: The knowledge graph building module inputs image data from the feature network graph data into a flexible production language model to convert it into text data. Then, it merges the text data obtained from the image data conversion with the text data from the feature network graph data, classifying them according to data meaning to obtain customer demand text data and comprehensive flexible production plan text data. The feature network graph data is then input into the flexible production language model to obtain demand-production relationship text data. Event extraction is performed on the customer demand text data and comprehensive flexible production plan text data to obtain customer demand events and comprehensive flexible production plan events. The specific method for linking customer demand events and comprehensive flexible production plan events based on the demand-production relationship text data to obtain the knowledge graph is as follows: Text data and image data of customer demand and integrated flexible production plan are extracted from feature network graph data. The image data of customer demand and integrated flexible production plan are input into the flexible production big language model to obtain customer demand text data and integrated flexible production plan text data converted from image data. The customer demand text data obtained from image conversion and the customer demand text data extracted from feature network graph data are merged to obtain a customer demand text database. The integrated production plan text data obtained from image conversion and the integrated production plan text data extracted from feature network graph data are merged to obtain an integrated flexible production plan text database. The feature network dataset is input into the flexible production big language model to obtain demand-production relationship text data. A demand-production relationship text database is established based on the demand-production relationship text data. The demand-production relationship text data is text data representing the relationship between customer demand and integrated flexible production plan. Based on the relationship between customer demand and integrated flexible production planning in the demand-production relationship text database, events are extracted from the customer demand text data and integrated flexible production planning text data to obtain customer demand events and integrated flexible production planning events. The content of each event includes subject, type, time, location, attribute, and relationship. Customer demand event vectors and integrated flexible production planning event vectors are established according to the content of customer demand events and integrated flexible production planning events, respectively. The customer demand event vectors and integrated flexible production planning event vectors are linked to construct a knowledge graph. The event is an action or state change with clear temporal and spatial attributes; the subject is an entity that participates in the event and has a causal relationship with the occurrence of the event; the relationship is the causal connection between events; and the attribute is a characteristic that describes the event. In a knowledge graph, nodes represent events with entity and attribute labels. These events include customer demand events and comprehensive flexible production planning events. Edges between nodes represent the relationships between events. These edges are directed edges and include direct and indirect relationships. The specific method for constructing a knowledge graph by linking customer demand event vectors and integrated flexible production planning event vectors is as follows: The K-means clustering algorithm is used to identify and merge similar events. The specific method is as follows: In the K-means clustering algorithm, the silhouette coefficient is used to determine the K value, and the K-means++ algorithm is used to initialize the centroid. The following two steps are iterated until convergence: (1) Assign each node to the nearest centroid to form K clusters; (2) Recalculate the centroid of each cluster. Each node is assigned a cluster label, which indicates the cluster to which it belongs. Nodes with the same or similar cluster labels are merged to obtain the final vector of each node. Edges are then added between the nodes according to the relationships between events to obtain the knowledge graph.
4. The flexible production planning and forecasting system based on knowledge graphs and large language models according to claim 1, characterized in that, Also includes: The training and knowledge enhancement modules are used to train and adjust the flexible production large language model using knowledge graph data; A customer demand data point from the feature network graph data is input into the trained and adjusted flexible production large language model to obtain several first flexible production plans. These first flexible production plans are then input into a flexible production simulation model built using the DQN algorithm for reward value evaluation. The first flexible production plan with the highest reward value among these plans is input into the knowledge graph. The process described above is repeated to traverse all customer demand data points in the feature network graph data.
5. The flexible production planning and forecasting system based on knowledge graphs and large language models according to claim 4, characterized in that: The specific method for training and adjusting the flexible production large language model using knowledge graph data in the training adjustment and knowledge enhancement module is as follows: First, the feature network graph data and knowledge graph dataset are respectively input into different TTT layers in the flexible production large language model to obtain weighted features of the feature network graph data and weighted features of the knowledge graph data. Then, the weighted features of the feature network graph data and the weighted features of the knowledge graph data from different TTT layers are concatenated into vectors to form a fused feature representation, which is used as training data to train the flexible production large language model. The specific method for inputting a customer demand data from the feature network graph data into the trained and adjusted flexible production large language model to obtain several first flexible production plans, and then inputting these first flexible production plans into the DQN algorithm for reward value evaluation, and inputting the first flexible production plan with the highest reward value into the knowledge graph, and traversing all customer demand data in the feature network graph data according to the above process, is as follows: A flexible production simulation model is established, which employs the DQN algorithm to predict actions within the comprehensive flexible production plan based on the states in the plan. Actions are defined as machine adjustment parameters and movements within the comprehensive flexible production plan, while states are defined as material and environmental variables. The input to the flexible production simulation model is the state, and the output is the action. The flexible production simulation model is represented as follows: Define a multidimensional vector Indicates at time The machine's status can be expressed by the following formula: ,in Indicates at time The machine's state vector Each feature defines a multidimensional vector. Indicates at time Probability distribution of machine actions, multidimensional vector Each dimension corresponds to an action, expressed by the formula: ,in Indicates at time The machine's motion vector The probability of an action; In the DQN algorithm The network will be in status Mapping to action probability distribution The formula is expressed as: ,in This represents the set of parameters for the DQN algorithm. The reward obtained by the flexible production simulation model upon completing the current action is defined as the immediate reward, and the total reward obtained by the flexible production simulation model after a series of actions is defined as the cumulative reward. The formula for the reward function is as follows: in, It is a time period Accumulated rewards within, During the time period Instant rewards obtained within, In time step The immediate reward gained upon completing the current action; The training process for the flexible production simulation model is as follows: Initialize the current network. Define a target network with the same structure as the current network but different parameters. Then, the flexible manufacturing plant interacts with the knowledge graph to record the current state, action, reward, and next state, representing them as tuples. The interaction process is as follows: The flexible manufacturing plant executes actions. After that, the status changed from Transfer to and receive the current reward. The data is stored in the experience replay buffer of the DQN algorithm. A batch of empirically trained Q-networks is randomly selected from the experience replay buffer to update the parameters of the DQN algorithm. The training process includes the following steps: using the target network to calculate the Q-value of the next state of the current network. The formula is: ; Calculate the loss function using mean squared error. : ; Use gradient descent to minimize the loss function to update the parameters of the DQN algorithm. , and After updating, a trained flexible production simulation model is obtained; Set the number of output results corresponding to the input customer demand data in the flexible manufacturing large language model to be [number]. Customer demand data from the feature network graph data is input into the flexible production large language model to generate... A comprehensive flexible production plan, and then Each flexible production plan is input into the flexible production simulation model to calculate its cumulative reward. The customer demand data in the feature network graph data is traversed. The comprehensive flexible production plan with the highest cumulative reward value is selected in turn to extract the comprehensive flexible production plan event. The customer demand data corresponding to the comprehensive flexible production plan with the highest cumulative reward value is extracted to extract the customer demand event. Finally, the comprehensive flexible production plan event and the customer demand event are input into the knowledge graph. Simultaneously, the comprehensive flexible production plan predicted by the flexible production planning forecasting module is extracted into events and input into the knowledge graph.
6. The flexible production planning and forecasting system based on knowledge graphs and large language models according to claim 1, characterized in that: The flexible production planning forecasting module incorporates a flexible production language model, a flexible production planning model, a knowledge graph, and current customer needs into the language model development framework. Based on these current customer needs, it performs forecasts to obtain a comprehensive flexible production planning forecast result. The specific method for this is as follows: The flexible production language model, flexible production planning model, and knowledge graph are input into the langchain framework. Input data templates, constraint templates, short-term memory templates, and long-term memory templates are constructed within the langchain framework. These templates are then encapsulated as prompt words and used as input to the langchain framework. Short-term memory represents the result of each iteration of the langchain framework, while long-term memory represents the result at the end of the iteration. In the first iteration, current customer demand data and actual production constraints are input into the data template and constraint template, respectively. The current customer demand data is multimodal data including text, image, and code data. In the second iteration and subsequent iterations, the short-term memory obtained in each iteration is stored in the short-term memory template, and the long-term memory obtained at the end of the iteration is stored in the long-term memory template. The long-term memory represents the final comprehensive flexible production plan. First, the langchain architecture invokes the knowledge graph. Based on the current customer demand data in the Prompt prompt, the langchain architecture retrieves the corresponding comprehensive flexible production plan from the knowledge graph. If a corresponding comprehensive flexible production plan is found, the langchain architecture outputs that comprehensive flexible production plan as the prediction result. If no corresponding comprehensive flexible production plan is found, the langchain architecture invokes the flexible production language model and the flexible production plan model to predict the flexible production plan. The prediction process is as follows: The Prompt prompt is input into the flexible production language model. The flexible production language model makes predictions based on the customer demand data in the Prompt prompt to obtain the first flexible production plan. At the same time, the flexible production language model also performs generative language expansion on the customer demand data in the Prompt prompt to obtain feature-enhanced customer demand data. The feature-enhanced customer demand data is in text modality. The langchain architecture inputs the feature-enhanced customer demand data into the flexible production planning model to obtain the second flexible production plan. The langchain architecture then merges the first flexible production plan and the second flexible production plan to obtain the comprehensive flexible production plan. After each iteration, the langchain architecture determines whether the comprehensive flexible production plan obtained in this iteration meets customer needs based on the constraints in the Prompt prompt. If the comprehensive flexible production plan obtained in this iteration does not meet customer needs, it is stored as short-term memory in the Prompt prompt. Based on the customer demand data in the Prompt prompt and all short-term memories, the langchain architecture calls the flexible production big language model and the flexible production plan model for a new iteration. During the prediction process, the langchain architecture optimizes the flexible production big language model and the flexible production plan model based on all short-term memories to obtain the result of the next iteration. If the comprehensive flexible production plan obtained in this iteration meets customer needs, then the comprehensive flexible production plan will be output as the prediction result.
7. A flexible production planning forecasting method based on knowledge graphs and large language models, characterized in that, Includes the following steps: The historical production data of the flexible factory is aggregated to obtain feature network graph data; A flexible production large language model is obtained by training natural language algorithms using feature network graph data; Several modern heuristic algorithm layers are stacked as modules to form a stacked framework. The stacked framework is trained using feature network graph data to obtain a flexible production planning model. Image data from the feature network graph data is input into the flexible production big language model and converted into text data. The text data obtained from the image data conversion is then merged with the text data from the feature network graph data and classified according to data meaning to obtain customer demand text data and comprehensive flexible production plan text data. The feature network graph data is input into the flexible production big language model to obtain demand-production relationship text data. Event extraction is performed on the customer demand text data and comprehensive flexible production plan text data from the flexible factory's historical production data to obtain customer demand events and comprehensive flexible production plan events. Based on the demand-production relationship text data, the customer demand events and comprehensive flexible production plan events are linked to obtain a knowledge graph. The flexible production language model, flexible production planning model, knowledge graph, and current customer needs are input into the language model development framework, and predictions are made based on the current customer needs to obtain comprehensive flexible production planning prediction results. The specific method for training a natural language algorithm using feature network graph data to obtain a flexible production large language model is as follows: The flexible production large language model adopts the Transformer algorithm, in which the TTT layer is used to replace the self-attention mechanism in the Transformer algorithm. The TTT layer includes a multilayer perceptron. The forward propagation function of the flexible production large language model is written as follows: First, by improving the encoder in the Transformer algorithm, the input sequence of the current time step is combined with the hidden state of the previous time step to obtain the context vector. The context vector is then input into the multilayer perceptron of the TTT layer. For a given language model with... Multilayer perceptron, layer 1 Layer output and activate output It can be represented as: in, It is the first in the multilayer perceptron The weight matrix of the layer, It is the first in the multilayer perceptron The layer's bias vector, and the hidden state including the weight matrix. and bias vector , It is The activation output of the layer, when the input layer hour The output is the activation value of layer 1. It is The activation function of the layer is ReLU; Then, in the TTT layer, the hidden state is updated using gradient descent, where the hidden state consists of a weight matrix and a bias vector. The loss function is calculated using backpropagation, and the gradient of the multilayer perceptron parameters is: in, To represent the loss function Regarding the first Layer weight matrix gradient, To represent the loss function Regarding the first Layer bias vector gradient, The loss function; Then, the weight matrix and bias vector of the multilayer perceptron are updated using gradient descent: in, This indicates that the gradient descent method is used to update the first... The weight matrix of the layer, To indicate that the gradient descent method is used to update the first... The layer's bias vector, It is the learning rate; The decoder in the Transformer algorithm is improved by combining the context vector output by the encoder with the updated hidden state input from the multilayer perceptron in the TTT layer. function, The function obtains the output of the Transformer algorithm based on the context vector and the updated hidden state; The feature network graph data is divided into training and validation sets to train the improved Transformer algorithm. During training, the input sequence of the improved Transformer algorithm is the customer demand data in the feature network graph data, and the corresponding output is the comprehensive flexible production plan. During training, the customer demand data in the feature network graph data is transformed into the input sequence of the improved Transformer algorithm: the final representation of all nodes is serialized, node indices are added to the sequence to identify specific nodes, and weight matrices representing the final representation of edges are added to the sequence to obtain the input sequence during training. After the improved Transformer algorithm is trained, a flexible production large language model is obtained. The specific method for obtaining a flexible production planning model by training the stacked framework using feature network graph data, which consists of several modern heuristic algorithm layers as stacked modules, is as follows: First, a stacked framework is selected as the structure of the flexible production planning model, and the genetic algorithm layer, particle swarm optimization layer, and simulated annealing layer are used as stacked modules of the stacked framework. Each stacked module adopts a linear stacking method: the output of one stacked module is used as the input of the next stacked module, and the target performance parameters of the flexible production planning model are determined. Then, the customer demand data in the feature network graph data is serialized and input into the flexible production large language model for generative language augmentation to obtain feature-enhanced customer demand data as input to the flexible production planning model. The feature-enhanced customer demand data is in text modality. The genetic algorithm layer, particle swarm optimization layer, and simulated annealing layer are arranged and combined in sequence. The stacked frameworks of different sequences of the stacked modules obtained by the arrangement and combination are input into the feature-enhanced input sequence for training. Finally, cross-validation is used to evaluate the model's generalization ability to the target performance based on the target performance parameters. The stacked framework with the largest generalization ability is selected as the trained flexible production planning model.
8. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it implements the flexible production planning prediction method based on knowledge graph and large language model as described in claim 7.
Citation Information
Patent Citations
Flexible production scheduling method and device based on hybrid genetic algorithm
CN116993126A
Intelligent scheduling system based on industrial large model
CN117610896A
Flexible production management system and method based on digital twinning
CN118261741A
Flexible production system for aluminum electrolysis cell
CN219861615U
Industrial internet system based on machine vision
CN116777375A