Complex formula intelligent calculation method for ship field
By generating standardized formula documents through multimodal parsing and large language models, and combining knowledge graphs and physical consistency checks, the problem of automating complex formulas in ship design is solved, improving the accuracy and consistency of calculation results.
Patent Information
- Application Number
- CN202511344863.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-19
- Publication Date
- 2025-12-23
AI Technical Summary
In ship design and engineering calculations, existing technologies are cumbersome to find and arrange complex formulas, and are prone to omissions or errors. The lack of automated verification and correction mechanisms leads to unreliable calculation results.
Multimodal parsing technology is used to extract text, image, formula and table information, a large language model is used to generate standardized formula calculation documents, and formula completion is performed by knowledge graph and large model. Combined with cross-modal error correction and physical consistency verification, executable calculation code is automatically generated and stored in knowledge base.
It achieves standardized expression and automatic completion of complex formulas, improves the reliability and consistency of calculation results, and enhances the automation level of engineering calculations.
Smart Images

Figure CN121189299A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to the technical field of artificial intelligence and ship engineering, and in particular to a complex formula intelligent calculation method for the ship field. BACKGROUND
[0002] In the process of ship design and engineering calculation, a large number of complex formulas related to buoyancy, resistance, stability and strength are involved. These formulas are usually scattered in design manuals, engineering drawings and attached calculation files, and are expressed in the form of text, images, tables and handwritten or formula editor generated expressions.
[0003] The existing method mainly relies on manual searching and arrangement. Engineers need to manually check the formulas, supplement the missing conditions and write calculation codes. The process is tedious and prone to omissions or errors. In addition, when the formula has missing variables, unexplained conditions or inconsistent dimensions, the existing technology lacks effective automated inspection and correction mechanism, which may lead to unreliable calculation results. Therefore, we propose a complex formula intelligent calculation method for the ship field. SUMMARY
[0004] The purpose of the present application is to overcome the shortcomings of the prior art and provide a complex formula intelligent calculation method for the ship field to solve the technical problems mentioned in the background.
[0005] To achieve the above purpose, the application provides the following technical scheme:
[0006] A complex formula intelligent calculation method for the ship field comprises the following steps:
[0007] S1, obtaining a complex formula calculation file in a ship design document, performing multi-modal analysis on the file, extracting text, image, formula and table information, and converting them into structured data;
[0008] S2, based on the structured data, filling a preset standardized formula calculation document template with a large language model to generate a standardized formula calculation document containing formula expression, parameter definition, calculation steps and unit representation;
[0009] S3, in the case of incomplete formula, missing variable or unexplained condition, calling a formula reverse reasoning module to automatically complete the missing formula segment and variable condition based on the knowledge graph and large model reasoning result to generate a complete formula expression;
[0010] S4, cross-modal error correction and physical consistency verification are performed on the generated formula calculation document, the formula recognition model and the table recognition model are used to check the format and value consistency, the formula result is checked for consistency based on the physical dimension constraint and the conservation law, and if a physical logic conflict is detected, a correction suggestion is output and the formula expression is automatically updated;
[0011] S5, executable calculation code is automatically generated based on the verified formula calculation document, and is stored in the formula calculation knowledge base together with the variable dependency relationship.
[0012] S6, when a natural language calculation request is input by a user, an intelligent agent retrieves the knowledge base according to the user input, parses the variable value, and calls the corresponding calculation code to output the final calculation result.
[0013] S1 is specifically:
[0014] Collecting ship design documents, the ship design documents including design specifications, design drawings and attached calculation files;
[0015] File format recognition is performed on the ship design documents to determine the text, image, formula and table information areas therein;
[0016] The information areas are parsed one by one using a multi-modal analysis module to obtain text content, image objects, formula expressions and table data;
[0017] The parsed results are converted into unified structured data, including text data, image feature data, formula symbol data and table cell data.
[0018] S2 is specifically:
[0019] The structured data is received and input into a large language model;
[0020] A preset standardized formula calculation document template is called in the large language model, the template including a formula expression part, a parameter definition part, a calculation step part and a unit representation part;
[0021] Based on the template and the structured data, a standardized formula calculation document is generated;
[0022] The symbol definition, variable meaning, dimension unit and calculation step of each formula are explicitly stated in the document to ensure uniform formula expression.
[0023] S3 is specifically:
[0024] The standardized formula calculation document is detected, and if there is an incomplete formula, missing variable or condition not specified, a formula reverse reasoning module is triggered;
[0025] In the formula reverse reasoning module, knowledge graph query and large language model reasoning are called to deduce missing formula fragments and variable conditions;
[0026] The reasoning result is completed to the standardized formula calculation document to form a complete formula expression;
[0027] The completion result is marked to record the reasoning source and logical basis to support subsequent verification.
[0028] S4 is specifically:
[0029] The complete formula expression is cross-modal checked, a formula recognition model and a table recognition model are called to test the consistency of document format and numerical value;
[0030] Based on the physical dimension constraint and the conservation law, the formula result is physically consistent, and whether there is a logical conflict is judged;
[0031] If a physical logical conflict is detected, a correction suggestion is output, and the formula expression in the standardized formula calculation document is automatically updated;
[0032] The formula calculation document that passes the check is marked as verified and enters the subsequent processing link.
[0033] S5 is specifically:
[0034] According to the verified formula calculation document, a code generation module is called to automatically generate corresponding executable calculation code;
[0035] When generating the calculation code, the dependency relationship of each variable in the formula is extracted to form a variable dependency relationship graph;
[0036] The calculation code and the variable dependency relationship graph are stored in the formula calculation knowledge base;
[0037] During storage, an indexing mechanism is established to support subsequent quick retrieval by formula expression or variable name.
[0038] S6 is specifically:
[0039] When a user inputs a natural language calculation request, an intelligent agent receives the input request;
[0040] The intelligent agent performs semantic analysis on the input request based on a semantic analysis module to extract the target formula and variable value in the request;
[0041] The intelligent agent retrieves the formula calculation knowledge base to locate the calculation code matching the request;
[0042] Call the calculation code, and perform calculation according to the variable value;
[0043] Output the calculation result to the user to generate an explanatory result containing formula reasoning process and calculation basis.
[0044] Based on the confidence score of the candidate result output by the large language model, only when the score is greater than the preset threshold, the completion result is accepted, and secondary screening is carried out in combination with physical dimension verification and conservation law, to ensure the reliability of the completed formula.
[0045] The intelligent agent supports multiple output formats when outputting the calculation result, and the output formats include JSON format, Markdown format or PDF format.
[0046] The beneficial effects of the present application are:
[0047] The present application realizes the standardized expression of complex formula information in the design document by uniformly converting text, images, formulas and tables into structured data through multi-modal analysis of the ship design document, avoids the inefficient way of manual searching and sorting one by one, and improves the integrity and consistency of data processing.
[0048] The present application uses a large language model to automatically generate a standardized formula calculation document in combination with a preset template, and clearly defines symbols, variable meanings, dimensions and units, and calculation steps, realizes the unification and reproducibility of formula expression, and reduces ambiguity and errors caused by manual understanding bias.
[0049] The present application automatically completes the formula based on the knowledge graph and the large model reasoning when the formula is incomplete or the variable is missing, and performs secondary screening through the confidence threshold and the physical dimension consistency test, to ensure the accuracy and reliability of the completion process, and solves the problem that the formula is difficult to automatically correct in the prior art.
[0050] The present application realizes automatic comparison of formulas and table data through cross-modal checking and physical consistency checking mechanism, performs logical consistency check based on conservation law and dimension constraint, and gives correction suggestions when conflicts are found, effectively improving the physical rationality and reliability of the formula calculation result.
[0051] The present application can automatically convert the tested formula calculation document into executable calculation code, generate a variable dependency relationship graph, and store it in the knowledge base, support index retrieval and version update, realize the structured management and traceability of formula knowledge, and significantly improve the automation degree of engineering calculation. BRIEF DESCRIPTION OF DRAWINGS
[0052] Figure 1 It is a schematic diagram of a complex formula intelligent calculation method for ship field. DETAILED DESCRIPTION
[0053] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work are within the protection scope of the present application.
[0054] Embodiment one: as shown, the embodiment provides a complex formula intelligent calculation method for the field of ships, specifically including the following steps: Figure 1
[0055] S1, obtaining a complex formula calculation file in a ship design document, performing multi-modal analysis on the file, extracting text, image, formula and table information, and converting them into structured data;
[0056] S2, based on the structured data, filling a preset standardized formula calculation document template with a large language model to generate a standardized formula calculation document containing formula expression, parameter definition, calculation steps and unit representation;
[0057] S3, in the case of incomplete formula, missing variables or unexplained conditions, calling a formula reverse reasoning module, automatically completing the missing formula fragments and variable conditions based on the knowledge graph and the inference result of the large model, and generating a complete formula expression;
[0058] S4, performing cross-modal error correction and physical consistency verification on the generated formula calculation document, checking the format and numerical consistency through a formula recognition model and a table recognition model; based on the physical dimension constraint and the conservation law, performing consistency verification on the formula result, if a physical logic conflict is detected, outputting a correction suggestion and automatically updating the formula expression;
[0059] S5, according to the verified formula calculation document, automatically generating executable calculation code, and storing it to a formula calculation knowledge base together with the variable dependency relationship;
[0060] S6, when a user inputs a natural language calculation request, an intelligent agent retrieves the knowledge base according to the user input, analyzes the variable value and calls the corresponding calculation code, and outputs the final calculation result.
[0061] S1, obtaining a complex formula calculation file in a ship design document, performing multi-modal analysis on the file, extracting text, image, formula and table information, and converting them into structured data; specifically including the following sub-steps:
[0062] S110: Collect ship design documents, including design specifications (PDF and Word formats), design drawings (DXF and DWG formats), and supplementary calculation files (Excel and CSV formats). Collection methods include: file upload interface, API call interface, and scanning of paper drawings. If the document is scanned, it will first be converted into a digital file using an Optical Character Recognition (OCR) module.
[0063] S120: The ship design document is subjected to file format recognition, and the document pages are segmented using a layout analysis algorithm. The layout analysis algorithm can be a traditional segmentation method based on projection contours, or a layout segmentation model based on deep learning convolutional neural networks (CNN). The method identifies text regions, image regions, formula regions, and table regions in the document.
[0064] S130: The information regions are parsed one by one using a multimodal parsing module: Text region: Lexical and syntactic analysis is performed using a natural language processing model to output plain text data; Image region: Image feature vectors are extracted using a convolutional neural network to represent ship structure diagrams or curves; Formula region: Formula OCR model combined with LaTeX / MathML parsing method is used to extract formula symbols and formula structure tree; Table region: Table structure recognition model (such as table structure parsing based on Transformer) is used to extract the correspondence between cell data and table headers.
[0065] S140: The parsing results are transformed into unified structured data, the structured data being...
[0066] Stored in JSON / XML format, containing the following fields:
[0067] Text data: Records paragraph numbers and content;
[0068] Image feature data: records the image ID and feature vector;
[0069] Formula symbol data: records formula expressions, variable symbols, and symbol hierarchy relationships;
[0070] Table cell data: Records the table ID, row and column index, and cell content. Example as follows:
[0071]
[0072] In the embodiments, typical parameter configurations are given for the models involved in multimodal parsing to ensure the reproducibility of the scheme. For example, the formula OCR model adopts a four-layer convolutional neural network (CNN) with a kernel size of 3×3. Each convolutional layer is followed by batch normalization and ReLU activation function, and finally outputs the formula symbol sequence through a fully connected layer; the batch size is set to 64, the initial learning rate is 0.001, the optimizer is Adam, and the training epochs are no less than 100.
[0073] The table parsing model employs a Transformer-based structured parsing network with 6 encoding layers, 8 attention heads, 512 hidden layers, and a dropout parameter of 0.1. The semantic parsing model uses a bidirectional LSTM + attention mechanism with 300 word vector dimensions and 256 hidden units. The training datasets include the publicly available formula OCR dataset CROHME2019, the table structure dataset PubTabNet, and a self-built ship mechanics formula sample library (approximately 20,000 manually annotated samples). With this configuration, the formula recognition accuracy reaches over 96%, and the table structure parsing accuracy is approximately 94%.
[0074] S2. Based on the structured data, a large language model is used to populate a preset standardized formula calculation document template, generating a standardized formula calculation document containing formula expressions, parameter definitions, calculation steps, and unit representations; specifically including the following sub-steps:
[0075] S210: Receive the structured data and input the structured data into the large language model. Specifically, the structured data is organized in JSON format, where each field is mapped to a corresponding part of the formula calculation document, for example:
[0076]
[0077] When inputting a large language model, the mapping relationship between fields and templates can be specified through prompt words, such as: "Fill the formula fields in the formula expression part, and fill the parameter fields one by one in the parameter definition table".
[0078] S220: When calling a pre-defined standardized formula calculation document template within the large language model, the template is pre-stored in the system storage unit in the form of an XML file or a database table structure. The calling method includes: when structured data is input into the large language model, the system calls the template through a template mapping interface; the template mapping interface automatically fills the input data into the corresponding positions in the template based on field matching rules (e.g., "formula field → formula expression part", "parameter field → parameter definition part"); the template calling process can be implemented using either Prompt command binding or API call binding to ensure a one-to-one correspondence between the input data and the template fields.
[0079] S230: After the standardized formula calculation document is generated, it supports multiple output formats, which users can choose according to their needs: Markdown format: suitable for direct display and online reading; XML / JSON format: easy for machine parsing and knowledge base storage; Word / PDF format: suitable for archiving or use by engineering personnel.
[0080] During the generation process, the system provides an "output format selection" option on the interface. After the user selects the corresponding format, the document generation module calls different export functions according to the selected format.
[0081] S240: The standardized formula calculation document shall clearly record the symbol definitions, variable meanings, units of measurement, and calculation steps for each formula to ensure consistent expression. For example:
[0082] Formula expression: F = ρgV, parameter definition table (Table 1):
[0083] Parameter Meaning Unit p Liquid density kg / m 3 ]]> g Gravity acceleration m / s 2 ]] V Displacement volume m 3 ]]>
[0084] Calculation steps table (Table 2):
[0085] Step Content 1 Input p = 1000 kg / m 3 , g = 9.8 m / s 2 , V = 2 m 3 ]]> 2 Substitute the formula F = pgV 3 Calculate F = 1000 x 9.8 x 2 = 19600 N
[0086] Unit representation: The unit of the calculation result F is N (Newtons).
[0087] S3. In cases where the formula is incomplete, variables are missing, or conditions are not specified, the formula reverse reasoning module is invoked to automatically complete the missing formula fragments and variable conditions based on the knowledge graph and the reasoning results of the large model, generating a complete formula expression; specifically including the following sub-steps:
[0088] S310: Detect standardized formula calculation documents and determine whether there are incomplete formulas, missing variables, or unexplained conditions.
[0089] The detection methods include: Formula syntax tree integrity verification: by parsing the LaTeX / MathML expression of the formula, checking for situations such as unclosed operators or missing variable nodes.
[0090] Dimensional consistency check: The dimensions on both sides of the formula are compared. If an imbalance is found, the formula is considered to be incomplete. For example, if the formula is F = m, then the left side is [MLT]. -2 (mass × length ÷ time) 2 (corresponding to Newton), the right side is [M] (mass), and the test results show that the dimension of acceleration [LT] is missing. -2 ].
[0091] S320: Within the formula reverse reasoning module, call the knowledge graph query and large language model reasoning to complete the missing terms. The knowledge graph is the "Ship Mechanics Knowledge Graph", which stores common formulas such as buoyancy formulas, resistance formulas, stability equations, etc. and their variable relationships.
[0092] Completion method: Knowledge graph query: If it is detected that F = ρg?, and there is a buoyancy formula F = ρgV in the knowledge graph, then the missing variable is completed as V; Large language model reasoning: When the knowledge graph fails to directly hit, the large model generates the most likely missing term based on the formula context and ship design domain knowledge, and outputs the reasoning basis.
[0093] S330: Complete the reasoning result to the standardized formula calculation document to generate a complete formula expression. The completion methods include: inserting the missing symbol in the formula expression part and updating it to F = ρgV; adding a missing variable entry in the parameter definition table, for example:
[0094] Parameter Meaning Unit V Displacement volume m 3 ]]>
[0095] S340: Mark the completion result, record the reasoning source and logical basis to support subsequent verification. The marking methods include: adding metadata tags in the formula expression, for example:
[0096] <formula id = "F-01" source = "Knowledge Graph" basis = "Archimedes' Law">F = ρgV< / formula>
[0097] Record the completion process in the document metadata, for example:
[0098]
[0099] Example scenario
[0100] Suppose an incomplete formula appears in the design document: F = ρg
[0101] The system detects that the right - hand side dimension is incomplete, lacking the volume dimension; triggers the formula reverse reasoning module, and the knowledge graph returns "buoyancy formula F = ρgV"; the system automatically completes V and adds "V = displacement volume, unit m 3 " in the parameter table. Mark the source of the completion result in the document as "Archimedes' Law".
[0102] To support formula completion and reasoning, this embodiment constructs a "Ship Mechanics Knowledge Graph." Its construction method is as follows: Knowledge Unit Extraction: Common formulas and variable definitions for buoyancy, resistance, stability, and strength are extracted from ship design textbooks, specifications, and standard formula libraries, and transformed into entities and relationships. Graph Structure: Represented in RDF triple form, nodes include formula entities and variable entities (e.g., formula F = ρgV, variables ρ, g, V), and edges represent "formula contains variables" or "variable belongs to formula." Storage Implementation: Storage and querying are based on the Neo4j graph database, supporting formula retrieval and relationship reasoning using the Cypher language. Update Mechanism: When a user adds or modifies a formula, the system adds or replaces nodes in the knowledge graph through the version management module, retaining historical versions and generating log records to ensure the traceability and reliability of the knowledge base.
[0103] S4. Perform cross-modal error correction and physical consistency checks on the generated formula calculation documents. Verify format and numerical consistency using formula recognition and table recognition models. Based on physical dimensional constraints and conservation laws, perform consistency checks on the formula results. If physical logic conflicts are detected, output correction suggestions and automatically update the formula expression. This includes the following sub-steps:
[0104] S410: Perform cross-modal verification on the complete formula expression: The specific method is to extract the formula parameter values from the formula calculation document and compare them with the corresponding cell values output by the table recognition model; if the two values are inconsistent, it is determined to be a cross-modal conflict.
[0105] Example: If the parameter ρ in the formula is 950 kg / m 3 The corresponding cell value in the table is 1000 kg / m³. 3 If the system determines that there is a data inconsistency, it will output the message "The formula parameters do not match the table data".
[0106] To avoid misjudgments caused by the accuracy of actual engineering data collection or rounding during cross-modal verification, the system sets a numerical error tolerance threshold during the comparison of formula parameters and table cell values. If the difference between the formula parameter value and the table cell value does not exceed the preset threshold (e.g., ±1% or ±0.5%), it is considered consistent; if it exceeds the threshold, a warning message is output and manual review is prompted. This threshold can be dynamically configured according to different ship design scenarios to improve the robustness and applicability of the comparison.
[0107] S420: Based on physical dimensional constraints and conservation laws, perform a physical consistency check on the formula results. Dimensional constraint method: Calculate the physical dimensions on both sides of the formula; if they are not equal, it is determined to be missing or incorrect. For example:
[0108] [F] = MLT-2 , [ma] = MLT -2
[0109] If the formula is F = m, the dimension of the right - hand side is [M], which is not equal to the left - hand side [MLT -2 , indicating that the dimension of acceleration [LT -2 is missing. Method for verifying conservation laws: Verify according to the common physical laws in the ship domain. For example: In buoyancy calculation, the mass conservation relationship ρV = m must be satisfied
[0110] where ρ is the liquid density, V is the displacement volume, and m is the hull mass. If the formula does not satisfy this relationship with the input conditions, it is determined as a physical conflict
[0111] [[ID=12 ".
[0122] Document tag (S440): The updated formula is written to the knowledge base and marked with a "verified" status to ensure the correctness of subsequent calls.
[0123] The process of cross-modal verification and formula completion involves setting numerical error thresholds and confidence thresholds.
[0124] Numerical error threshold: In this embodiment, the comparison threshold between formula parameters and table values is set to ±1%. This value is derived from the common error range (usually between 0.5% and 1.5%) in the measurement of material density and displacement volume in ship design. Therefore, the ±1% threshold can cover the mainstream design accuracy requirements and avoid misjudgments caused by rounding.
[0125] Confidence threshold: During formula completion, the large language model outputs several candidate results and assigns a confidence score to each candidate. This invention uses 10-fold cross-validation experiments to statistically analyze the completion accuracy at different thresholds. The results show that when the confidence level is ≥0.8, the completion accuracy remains above 92%. Therefore, the system sets the completion acceptance threshold to 0.8 to balance accuracy and coverage.
[0126] Dynamic adjustment: The system allows the threshold to be dynamically modified according to different application scenarios. For example, it can be reduced to ±0.5% in hull strength calculation and relaxed to ±2% in preliminary scheme evaluation.
[0127] S5. Based on the verified formula calculation document, automatically generate executable calculation code and store it along with variable dependencies in the formula calculation knowledge base; specifically including the following sub-steps:
[0128] S510: Based on the verified formula calculation document, call the code generation module to automatically generate the corresponding executable calculation code.
[0129] The generation rule is: convert the formula expression into a function form, and map the formula symbols to function parameters.
[0130] The target language can be Python. Example: When the formula is F = ma, the generated code is:
[0131] Python
[0132] def calc_F(m,a):
[0133] return m*a
[0134] If the formula is F = ρgV, then the following is generated:
[0135] Python
[0136] def calc_F(rho, g, V):
[0137] return rho*g*V
[0138] S520: When generating the calculation code, the dependencies between variables in the formula are extracted to form a variable dependency graph. The dependencies are represented by a directed acyclic graph (DAG), where nodes are variables and edges represent variable dependencies.
[0139] Example: The dependency of the formula F = ma is expressed as:
[0140] {"F":["m","a"],"m":[],"a":[]}
[0141] If the formula contains nesting, for example, P = F / A and F = ma, then the dependency graph is as follows:
[0142] {"P":["F","A"],"F":["m","a"],"m":[],"a":[],"A":[]}.
[0143] S530: Store the calculation code and the variable dependency graph in a formula calculation knowledge base. The knowledge base uses a document database (such as MongoDB) storage structure, and each record contains the formula expression, corresponding code, and variable dependencies.
[0144] Example storage structure:
[0145]
[0146] S540: During storage, an indexing mechanism is established to support subsequent fast retrieval. Indexing methods include: Formula expression index: a hash index based on formula strings (e.g., F = ma); Variable name index: an inverted index based on variables (e.g., F, m, a).
[0147] S550 (Knowledge Base Update Mechanism): When a user uploads a new formula or a revised formula, the system updates the knowledge base.
[0148] The update strategies include: Add a new record if the same formula number does not exist in the knowledge base; Overwrite a record if the same formula number exists and the content is identical, overwriting is allowed; Version control a record if the same formula number exists but the content is different, add a new record and upgrade the version number.
[0149] Example: When F = ma is corrected to F = ρgV, the system stores it as:
[0150]
[0151] During the knowledge base update process, to address situations where formulas with the same number but conflicting content exist, the system employs the following conflict resolution strategies: Coexistence Mode: Different versions of formula records are allowed to coexist, distinguished by version number; Overwrite Mode: If a new formula is confirmed by the verification module to be superior or more consistent with physical laws, the old version is directly overwritten; Manual Intervention Mode: When both the old and new formulas are valid, the system submits the conflict flag for manual confirmation, allowing experts to choose whether to retain or merge the formulas. These conflict resolution strategies ensure that the knowledge base maintains both flexibility and data consistency and reliability during automatic updates.
[0152] S560 (Logs and Traceability Mechanism): When the knowledge base is updated, the system generates logs to support traceability. Log fields include: operation type (add / modify / delete), timestamp, operator ID, content before update, and content after update. Example:
[0153]
[0154] The system supports formula rollback and version comparison based on logs to ensure the consistency and traceability of the knowledge base.
[0155] S6. When a user inputs a natural language computation request, the intelligent agent retrieves the knowledge base based on the user input, parses the variable values, calls the corresponding computation code, and outputs the final computation result; specifically including the following sub-steps:
[0156] S610: When a user inputs a natural language calculation request, the intelligent agent receives the input request. Input formats include: imperative (e.g., "Calculate ship buoyancy"), interrogative (e.g., "Can this ship float?"), and parameterized (e.g., "When ρ = 1000 kg / m³...") requests. 3 V = 2m 3 Calculate F” at the time.
[0157] S620: The intelligent agent parses the input request based on the semantic parsing module and extracts the target formula and variable values.
[0158] Semantic parsing process: Natural language is segmented and part-of-speech tagging is performed; physical quantities (such as "density," "volume," and "buoyancy") are identified using a domain dictionary and regular rules; the identification results are mapped to formula variables (such as "density" → ρ, "volume" → V). Example: Input "When ρ = 1000 kg / m³ 3 V = 2m 3 "Calculate buoyancy" → Analysis: {Formula: "F=ρgV", Variable: {"ρ":1000,"V":2,"g":9.8}}.
[0159] S630: The intelligent agent retrieves the formula calculation knowledge base and locates the calculation code that matches the request. Retrieval method: First, match formula keywords (e.g., "buoyancy" → F = ρgV); then match variable symbols to ensure the formula matches the input variables. Example: Find the formula F = ρgV based on the keyword "buoyancy" and extract the stored executable Python code.
[0160] S640: Call the calculation code and perform the calculation according to the variable value.
[0161] Execution process: Bind the parsed variable values to the function input parameters; call the Python code to run the calculation; convert the calculation results into structured output.
[0162] Example:
[0163] result = calc_F(1000, 9.8, 2) # Output: 19600
[0164] S650: Output the calculation results to the user and generate an explanatory result that includes the formula reasoning process and calculation basis.
[0165] Output format:
[0166] Numerical result: Direct output F = 19600 N; Formula reasoning process: Showing the substitution steps: F = ρgV = 1000 × 9.8 × 2 = 19600; Physical explanation: The calculation is based on "Archimedes' principle", and the result shows that "the ship is subjected to a buoyant force of 19600 Newtons".
[0167] Example: User input:
[0168] Please calculate the displacement volume of the ship when it is 2m³. 3 The density of water is 1000 kg / m³. 3 Buoyancy at that time.
[0169] System execution flow:
[0170] Semantic parsing (S620): Recognition parameters: ρ = 1000, V = 2, matching formula F = ρgV;
[0171] Knowledge base retrieval (S630): Returns the stored Python function calc_F(rho,g,V);
[0172] Code execution (S640): Calling function calc_F(1000,9.8,2) → outputting 19600;
[0173] Output (S650): Returns numerical value + reasoning steps + physical explanation.
[0174] The end user sees:
[0175] Calculation result: F = 19600 N
[0176] Calculation steps: F = ρgV = 1000 × 9.8 × 2 = 19600
[0177] Basis: Archimedes' principle.
[0178] The above formulas are all dimensionless calculations. The formulas are derived from software simulations based on a large amount of collected data to obtain the most recent real-world results. The preset parameters and thresholds in the formulas are set by those skilled in the art according to the actual situation.
[0179] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more sets of available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium. A semiconductor medium can be a solid-state drive.
[0180] Those skilled in the art will recognize that the modules and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0181] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and modules described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0182] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.
[0183] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0184] In addition, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module.
[0185] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0186] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0187] In conclusion, the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for intelligent calculation of complex formulas in the field of shipbuilding, characterized in that, Includes the following steps: S1. Obtain complex formula calculation files from ship design documents, perform multimodal parsing on the files, extract text, images, formulas and table information, and convert them into structured data; S2. Based on the structured data, a large language model is used to fill the preset standardized formula calculation document template to generate a standardized formula calculation document containing formula expression, parameter definition, calculation steps and unit representation. S3. In the event of an incomplete formula, missing variables, or unspecified conditions, the formula reverse reasoning module is invoked to automatically complete the missing formula fragments and variable conditions based on the knowledge graph and the reasoning results of the large model, thereby generating a complete formula expression. S4. Perform cross-modal error correction and physical consistency verification on the generated formula calculation documents, and check the format and numerical consistency through the formula recognition model and table recognition model. Based on physical dimension constraints and conservation laws, the consistency of the formula results is checked. If a physical logic conflict is detected, a correction suggestion is output and the formula expression is automatically updated. S5. Based on the verified formula calculation document, automatically generate executable calculation code and store it along with variable dependencies in the formula calculation knowledge base.
2. The intelligent calculation method for complex formulas in the shipbuilding field according to claim 1, characterized in that, It also includes S6, where, when a user inputs a natural language computation request, the intelligent agent retrieves the knowledge base based on the user input, parses the variable values, calls the corresponding computation code, and outputs the final computation result.
3. The intelligent calculation method for complex formulas in the shipbuilding field according to claim 1, characterized in that, S1 specifically refers to: Collect ship design documents, which include design specifications, design drawings, and supplementary calculation files; The ship design documents are subjected to file format recognition to identify the text, image, formula, and table information areas. The information region is parsed one by one using a multimodal parsing module to obtain text content, image objects, formula expressions, and tabular data; The parsing results are transformed into unified structured data, which includes text data, image feature data, formula symbol data, and table cell data.
4. The intelligent calculation method for complex formulas in the shipbuilding field according to claim 1, characterized in that, S2 specifically refers to: Receive the structured data and input the structured data into the large language model; Within the large language model, a pre-defined standardized formula calculation document template is invoked. The template includes a formula expression section, a parameter definition section, a calculation step section, and a unit representation section. Based on the template and the structured data, a standardized formula calculation document is generated; The document should clearly define the symbols, meanings of variables, units of measurement, and calculation steps for each formula to ensure consistent formula expression.
5. The intelligent calculation method for complex formulas in the shipbuilding field according to claim 1, characterized in that, S3 specifically refers to: If the standardized formula calculation document is checked and there are cases where the formula is incomplete, variables are missing, or conditions are not explained, the formula reverse reasoning module is triggered. Within the formula reverse reasoning module, knowledge graph queries and large language model reasoning are invoked to deduce missing formula fragments and variable conditions. The reasoning results are then added to the standardized formula calculation document to form a complete formula expression. The completed results are marked, and the reasoning source and logical basis are recorded to support subsequent verification.
6. The intelligent calculation method for complex formulas in the shipbuilding field according to claim 1, characterized in that, S4 specifically refers to: The complete formula expression is subjected to cross-modal verification by calling the formula recognition model and the table recognition model to check the consistency of document format and numerical values. Based on physical dimensional constraints and conservation laws, the physical consistency of the formula results is checked to determine whether there are any logical conflicts. If a physical logic conflict is detected, a correction suggestion is output, and the formula expression is automatically updated in the standardized formula calculation document; The verified formula calculation documents are marked as verified and proceed to the next processing stage.
7. The intelligent calculation method for complex formulas in the shipbuilding field according to claim 1, characterized in that, S5 specifically refers to: Based on the verified formula calculation document, the code generation module is invoked to automatically generate the corresponding executable calculation code; When generating the calculation code, the dependencies between the variables in the formula are extracted to form a variable dependency graph; Store the calculation code and the variable dependency graph in the formula calculation knowledge base; During storage, an indexing mechanism is established to support rapid retrieval by formula expression or variable name.
8. The intelligent calculation method for complex formulas in the shipbuilding field according to claim 2, characterized in that, S6 specifically refers to: When a user inputs a natural language computation request, the intelligent agent receives the input request; The intelligent agent performs semantic parsing on the input request based on the semantic parsing module, and extracts the target formula and variable values in the request; The intelligent agent retrieves the formula calculation knowledge base and locates the calculation code that matches the request; The calculation code is invoked, and the calculation is performed based on the value of the variable; The calculation results are output to the user, generating an explanatory result that includes the formula reasoning process and calculation basis.
9. The intelligent calculation method for complex formulas in the shipbuilding field according to claim 5, characterized in that, When generating the completion result, the formula reverse reasoning module calculates the confidence score based on the candidate results output by the large language model. The completion result is only accepted when the score is greater than a preset threshold. The module also performs a secondary screening by combining physical dimension verification and conservation laws to ensure the reliability of the completed formula.
10. The intelligent calculation method for complex formulas in the shipbuilding field according to claim 8, characterized in that, The intelligent agent supports multiple output formats when outputting calculation results, including JSON, Markdown, or PDF formats.
Citation Information
Cited By
Handwritten formula image recognition method based on rule injection and related device
CN121768005A
Numerical extraction, semantic completion and evidence constraint generation method for financial documents
CN122472053A