Strategy recommendation method and equipment
By using a large model for position analysis and qualitative analysis, combined with the analytic hierarchy process (AHP) and the four-quadrant analysis method, the problem of existing tools being unable to generate strategic recommendations is solved, and the generation of accurate strategic recommendations and the automated combination of quantitative and qualitative analysis are achieved.
Patent Information
- Application Number
- CN202610178463.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-06
- Publication Date
- 2026-05-26
AI Technical Summary
Existing intelligence analysis tools struggle to combine qualitative and quantitative approaches in complex strategic decision-making through code. In particular, there is a conflict between the uncertainty, subjectivity, and dynamic complexity of analytical logic and the certainty, structure, and rule-based nature of code, making it impossible to effectively generate strategic recommendations.
A strategic recommendation approach is adopted, utilizing a large model for position analysis and qualitative analysis, and combining the analytic hierarchy process (AHP) and the four-quadrant analysis method to generate strategic recommendations.
It enables strategic intelligence analysis based on user needs, generates accurate strategic recommendations, improves the accuracy of SWOT analysis results, and achieves automated combination of quantitative and qualitative analysis, automatically optimizes the judgment matrix, and detects matrix inconsistencies.
Smart Images

Figure CN122087189A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligence analysis tools and technology, and in particular to a strategic recommendation method and apparatus. Background Technology
[0002] Currently, most intelligence-related tools are focused on intelligence gathering and data processing. Intelligence analysis tools also concentrate on data analysis. Tools involving complex strategic decision-making and combining qualitative and quantitative methods are rarely implemented entirely through code. The core reason lies in the inherent conflict between the uncertainty, subjectivity, and dynamic complexity of their analytical logic and the certainty, structure, and rule-based nature required by code. Therefore, there is an urgent need for a strategic analysis tool that can analyze strategic intelligence based on user input and ultimately generate strategic recommendations. Summary of the Invention
[0003] The purpose of this application is to provide a strategic recommendation method and device that can perform strategic intelligence analysis and generate strategic recommendations based on user-input requirements.
[0004] To achieve the above objectives, this application provides the following solution: Firstly, this application provides a strategic recommendation method, which is applied to a computer device capable of accessing knowledge bases and large models. The strategic recommendation method includes: The system obtains the user's input request and a text fragment; the text fragment is retrieved from the knowledge base based on the user's input request. The input request is inserted into the stance resolution call statement, which calls the large model to perform stance resolution on the input request and obtain the stance resolution result. The input request, the text fragment, and the position analysis result are inserted into the qualitative analysis call statement. The large model is invoked to perform qualitative analysis on the position analysis result in conjunction with the text fragment, and the qualitative analysis result is output. The qualitative analysis result includes strength indicators, weakness indicators, opportunity indicators, and threat indicators. The qualitative analysis results are then processed into a structured format to obtain qualitative analysis results in dictionary format. Based on the input request and the qualitative analysis results of the dictionary format, the optimal feature vector of the dictionary format is determined using the analytic hierarchy process (AHP). Based on the optimal eigenvector, the four-quadrant analysis method is used to calculate the four-quadrant analysis data for each strategy. The optimal strategy is determined based on the four-quadrant analysis data, and the optimal strategy is pushed to the user terminal.
[0005] Optionally, after inserting the input request into the position resolution call statement, calling the large model to perform position resolution on the input request, and obtaining the position resolution result, the method further includes: The position analysis results are pushed to the user's terminal for display, and the user's input of position analysis modification instructions is obtained; When the position analysis modification instruction is no, the step "insert the input request, the text fragment, and the position analysis result into the qualitative analysis call statement, call the large model to perform qualitative analysis on the position analysis result in combination with the text fragment, and output the qualitative analysis result" is invoked; When the position resolution modification instruction is yes, obtain the position resolution result modified by the user.
[0006] Optionally, the four-quadrant analysis data includes: SO, ST, OW, and OT; In this system, S represents strengths; W represents weaknesses; O represents opportunities; and T represents threats.
[0007] Optionally, the four-quadrant analysis data is: ; ; OW ; WT ; Where S[i] represents the i-th weight value of the advantage matrix in the qualitative analysis results; O[i] represents the i-th weight value of the opportunity matrix in the qualitative analysis results; T[i] represents the i-th weight value of the threat matrix in the qualitative analysis results; W[i] represents the i-th weight value of the disadvantage matrix in the qualitative analysis results; and n represents the order of the matrix.
[0008] Optionally, after calculating the four-quadrant analysis data for each strategy based on the optimal eigenvector using the four-quadrant analysis method, the method further includes: The four-quadrant analysis data is converted into dictionary form.
[0009] Optionally, the optimal strategy is determined based on the four-quadrant analysis data, and the optimal strategy is pushed to the user terminal, specifically including: The key corresponding to the largest four-quadrant analysis data is determined to be the optimal key; A strategy invocation statement is generated based on the optimal key. Executing the strategy invocation statement pushes the strategy corresponding to the optimal key as the optimal policy to the user terminal.
[0010] Secondly, this application provides a strategic recommendation system, which is applied to a computer device capable of accessing a knowledge base and a large model. The strategic recommendation system includes: The request retrieval module is used to obtain the user's input request and text fragment; the text fragment is obtained by retrieving it from the knowledge base based on the user's input request. The position resolution module is used to insert the input request into the position resolution call statement, call the large model to perform position resolution on the input request, and obtain the position resolution result; The qualitative analysis module is used to insert the input request, the text fragment, and the position analysis result into the qualitative analysis call statement, call the large model to perform qualitative analysis on the position analysis result in combination with the text fragment, and output the qualitative analysis result; the qualitative analysis result includes strength indicators, weakness indicators, opportunity indicators, and threat indicators; The structured processing module is used to perform structured processing on the qualitative analysis results to obtain qualitative analysis results in dictionary format; The hierarchical analysis module is used to determine the optimal feature vector of the dictionary format based on the input request and the qualitative analysis results of the dictionary format using the hierarchical analysis method. The four-quadrant analysis module is used to calculate the four-quadrant analysis data for each strategy based on the optimal feature vector and using the four-quadrant analysis method. The strategy push module is used to determine the optimal strategy based on four-quadrant analysis data and push the optimal strategy to the user terminal.
[0011] Thirdly, this application provides a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor executing the computer program to implement the steps of the strategic recommendation method described in any one of the above.
[0012] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the strategic recommendation method described in any one of the above.
[0013] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the strategic recommendation method described in any one of the above.
[0014] According to the specific embodiments provided in this application, the following technical effects are disclosed: This application provides a strategic recommendation method and device, which acquires user input requests and text fragments. The text fragments are retrieved from a knowledge base based on the user input requests. The input requests are inserted into a position analysis call statement, which calls a large model to perform position analysis on the input requests, obtaining position analysis results. The input requests, text fragments, and position analysis results are inserted into a qualitative analysis call statement, which calls a large model to perform qualitative analysis on the position analysis results in conjunction with the text fragments, outputting qualitative analysis results. The qualitative analysis results include strength indicators, weakness indicators, opportunity indicators, and threat indicators. The qualitative analysis results are structured to obtain dictionary-formatted qualitative analysis results. Based on the input requests and dictionary-formatted qualitative analysis results, the optimal feature vector in dictionary format is determined using the analytic hierarchy process (AHP). Based on the optimal feature vectors, the four-quadrant analysis method is used to calculate the four-quadrant analysis data for each strategy. Based on the four-quadrant analysis data, the optimal strategy is determined and pushed to the user. This application combines and toolizes three intelligence analysis methods—SWOT (qualitative analysis), Analytic Hierarchy Process (AHP, a method combining qualitative and quantitative analysis), and four-quadrant analysis (quantitative analysis)—in a workflow. This tool can perform strategic intelligence analysis based on user input and ultimately generate strategic recommendations. The addition of positional analysis to SWOT analysis improves the accuracy of the results. It automates the AHP workflow, combining quantitative and qualitative analysis, forming an end-to-end solution from data input to output. Furthermore, it automatically optimizes the judgment matrix, incorporating two optimization methods to automatically detect and correct inconsistencies in the judgment matrix, providing fault-tolerant handling. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 This is a flowchart of a strategic recommendation method according to an embodiment of this application; Figure 2 This is a framework diagram of a strategic recommendation system according to an embodiment of this application; Figure 3 This is a three-level framework diagram of AHP analysis in one embodiment of this application. Detailed Implementation
[0017] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0018] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0019] In one exemplary embodiment, such as Figure 1 As shown, a strategic recommendation method is provided, which is applied to a computer device capable of accessing knowledge bases and large models. The strategic recommendation method includes: Step 101: Obtain the user's input request and text fragment. The text fragment is retrieved from the knowledge base based on the user's input request. The user input can be from any domain, such as analysis of large-scale model technology development strategies, analysis of new energy technology development, analysis of quantum technology, etc.
[0020] Step 102: Insert the input request into the position resolution call statement, call the large model to perform position resolution on the input request, and obtain the position resolution result.
[0021] Following step 102, the process further includes: pushing the position analysis result to the user's terminal for display, and obtaining the user's input instruction to modify the position analysis. If the position analysis modification instruction is negative, step 103 is invoked. If the position analysis modification instruction is positive, the modified position analysis result is obtained.
[0022] Step 103: Insert the input request, text fragment, and position analysis results into the qualitative analysis call statement. Call the large model to perform qualitative analysis on the position analysis results using the text fragment, and output the qualitative analysis results. The qualitative analysis results include strength indicators, weakness indicators, opportunity indicators, and threat indicators.
[0023] Step 104: Perform structured processing on the qualitative analysis results to obtain the qualitative analysis results in dictionary format.
[0024] Step 105: Based on the qualitative analysis results of the input request and dictionary format, determine the optimal feature vector of the dictionary format using the analytic hierarchy process.
[0025] Step 106: Based on the optimal eigenvector, calculate the four-quadrant analysis data for each strategy using the four-quadrant analysis method. The four-quadrant analysis data includes: SO, ST, OW, and OT.
[0026] In this system, S represents strength, W represents weakness, O represents opportunity, and T represents threat.
[0027] The four-quadrant analysis data is as follows: ; ; OW ; WT ; Where S[i] represents the i-th weight value of the advantage matrix in the qualitative analysis results; O[i] represents the i-th weight value of the opportunity matrix in the qualitative analysis results; T[i] represents the i-th weight value of the threat matrix in the qualitative analysis results; W[i] represents the i-th weight value of the disadvantage matrix in the qualitative analysis results; and n represents the order of the matrix.
[0028] Following step 106, the process also includes: converting the four-quadrant analysis data into dictionary form.
[0029] Step 107: Determine the optimal strategy based on the four-quadrant analysis data and push the optimal strategy to the user terminal.
[0030] Step 107 specifically includes: determining the key corresponding to the largest four-quadrant analysis data as the optimal key; generating a strategy invocation statement based on the optimal key; and executing the strategy invocation statement to push the strategy corresponding to the optimal key as the optimal policy to the user terminal.
[0031] Secondly, this application provides a strategic recommendation system, which is applied to a computer device capable of accessing a knowledge base and a large model. The strategic recommendation system includes: The request retrieval module is used to obtain user input requests and text fragments. The text fragments are retrieved from the knowledge base based on the user's input requests.
[0032] The position resolution module is used to insert the input request into the position resolution call statement, call the large model to perform position resolution on the input request, and obtain the position resolution result.
[0033] The qualitative analysis module is used to insert the input request, the text fragment, and the position analysis result into the qualitative analysis call statement, call the large model to perform qualitative analysis on the position analysis result in combination with the text fragment, and output the qualitative analysis result; the qualitative analysis result includes strength indicators, weakness indicators, opportunity indicators, and threat indicators.
[0034] The structuring module is used to perform structuring processing on the qualitative analysis results to obtain qualitative analysis results in dictionary format.
[0035] The hierarchical analysis module is used to determine the optimal feature vector of the dictionary format based on the input request and the qualitative analysis results of the dictionary format using the hierarchical analysis method.
[0036] The four-quadrant analysis module is used to calculate the four-quadrant analysis data for each strategy based on the optimal feature vector using the four-quadrant analysis method.
[0037] The strategy push module is used to determine the optimal strategy based on four-quadrant analysis data and push the optimal strategy to the user terminal.
[0038] In one exemplary embodiment, a strategic recommendation system is provided as a tool that can be invoked by a large-model-driven intelligence analysis agent. This system can perform strategic intelligence analysis based on user-input requirements and ultimately generate strategic recommendations. The tool includes three functional modules: SWOT analysis, analytic hierarchy process (AHP), and four-quadrant analysis. The system structure is as follows: Figure 2 As shown.
[0039] SWOT Qualitative Analysis Module: The implementation steps are as follows: 1. This module has two input parameters: one is subject, which is the user's input request; the other is collected_information, which is the text fragment retrieved based on the subject of the user's input request.
[0040] 2. Perform stance parsing on the user input request subject. The stance parsing steps are as follows: (1) Conduct semantic and logical analysis of the subject to clarify the boundaries of the requirements and the core position.
[0041] (2) Infer users and identify potential stakeholders.
[0042] (3) Deduce the scene background and supplement the position scene dimension.
[0043] (4) Explore potential demands and improve the core elements of the position.
[0044] (5) Summarize the core positions and form analytical conclusions.
[0045] Input the prompt word into the large model: "Please perform stance analysis on the user-input {subject}, following the analysis steps: (1) Semantically analyze the subject to clarify the demand boundaries and core stance; (2) Infer the user and identify potential stance subjects; (3) Deduce the scenario background and supplement the stance scenario dimension; (4) Explore potential demands and improve the core elements of the stance; (5) Summarize the core of the stance and form the analysis conclusion. Finally, please output the analysis conclusion."
[0046] 3. Print the analysis conclusion to the user for confirmation, and ask the user to select whether they need to modify it. If the user returns Y, ask the user to enter the modified analysis conclusion. The user's modified position analysis conclusion will be used as the final position analysis result. If the user returns N, the position analysis result of the large model will be used directly as the final position analysis result standpoint.
[0047] 4. Set the prompt to "Please analyze the standpoint using SWOT analysis, focusing on the task {subject} and incorporating the content of {collected_infomation}. Do not add prefixes such as 'I.' or '1.' before the strengths, weaknesses, opportunities, threats, and strategic recommendations in the output." Call the large model and retrieve the SWOT analysis results returned by the large model.
[0048] 5. Perform structured processing on the SWOT results returned by the large model in string text format, processing them into the following format: Dictionary format: {"Strengths": [entry 1, entry 2, ...], "Weaknesses": [entry 1, entry 2, ...], "Opportunities": [entry 1, entry 2, ...], "Threats": [entry 1, entry 2, ...]}.
[0049] The processing steps are as follows: (1) First, create the result dictionary and initialize it as an empty list.
[0050] (2) Preprocess the SWOT analysis results in string form by splitting the text by line, removing the leading and trailing spaces of each line, and filtering out blank lines.
[0051] (3) Define flexible regular expression patterns to match various title formats.
[0052] section_patterns={"Strengths": [r"Strengths"}} :: ( )?", #Strengths :: ( Advantages )?", #Strengths :: #S: or S:r"^##?\s+advantages", ##advantages or ##advantages], "Weaknesses": [r"weaknesses" :: ( )?", :: ( Disadvantages )?", :: ,r"^##?\s+disadvantages",],"Opportunities":[r"opportunities" :: ( )?", :: ( Chance )?", :: ,r"^##?\s+opportunity",],"Threats":[r"threats" :: ( )?", :: ( threaten )?", :: ,r"^##?\s+threat",]}.
[0053] This regular expression supports multiple heading formats (mixed Chinese and English), punctuation variations (colon, parentheses), case insensitivity, and Markdown format.
[0054] (4) Traverse each row and process them one by one: 1) First, determine if it is a header line: Iterate through section_patterns and try to match the pattern list for each section. If a match is found, it means that the line is a header line, and the header is the current category to be processed.
[0055] 2) If it's not a title and there's a category, try extracting the entry. Multiple entry formats are supported: Begin with a bullet point: -, ️]\s+(.+)',line).
[0056] Number list format, such as numbers in parentheses: (1), (2), etc.: num_match=re.match(r'^\d+[\.\)]\s+(.+)',line).
[0057] Numbering in parentheses, for example, (a), (b), etc.: paren_match=re.match(r'^\([a-zA-Z0-9]+\)\s+(.+)',line).
[0058] Markdown bold text, for example High brand awareness High brand awareness: item_content=re.sub( ,r'\1',line).strip().
[0059] Plain text.
[0060] 3) Clean up the extracted entries and remove punctuation marks at the end.
[0061] 4) Remove duplicate entries from the extracted items to ensure that there are no duplicate entries in the same category.
[0062] Example: Input text: “ ###Strengths High brand awareness High market share - Strong technological research and development capabilities " Processing procedure: The "Strengths" title has been identified, and the current category has been set. When encountering "high brand awareness and high market share": Matching bullet formatting Extract "high brand awareness and high market share" Remove bold markers -> "High brand awareness, high market share" Remove the punctuation at the end -> "High brand awareness and high market share" When encountering "-strong technical R&D capabilities": Similar processing yields the result of "strong technological research and development capabilities". Output result: { Strengths: [High brand awareness, high market share, strong technological R&D capabilities] #...The other three categories } Analytic Hierarchy Process (AHP) module: This module mainly implements the complete AHP (Analytical Hierarchy Process) workflow. Through steps such as establishing a judgment matrix, calculating weights, and performing consistency checks, it ultimately obtains the relative importance ranking of specific indicators under the four dimensions of strengths, weaknesses, opportunities, and threats in each SWOT analysis result.
[0063] The implementation steps are as follows: 1. Generate all judgment matrices, the steps are as follows: (1) There are two input parameters. Parameter 1 is the user requirement subject; parameter 2 is Indicator_layer, which is the SWOT analysis result in dictionary format output by the SWOT analysis module.
[0064] Indicator_layer={ "Strengths": ["S-Indicator 1", "S-Indicator 2", "S-Indicator 3", ...] "Weaknesses": ["W Indicator 1", "W Indicator 2", ...] "Opportunities": ["O Indicator 1", "O Indicator 2", ...] "Threats": ["T-indicator 1", "T-indicator 2", ...]} Example of Indicator_layer: Indicator_layer={ Strengths: ["Policy support", "Technological capabilities", "Market foundation"] Weaknesses: [High costs, limited talent] "Opportunities": ["Market growth", "Favorable policies"] "Threats": ["Intense competition", "Rapid technological updates"] (2) Based on user needs and the SWOT analysis results in dictionary form, a three-level AHP analysis framework is generated. User needs (subject) is used as the target layer, and "strengths, weaknesses, opportunities, and threats" are used as the four criteria in the criterion layer. The values corresponding to each criterion key in the dictionary are in list format, and each element in the list format serves as the corresponding indicator, such as... Figure 3 As shown.
[0065] (3) Construct a comparison matrix.
[0066] 1) First, define the importance scale calculation function `Importance_Scale(subject, key, fact1, fact2)`, where `subject` represents the content of the target layer, `key` represents the criteria of the criterion layer, and `fact1` and `fact2` represent any two indicators of the indicator layer, for example, `fact1 = S indicator1`, `fact2 = S indicator2`. This function calculates the value of each element in the comparison matrix.
[0067] Set prompt=f'Please output the importance scale of the analytic hierarchy process (AHP) based on the {key} aspect of the task "{subject}". This importance scale is used to generate the comparison matrix for AHP. You can only output a single value, not other content. Please iterate through the following criteria: f'If factor {fact1} is slightly more important than factor {fact2}, output an importance scale value of 3; if factor {fact2} is slightly more important, output an importance scale value of 1 / 3.'\ f'If factor {fact1} is more important than factor {fact2}, output an importance scale value of 5; if factor {fact2} is more important, output an importance scale value of 1 / 5.'\ f'If factor {fact1} is significantly more important than factor {fact2}, output an importance scale value of 7; otherwise, output an importance scale value of 1 / 7.'\ f'If factor {fact1} is absolutely more important than factor {fact2}, output an importance scale value of 9; if factor {fact2} is absolutely more important, output an importance scale value of 1 / 9.'\ f'If factor {fact1} is between equal importance and slightly important as factor {fact2}, output an importance scale value of 2; otherwise, output an importance scale value of 1 / 2. If factor {fact1} is between slightly important and relatively important as factor {fact2}, output an importance scale value of 4; otherwise, output an importance scale value of 1 / 4. If factor {fact1} is between important and very important, output an importance scale value of 6; if factor {fact2} is between important and important, output an importance scale value of 1 / 6. f'If factor {fact1} and factor {fact2} are compared, if the former is between very important and absolutely important, output the importance scale value of 8, and if the latter is between very important and absolutely important, output the importance scale value of 1 / 8'\ f'Please output the importance scale values of the analytic hierarchy process according to the above criteria, and ensure that the comparison matrix generated by the importance scale values can pass the consistency test' Generate the comparison scale of pairwise indicators by calling the large model. response = llm.invoke(prompt) scale_str = response.content, where scale_str is the result of the comparison scale of pairwise indicators. Convert the result to float and finally return the result of float(scale_str).
[0068] 2) Construct the superiority comparison matrix S, inferiority comparison matrix W, opportunity comparison matrix O, threat comparison matrix T, and subject comparison matrix A respectively.
[0069] Define the comparison matrix construction function Comparison_matrix_construction(subject, key, n, Index_list), where subject is the content of the target layer, key represents each criterion in the criterion layer, n is the length of the list, and Index_list is the indicator solution layer corresponding to each criterion layer. Construct a full-zero matrix Comparison_Matrix. Traverse each element of the full-zero matrix. If row i = column j, assign the value 1 to the element in the i-th row and j-th column of the matrix. If row i < j, calculate Comparison_Matrix[i][j] = Importance_Scale(subject, key, Index_list[i], Index_list[j]). If i > j, calculate Comparison_Matrix[i][j] = 1 / Comparison_Matrix[j][i].
[0070] Generate the comparison matrices S, W, O, T: Traverse all keys in Indicator_layer and obtain the generated comparison matrices S, W, O, T through the function Comparison_matrix_construction().
[0071] Generating the subject comparison matrix A: The steps are the same as calculating matrices S, W, O, and T. The difference is that fact1 and fact2 are inputs containing all the values in the list format of Indicator_layer, for example, fact1=["S indicator 1", "S indicator 2", "S indicator 3", ...], fact2=["W indicator 1", "W indicator 2", ...].
[0072] 2. Calculate the largest eigenvalue and its corresponding eigenvector of all comparison matrices, following these steps: (1) First check whether the input matrix is a square matrix to ensure that the input matrix must be a square matrix, and calculate all eigenvalues and eigenvectors.
[0073] (2) Use np.linalg.eig(matrix) to calculate all eigenvalues and eigenvectors, and use max_idx=np.argmax(eigenvalues) to find the index position max_idx of the largest eigenvalue.
[0074] (3) Extract the eigenvectors corresponding to the largest eigenvalue. eigenvectors[:,max_idx] extracts the max_idx column as the eigenvectors corresponding to the largest eigenvalue.
[0075] (4) Take the real part of the corresponding eigenvector.
[0076] (5) Eigenvector normalization processing.
[0077] (6) Obtain the largest eigenvalue of all comparison matrices. And the largest eigenvector.
[0078] 3. Perform a consistency check on all comparison matrices, following these steps: According to the AHP consistency test rules, calculate the consistency index: CI = ( -n) / (n-1), where n represents the order of the comparison matrix.
[0079] Calculate the consistency ratio: CR=CI / RI The value of RI is obtained by looking up a table.
[0080] `ri_dict = {1: 0.0, 2: 0.0, 3: 0.58, 4: 0.90, 5: 1.12, 6: 1.24, 7: 1.32, 8: 1.41}`, where the key in `ri_dict` is the order of the matrix. For example, the RI value for a fourth-order matrix is 0.9. When the order `n` < 2, no consistency check is required. When `n` > 2, the consistency ratio is calculated. If `CR` < 0.1, the consistency check passes; if `CR` > 0.1, the consistency check fails.
[0081] 4. If the current comparison matrix fails the consistency check, the comparison matrix is optimized using an iterative adjustment method. The steps are as follows: (1) Define the standard scale set: S={1 / 9, 1 / 8, 1 / 7, 1 / 6, 1 / 5, 1 / 4, 1 / 3, 1 / 2, 1, 2, 3, 4, 5, 6, 7, 8, 9} These are the 17 standard comparison scale values allowed by AHP.
[0082] (2) Set algorithm parameters: Maximum number of iterations: usually set to 15-20.
[0083] Convergence threshold: CR < 0.1 (consistency acceptable).
[0084] Initialization: Copy the original matrix A → A'.
[0085] (3) Calculate the current consistency and determine whether to terminate.
[0086] Condition 1: CR < 0.1 → Consistency met, terminate.
[0087] Condition 2: Reaching the maximum number of iterations → Forced termination.
[0088] Condition 3: CR value tends to stabilize → early termination.
[0089] (4) Calculate the weight vector: The weight vector W is calculated using the geometric mean method. 1) Calculate the geometric mean of each row of the judgment matrix (i.e., multiply each element and then take the nth root, where n is the number of columns in the matrix, i.e., the dimension).
[0090] 2) Normalize the obtained geometric mean vector (divide each element by the sum of all elements) to obtain the weight vector.
[0091] (5) Calculate the deviation matrix B: , Compare the values at positions i and j in matrix A. In a perfectly consistent matrix, all elements B[i, j] should be 1. Therefore, the degree to which an element in the deviation matrix B deviates from 1 indicates the degree of inconsistency. The greater the deviation from 1, the more inconsistent the element; weight protection: check weights[j] > 0 to avoid division by zero errors.
[0092] (6) Identify the element with the largest deviation; First, set the diagonal of the deviation matrix B to zero and do not adjust the diagonal elements (the comparison between itself and itself is fixed at 1). Then find the largest deviation: find the position of the largest |B[i,j]-1|, return the flat index of the maximum value in the array, and finally convert the flat index into the multidimensional index i,j.
[0093] (7) Adjust the element values at the multidimensional indices i and j of the original comparison matrix. Find the value new_val with the smallest difference from old_val in the scales list and replace the original element value, ensuring that the adjusted value conforms to the AHP scaling specification. Set new_val to The new value will Set to 1 / new_val to maintain reciprocity and always keep it. =1 / .
[0094] (8) Return the optimized matrix and CR history.
[0095] 5. If step 4 reaches the maximum number of iterations and still fails the consistency check, the comparison matrix will be regenerated using the eigenvector reconstruction method. The steps are as follows: (1) Define the standard scale set: S={1 / 9, 1 / 8, 1 / 7, 1 / 6, 1 / 5, 1 / 4, 1 / 3, 1 / 2, 1, 2, 3, 4, 5, 6, 7, 8, 9}.
[0096] These are the 17 standard comparison scale values allowed by AHP.
[0097] (2) Calculate the largest eigenvalue and eigenvector of the last comparison matrix in step 4, and normalize the eigenvector into weights.
[0098] (3) Reconstruct the ideal consistency matrix ideal_matrix, ideal_matrix[i,j]=weights[i] / weights[j].
[0099] (4) Round each element of the ideal matrix ideal_matrix to the nearest standard scale value. Steps: 1) Calculate the absolute value of the difference between each element of the ideal matrix and each value in the standard scale array: np.abs(SCALES-ideal_matrix[i,j]) This will result in an array with the same shape as the SCALES array, containing the absolute difference between the elements of the ideal matrix and each standard scale.
[0100] 2) Find the index of the minimum value among these absolute differences: closest_idx = np.argmin(diff) This index corresponds to the position of the scale value in the SCALES array that is closest to the element of the ideal matrix.
[0101] 3) Based on the found index, retrieve the corresponding scale value from the SCALES array: new_val=SCALES[closest_idx]. This value is the standard scale value used to replace the ideal matrix element.
[0102] (5) Calculate the CR value and return it.
[0103] (6) Set the adjusted comparison matrix as the current comparison matrix.
[0104] 6. Calculate the eigenvector corresponding to the largest eigenvalue of the current comparison matrix, normalize it, and output it in dictionary format. Finally, return the scoring results table for each indicator scheme.
[0105] Example of a dictionary-formatted feature vector: {'Strengths': array([0.06682474, 0.13900107, 0.03212599]), 'Weaknesses': array([0.21305328, 0.02954458, 0.0614552]), 'Opportunities': array([0.24841663, 0.04842498, 0.08495729]), 'Threats': array([0.01028729, 0.02139843, 0.04451052])}, the scoring results are shown in Table 1 for example.
[0106] Table 1 Example of Scoring Results Four-quadrant analysis module: The steps are as follows: 1. Calculate the average weight of the feature vectors output by the AHP module in dictionary format, and store the average weights in dictionary format as result_dict.
[0107] Example: result_dict={'Advantages': 0.25, 'Disadvantages': 0.15, 'Opportunities': 0.35, 'Threats': 0.25} 2. Calculate the values for the four quadrants: SO, ST, OW, and WT.
[0108] SO = result_dict['Strengths'] Opportunities ST = result_dict['Strengths'] Threats OW = result_dict['Opportunities'] Weaknesses WT = result_dict['Weaknesses'] dict['Threats'] / 2 Store the four quadrant values as a dictionary: data={'SO':SO, 'ST':ST, 'OW':OW, 'WT':WT} 3. Provide optimal strategic recommendations.
[0109] Find the key of the maximum value of data={'SO':SO,'ST':ST,'OW':OW,'WT':WT}: max_name=max(data,key=data.get).
[0110] The recommended output is result_str=f"Based on analysis, the {max_name} strategy is recommended".
[0111] Calculate the four values of SOSTOWWT, and the recommendation strategy corresponding to the largest value is the recommendation strategy.
[0112] If SO is the optimal strategy, then input prompt words for the large model: prompt="Based on the SWOT analysis results {SWOT_result}, for task {subject}, adopt the SO strategy, i.e., strengths-opportunities, an offensive strategy. Please generate strategic recommendations for adopting the SO strategy.
[0113] If ST is the optimal strategy, then input prompt words for the large model: prompt="Based on the SWOT analysis results {SWOT_result}, for task {subject}, adopt the ST strategy, namely Strengths-Threats, Countermeasure / Diversification Strategy. Please generate strategic recommendations for adopting the ST strategy.
[0114] If OW is the optimal strategy, then input prompt words for the large model: prompt="Based on the SWOT analysis results {SWOT_result}, for task {subject}, adopt the SO strategy, i.e., weakness-opportunity, turnaround strategy. Please generate strategic recommendations for adopting the OW strategy.
[0115] If WT is the optimal strategy, then input prompt words for the large model: prompt="Based on the SWOT analysis results {SWOT_result}, for task {subject}, adopt the ST strategy, i.e., weakness-threat, defense / retreat strategy. Please generate a strategic recommendation to adopt the WT strategy. Finally, the output of the large model is the final recommendation strategy text.
[0116] The SWOT analysis results, the AHP module's output in tabular form, and the final recommendation strategy (text) are returned to the user.
[0117] In one exemplary embodiment, a computer device is provided, which may be a server or a terminal. The computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is connected to the system bus via the I / O interfaces. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes non-volatile storage media and internal memory. The non-volatile storage media stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The I / O interfaces of the computer device are used for exchanging information between the processor and external devices. The communication interface of the computer device is used for communicating with external terminals via a network connection.
[0118] In one exemplary embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0119] In one exemplary embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.
[0120] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.
[0121] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0122] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).
[0123] The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0124] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0125] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A strategy recommendation method characterized by, The strategy recommendation method is applied to a computer device capable of calling a knowledge base and a large model, and the strategy recommendation method comprises: Obtaining an input request and a text segment of a user; the text segment is obtained by searching the knowledge base based on the input request of the user; Inserting the input request into a position analysis calling statement to call a large model to analyze the position of the input request, and obtaining a position analysis result; Inserting the input request, the text segment and the position analysis result into a qualitative analysis calling statement to call a large model to analyze the position analysis result in combination with the text segment, and outputting a qualitative analysis result; the qualitative analysis result comprises an advantage index, a disadvantage index, an opportunity index and a threat index; Structurally processing the qualitative analysis result to obtain a dictionary format qualitative analysis result; Based on the input request and the dictionary format qualitative analysis result, an optimal feature vector in dictionary format is determined by using an analytic hierarchy process; Based on the optimal feature vector, four-quadrant analysis data of each strategy is calculated by using a four-quadrant analysis method; Based on the four-quadrant analysis data, an optimal strategy is determined, and the optimal strategy is pushed to a user end.
2. The strategy recommendation method of claim 1, wherein, After inserting the input request into the position analysis calling statement to call the large model to analyze the position of the input request, and obtaining the position analysis result, the method further comprises: Pushing the position analysis result to the user end for display, and obtaining a position analysis modification instruction input by the user; When the position analysis modification instruction is no, the step of inserting the input request, the text segment and the position analysis result into the qualitative analysis calling statement to call the large model to analyze the position analysis result in combination with the text segment, and outputting the qualitative analysis result is called; When the position analysis modification instruction is yes, a modified position analysis result of the user is obtained.
3. The strategy recommendation method of claim 1, wherein, The four-quadrant analysis data comprises SO, ST, OW and OT; Wherein, S represents advantage; W represents disadvantage; O represents opportunity; and T represents threat.
4. The strategy recommendation method of claim 3, wherein, The four-quadrant analysis data is: ; ; OW ; WT ; Wherein, S[i] represents the i th weight value of the advantage matrix in the qualitative analysis result; O[i] represents the i th weight value of the opportunity matrix in the qualitative analysis result; T[i] represents the i th weight value of the threat matrix in the qualitative analysis result; W[i] represents the i th weight value of the disadvantage matrix in the qualitative analysis result; and n represents the order of the matrix.
5. The strategy recommendation method of claim 1, wherein, After calculating the four-quadrant analysis data of each strategy by using the four-quadrant analysis method based on the optimal feature vector, the method further comprises: Converting the four-quadrant analysis data into a dictionary format.
6. The strategy recommendation method of claim 5, wherein, Based on the four-quadrant analysis data, an optimal strategy is determined, and the optimal strategy is pushed to a user end, specifically comprising: Determining the key corresponding to the maximum four-quadrant analysis data as an optimal key; Generating a strategy calling statement based on the optimal key, and executing the strategy calling statement to push the strategy corresponding to the optimal key to the user end as an optimal strategy.
7. A strategy recommendation system characterized by, The strategy recommendation system is applied to a computer device capable of calling a knowledge base and a large model, and the strategy recommendation system comprises: The request retrieval module is configured to obtain an input request of a user and a text segment, wherein the text segment is obtained by searching the knowledge base based on the input request of the user; The position analysis module is configured to insert the input request into a position analysis calling statement, call a large model to perform position analysis on the input request, and obtain a position analysis result; The qualitative analysis module is configured to insert the input request, the text segment, and the position analysis result into a qualitative analysis calling statement, call a large model to perform qualitative analysis on the position analysis result in combination with the text segment, and output a qualitative analysis result, wherein the qualitative analysis result includes an advantage index, a disadvantage index, an opportunity index, and a threat index; The structured processing module is configured to perform structured processing on the qualitative analysis result to obtain a dictionary format qualitative analysis result; The analytic hierarchy process module is configured to determine an optimal feature vector in dictionary format based on the input request and the dictionary format qualitative analysis result by using an analytic hierarchy process; The four-quadrant analysis module is configured to calculate four-quadrant analysis data of each strategy based on the optimal feature vector by using a four-quadrant analysis method; The strategy pushing module is configured to determine an optimal strategy based on the four-quadrant analysis data and push the optimal strategy to a user terminal.
8. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the strategy recommendation method of any one of claims 1-7.
9. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the strategy recommendation method of any one of claims 1-7.
10. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the strategy recommendation method of any one of claims 1-7.