A flowchart layout optimization method, device, equipment, medium and product
By quantifying the layout of chemical process flow diagram controls and combining iterative optimization with the annealing algorithm, the problem of unreasonable control layout in chemical simulation process flow diagrams was solved, achieving automated optimization and improving layout efficiency and readability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HANGZHOU DIANZI UNIV
- Filing Date
- 2026-02-11
- Publication Date
- 2026-05-29
AI Technical Summary
Existing methods for layouting control components in chemical simulation flowcharts mainly rely on manual or simple automatic layout algorithms, resulting in unreasonable layouts, overlapping controls, and chaotic intersecting connection lines, which affect the readability of the flowcharts and the efficiency of simulation calculations.
The layout of controls is automatically optimized by using quantitative control layout and combining iterative optimization with annealing algorithm. This is achieved by adjusting the flowchart, traversing attribute information, and calculating penalty values until the termination condition is met.
It improves the efficiency and quality of flowchart layout, avoids overlapping controls and intersecting connecting lines, and makes it easier for users to understand chemical process flowcharts.
Smart Images

Figure CN121685696B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electronic design automation technology, and in particular to a flowchart layout optimization method, apparatus, device, medium, and product. Background Technology
[0002] In chemical engineering simulations, flowcharts are crucial tools for visually representing chemical processes. They contain numerous controls, such as equipment icons, pipe symbols, and parameter display boxes. The logical layout of these controls directly impacts the readability, usability, and subsequent simulation efficiency of the flowchart.
[0003] Currently, the layout of controls in chemical simulation flowcharts mainly relies on manual layout or simple automatic layout algorithms. However, manual layout is time-consuming and labor-intensive, and is greatly affected by human factors, making it difficult to guarantee optimal layout. Simple automatic layout algorithms often only consider the positional relationship between controls, ignoring the inherent logic of the chemical process and the differences in the importance of controls, resulting in unsatisfactory layout effects. Problems such as overlapping controls and chaotic connecting lines frequently occur, causing great inconvenience to users in understanding and using flowcharts.
[0004] Therefore, there is an urgent need for a flowchart layout optimization method that can automatically perform global optimization of flowchart layout in order to solve the problems of existing layout methods and improve layout quality. Summary of the Invention
[0005] This invention provides a flowchart layout optimization method, apparatus, equipment, medium, and product, which solves the problem of how to automatically optimize the layout of chemical process flowchart controls. By quantifying the control layout and combining iterative optimization with an annealing algorithm, the automatic optimization of the flowchart control layout is achieved, improving layout efficiency, avoiding problems such as control overlap and chaotic connecting lines, facilitating user understanding, and further improving the layout quality of the flowchart.
[0006] According to one aspect of the present invention, a flowchart layout optimization method is provided, comprising:
[0007] The current flowchart for the current round is obtained by adjusting the baseline flowchart of the previous round.
[0008] The current flowchart is traversed to obtain the current attribute information; the current attribute information includes control attribute information, connection line attribute information, and logical relationships between controls.
[0009] The current flowchart penalty value is obtained based on the current attribute information and the flowchart penalty rules.
[0010] Obtain the baseline flowchart penalty value of the previous round's baseline flowchart;
[0011] Based on the current flowchart penalty value and the baseline flowchart penalty value, the baseline flowchart for the next round is determined from the current flowchart and the baseline flowchart of the previous round, until the termination condition of the annealing algorithm iteration is met, and the target flowchart is obtained; the termination condition is that the current temperature of the current round reaches the termination temperature.
[0012] According to another aspect of the present invention, a flowchart layout optimization apparatus is provided, comprising:
[0013] The adjustment module is used to adjust the baseline flowchart of the previous round to obtain the current flowchart of the current round;
[0014] The attribute information acquisition module is used to traverse the current flowchart to obtain the current attribute information; the current attribute information includes control attribute information, connection line attribute information, and logical relationships between controls.
[0015] The current flowchart penalty value determination module is used to obtain the current flowchart penalty value based on the current attribute information and the flowchart penalty rules.
[0016] The baseline flowchart penalty value acquisition module is used to acquire the baseline flowchart penalty value of the previous round's baseline flowchart;
[0017] An iterative module is used to determine the benchmark flowchart for the next round from the current flowchart and the benchmark flowchart of the previous round, based on the current flowchart penalty value and the benchmark flowchart penalty value, until the termination condition of the annealing algorithm iteration is met, and the target flowchart is obtained; the termination condition is that the current temperature of the current round reaches the termination temperature.
[0018] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0019] At least one processor; and
[0020] A memory communicatively connected to the at least one processor; wherein,
[0021] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the flowchart layout optimization method according to any embodiment of the present invention.
[0022] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the flowchart layout optimization method described in any embodiment of the present invention.
[0023] According to another aspect of the present invention, a computer program product is provided, the computer program product comprising a computer program that, when executed by a processor, implements the flowchart layout optimization method according to any embodiment of the present invention.
[0024] The technical solution of this invention solves the problem of how to automatically optimize the layout of chemical process flow diagram controls by quantifying the control layout and combining iterative optimization with the annealing algorithm. It achieves automatic optimization of the layout of flow diagram controls, improves layout efficiency, avoids problems such as control overlap and chaotic connecting lines, facilitates user understanding, and further improves the layout quality of the flow diagram.
[0025] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0026] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0027] Figure 1 This is a flowchart of a flowchart layout optimization method provided by an embodiment of the present invention;
[0028] Figure 2 This is a flowchart of a current attribute information acquisition method provided by an embodiment of the present invention;
[0029] Figure 3 This is a flowchart of a flowchart layout optimization method provided by an embodiment of the present invention;
[0030] Figure 4 This is a schematic diagram of a flowchart layout optimization device provided according to an embodiment of the present invention;
[0031] Figure 5 This is a schematic diagram of the structure of an electronic device that implements the flowchart layout optimization method of the present invention. Detailed Implementation
[0032] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0033] It should be noted that the terms "comprising" and "having" and any variations thereof in the specification, claims and accompanying drawings of this invention are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such process, method, product or device.
[0034] Furthermore, it should be noted that the information collected in the technical solution of this invention is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of related data all comply with the relevant laws, regulations and standards of relevant countries and regions, necessary confidentiality measures have been taken, and public order and good morals are not violated. Corresponding operation entry points are provided for users to choose to authorize or refuse.
[0035] Figure 1 This invention provides a flowchart layout optimization method according to an embodiment of the present invention. This embodiment is applicable to situations requiring flowchart layout optimization, particularly for optimizing the layout of controls in chemical engineering simulation flowcharts. The method can be executed by a flowchart layout optimization device, which can be implemented in hardware and / or software and can be configured in a server. Figure 1 As shown, the method includes:
[0036] S110. Adjust the baseline flowchart of the previous round to obtain the current flowchart of the current round.
[0037] The baseline flowchart of the previous round is the flowchart of the optimization method confirmed in the previous round during the iteration process; if the current round is the third round, the baseline flowchart of the previous round is the flowchart of the optimization method confirmed in the second round; if the current round is the first round, the baseline flowchart of the previous round is the initial flowchart; adjustments can be made through flowchart adjustment strategies, such as randomly selecting one control element in the flowchart and moving it within a 50-pixel range around its current position, or randomly selecting any two controls in the flowchart and swapping their positions; the current flowchart is the flowchart obtained by adjusting the baseline flowchart of the previous round; the flowchart can be a chemical process flowchart in a chemical simulation scenario.
[0038] Specifically, the flowchart of the previously confirmed optimization method is obtained during the iteration process, and the positions of control elements in the baseline flowchart are adjusted according to the flowchart adjustment strategy. The adjusted flowchart is used as the current flowchart of the current round. For example, if the current coordinates of a pump control element are (300, 400), its position is adjusted, and the new coordinates are randomly generated in the range of (250-350, 350-450); or the positions of a valve control and a parameter display box are swapped. It should be noted that the adjustment strategy in the embodiments of the present invention can be randomly selected, can be all position adjustments or position swaps, or the adjustment strategy can be changed in turn. Relevant technicians can set the adjustment strategy according to actual needs, and the embodiments of the present invention do not specifically limit this.
[0039] S120. Traverse the current flowchart to obtain the current attribute information; the current attribute information includes control attribute information, connection line attribute information, and logical relationships between controls.
[0040] Among them, control attribute information refers to the attribute information of control elements, which may include the size information of control elements, etc.; connector attribute information refers to the attribute information of connector elements, which is the length information of connectors; and logical relationship between controls refers to the connection relationship between controls.
[0041] Specifically, the current flowchart is traversed to obtain the attribute information of control elements, the attributes of connecting line elements, and the logical relationships between controls.
[0042] In one optional embodiment of the present invention, after obtaining the current attribute information, the current attribute information is preprocessed to remove duplicate records and ensure that the data format is consistent; for example, duplicate pipe connection relationships are deleted; thereby improving the efficiency of subsequent processing of the current attribute information.
[0043] Optional, such as Figure 2 The method shown here for obtaining current attribute information involves traversing the current flowchart to obtain the current attribute information, including:
[0044] S121. Traverse the current flowchart to obtain control elements and connecting line elements.
[0045] Among them, control elements can be equipment controls such as reactors, pumps and valves, pipe connection controls and parameter display controls; connection line elements are the connection lines in the flowchart.
[0046] Specifically, by traversing the current flowchart, control elements and connecting line elements can be obtained. For example, by traversing the simulated flowchart of a chemical production process, the control elements and connecting line elements contained therein can be obtained. Control elements include equipment controls such as reactors, pumps and valves, pipeline connection controls, and parameter display controls such as temperature and pressure display boxes.
[0047] S122. Based on the size information of the current flowchart and preset rules, determine the control attribute information of the control elements.
[0048] The current flowchart's size information can be the current flowchart's dimensions; the control's attribute information can be the control element's spatial dimensions, position coordinates, logical relationships, and control type.
[0049] Specifically, based on the size information of the current flowchart, the control attribute information corresponding to each control element can be obtained, which can include the spatial size, position coordinates, logical relationship and control type of the control element.
[0050] Optionally, based on the current flowchart's size information and preset rules, determine the control attribute information of the control elements, including:
[0051] Determine the coordinate position of the control element based on the size information of the current flowchart;
[0052] The control size information is determined based on its coordinate position; the control size information includes the length and width information of the control element.
[0053] The control type of a control element is determined based on preset rules; the control type includes important, relatively important, or general.
[0054] The initial coordinate information of the control element is determined from its coordinate position based on a preset strategy;
[0055] Use the control's size information, control type, and initial coordinate information as the control's property information.
[0056] The coordinates of the control element are the coordinates of the points where each edge of the control element connects; the length of the control element is the length of the control; the width of the control element is the width of the control; the default rule is to classify the control elements into levels based on the control type; the initial coordinate information is used to indicate the coordinate position of the control element.
[0057] Specifically, the coordinate positions of each control element are determined based on the current flowchart's size information, and all position coordinates are uniformly converted to a Cartesian coordinate system with the top-left corner of the flowchart as the origin. The length and width information of the control elements are determined according to their coordinate positions; for example, a reactor control is 80×60 pixels, and a parameter display box is 40×30 pixels. Control elements are categorized into levels based on preset rules, such as: important controls like the core reactor and main feed pump; relatively important controls like auxiliary valves and branch pipes; and general controls like regular parameter display boxes. The top-left corner coordinate position of each control element is used as its initial coordinate information according to a preset strategy, and the control size, control type, and initial coordinate information are used as the control attribute information.
[0058] Understandably, the control attribute information is confirmed based on preset rules and strategies, and the type, size, position and importance level of the chemical process flow diagram controls are customized. Data standardization is achieved through redundancy elimination and a unified rectangular coordinate system. By introducing control importance levels, the layout scheme is ensured to better meet the actual needs of chemical simulation.
[0059] S123. Determine the logical relationship between controls based on control elements and connecting line elements.
[0060] Specifically, based on the control elements and connecting line elements, we can sort out the logical connections between controls, such as which control elements are connected and the connection relationships between control elements.
[0061] Understandably, by setting the connection relationships between controls—a factor unique to chemical processes—the layout scheme is made to better meet the actual needs of chemical simulation, avoiding situations where the inherent logic of the chemical process is ignored, resulting in unsatisfactory layout effects and problems such as overlapping controls and chaotic connecting lines.
[0062] S124. Determine the connection line attribute information based on the control attribute information and the logical relationship between controls; the connection line attribute information is the length information of the connection line element.
[0063] Specifically, based on the connection relationship between controls, two connected control elements are found, and the interval length between the two connected control elements is determined according to the control size information and initial coordinate information in the control attribute information of the connected control elements. This interval length is used as the length information of the connecting line element, that is, the connecting line attribute information.
[0064] S130. Obtain the current flowchart penalty value based on the current attribute information and flowchart penalty rules.
[0065] Among them, the flowchart penalty rule is the penalty rule for the construction of the flowchart. It is a penalty rule for the evaluation indicators of the flowchart. The evaluation indicators can be control spacing, connector length and intersection, and importance layout. The current flowchart penalty value is the penalty value calculated based on the flowchart penalty rule.
[0066] Specifically, based on the evaluation indicators in the flowchart penalty rules, the current flowchart penalty value is obtained by quantifying the control attribute information, connector attribute information, logical relationship between controls, control spacing, connector length and intersection, and importance layout in the current attribute information and the evaluation indicators.
[0067] S140. Obtain the baseline flowchart penalty value of the previous round's baseline flowchart.
[0068] The baseline flowchart penalty value is obtained from the baseline attribute information and flowchart penalty rules of the baseline flowchart.
[0069] Specifically, obtain the baseline flowchart penalty value determined in the previous round based on the baseline attribute information and flowchart penalty rules.
[0070] S150. Based on the current flowchart penalty value and the baseline flowchart penalty value, determine the baseline flowchart for the next round from the current flowchart and the baseline flowchart of the previous round, until the termination condition of the annealing algorithm iteration is met, and obtain the target flowchart; the termination condition is that the current temperature of the current round reaches the termination temperature.
[0071] The parameters for the annealing algorithm can be set as follows: initial temperature 1000, cooling coefficient 0.9, and termination temperature 1. The annealing algorithm iterates by multiplying the current temperature by 0.9. For example, if the initial temperature is 1000, the current temperature becomes 900 after 100 iterations and 81 after 200 iterations. The termination condition for the annealing algorithm iteration is that the current temperature drops to the termination temperature of 1. The target flowchart is the baseline flowchart for this round when the termination condition of the annealing algorithm iteration is met. The current temperature is the temperature of the current round.
[0072] Specifically, the penalty value of the current flowchart is compared with the penalty value of the baseline flowchart. The baseline flowchart for the next round is determined from the current flowchart and the baseline flowchart of the previous round. An iterative process is executed based on the annealing algorithm parameters until the current temperature of a certain round meets the termination temperature of the annealing algorithm iteration. The baseline flowchart of that round is then output as the target flowchart. It should be noted that the annealing algorithm parameters and the termination condition of the annealing algorithm iteration can be adjusted according to actual needs. This embodiment of the invention does not impose specific limitations on this.
[0073] Understandably, transforming layout requirements into quantifiable functions and deeply integrating them with annealing algorithm parameters enables automated layout optimization of chemical process flow diagram controls, solving the problems of low efficiency and neglect of the characteristics of chemical scenarios in traditional methods.
[0074] Optionally, based on the current flowchart penalty value and the baseline flowchart penalty value, a baseline flowchart for the next round is determined from the current flowchart and the baseline flowchart of the previous round, including:
[0075] Compare the baseline flowchart penalty value with the current flowchart penalty value; if the current flowchart penalty value is less than the baseline flowchart penalty value, then the current flowchart will be used as the baseline flowchart for the next round.
[0076] If the current flowchart penalty value is greater than the baseline flowchart penalty value, then the adjustment probability is calculated based on the current flowchart penalty value and the baseline flowchart penalty value.
[0077] The adjustment probability is compared with a randomly generated random number; if the random number is less than the adjustment probability, the current flowchart is used as the baseline flowchart for the next round.
[0078] The adjustment probability is a probability value calculated using a probability formula; the random number is a randomly generated value between 0 and 1.
[0079] Specifically, the penalty value of the baseline flowchart is compared with the penalty value of the current flowchart. If the penalty value of the current flowchart is less than the penalty value of the baseline flowchart, the current flowchart is used as the baseline flowchart for the next round. If the penalty value of the current flowchart is greater than the penalty value of the baseline flowchart, the adjustment probability is calculated using a probability formula based on the penalty values of the current flowchart and the baseline flowchart. A random number between 0 and 1 is generated. The adjustment probability is compared with the randomly generated random number. If the random number is less than the adjustment probability, the current flowchart is used as the baseline flowchart for the next round.
[0080] The probability formula is as follows:
[0081]
[0082] in, The value is the difference between the current flowchart penalty value and the baseline flowchart penalty value; T is the current temperature.
[0083] Understandably, by introducing an iterative annealing algorithm, the layout requirements are transformed into a quantifiable function. The global exploration and local development are balanced through controllable randomness. Furthermore, the parameters of the annealing algorithm can be adjusted according to actual needs, adapting to the layout optimization requirements of chemical simulation flowchart controls of different types and complexities. This achieves automatic optimization of control layout, reduces manual intervention, and improves layout efficiency.
[0084] This invention provides an embodiment of the process for obtaining the current flowchart by adjusting the baseline flowchart from the previous round; traversing the current flowchart to obtain current attribute information; obtaining the current flowchart penalty value based on the current attribute information and flowchart penalty rules; acquiring the baseline flowchart penalty value from the previous round; and determining the baseline flowchart for the next round based on the current flowchart penalty value and the baseline flowchart penalty value, until the termination condition of the annealing algorithm iteration is met, thus obtaining the target flowchart. The termination condition is that the current temperature of the current round reaches the termination temperature. This technical solution addresses the automatic optimization of the layout of chemical process flowchart controls. By quantifying the control layout and combining iterative optimization with the annealing algorithm, it avoids problems such as control overlap and chaotic connecting lines, facilitating user understanding and further improving the layout quality of the flowchart.
[0085] Figure 3 This is a flowchart of a flowchart layout optimization method provided by an embodiment of the present invention. Based on the above embodiments, the flowchart penalty rules include spacing penalty rules, connector penalty rules, and region penalty rules; the method for determining the current flowchart penalty value is supplemented. It should be noted that for parts not detailed in this embodiment, please refer to the relevant descriptions in other embodiments, such as... Figure 3 As shown, the method includes:
[0086] S210. Adjust the baseline flowchart of the previous round to obtain the current flowchart of the current round.
[0087] S220. Traverse the current flowchart to obtain the current attribute information; the current attribute information includes control attribute information, connection line attribute information, and logical relationships between controls.
[0088] S230. Determine the spacing penalty value based on the control attribute information and spacing penalty rules in the current attribute information.
[0089] Among them, the spacing penalty rule is the penalty rule corresponding to the control spacing evaluation index, that is, the minimum distance threshold between controls is set to 20 pixels; the spacing penalty value is the penalty value of the control spacing evaluation index corresponding to the control element.
[0090] Specifically, the control spacing evaluation index is determined based on the control attribute information and spacing penalty rules in the current attribute information.
[0091] Optionally, the spacing penalty value is determined based on the control attribute information and spacing penalty rules in the current attribute information, including:
[0092] The spacing between controls is determined based on the initial coordinate and size information in the control's property information;
[0093] The spacing penalty value is determined based on the control spacing and spacing penalty rules.
[0094] Among them, control spacing refers to the distance information between control elements.
[0095] Specifically, the spacing between two control elements is determined based on the initial coordinate and size information in the control properties. The spacing penalty value is determined based on the control spacing and the spacing penalty rule. For example, the spacing penalty rule sets the minimum distance threshold between controls to 20 pixels. When the actual distance between controls is less than 20 pixels, the penalty value increases by 1 for every 1 pixel decrease. If the control spacing is 18 pixels, then according to the spacing penalty rule, its spacing penalty value is 2.
[0096] S240. Determine the connection penalty value based on the connection attribute information and connection penalty rules in the current attribute information.
[0097] The connector penalty rule is to judge the length information of the connector element. For every 10 pixels increase in length, the penalty value increases by 1. For every connector intersection, the penalty value increases by 5. The connector penalty value is the penalty value corresponding to the connector evaluation index between the connector elements.
[0098] Specifically, based on the length information of the connecting line and the layout of the connecting line element, the connecting line penalty value is determined according to the connecting line penalty rules. For example, if the length information of the connecting line increases by 50 pixels, the connecting line penalty value is 5; for every 3 times the connecting line crosses, the penalty value is 15, that is, the connecting line penalty value corresponding to the connecting line element is 20.
[0099] S250. Determine the area penalty value based on the control attribute information, logical relationships between controls, and area penalty rules in the current attribute information.
[0100] Among them, the area penalty rule is to judge whether the control element exceeds the important area; the area penalty value is the penalty value corresponding to the importance layout evaluation index of the control element.
[0101] Specifically, based on the control attribute information of the control element and the important area set in the area penalty rule, it is determined whether the control element exceeds the preset important area. If it does, the corresponding area penalty value is determined based on the area penalty rule.
[0102] Optionally, the area penalty value is determined based on the control attribute information in the current attribute information, the logical relationship between controls, and the area penalty rules, including:
[0103] Based on the preset important area in the area penalty rules and the control coordinate information of the control attribute information, it is determined whether the control element exceeds the preset important area;
[0104] If the control exceeds the preset important area, the area penalty value is determined based on the control type, control coordinate information, and area penalty rules.
[0105] Among them, the preset important area is the set significant area, that is, the center point area in the flowchart.
[0106] Specifically, a preset important region is determined in the region penalty rules. Based on the control coordinate information of the control attribute information, it is determined whether the control element exceeds the preset important region. If the control element exceeds the preset important region, the region penalty value is determined based on the penalty strategy corresponding to different control types in the region penalty rules, and the control coordinate information of the control element. For example, if the 50×50 pixel range at the center of the flowchart is set as the preset important region, it is first determined whether the control element exceeds the preset important region based on the control coordinate information. If it does, the control type of the control element is further determined. If the control type of the control element is important, the penalty value increases by 2 for every 10 pixels that the control element deviates from the preset important region. If the control type of the control element is relatively important, the penalty value increases by 1 for every 10 pixels that the control element deviates from the preset important region. If the control type of the control element is general, no penalty value is generated for the control element deviating from the region.
[0107] Understandably, by classifying the control types of control elements according to their importance levels, and further determining their corresponding penalty values, the layout scheme can better meet the actual needs of chemical engineering simulation, support dynamic weight adjustment, and align with chemical engineering logic.
[0108] S260. Based on preset weights, the spacing penalty value, the connector penalty value, and the region penalty value are weighted and aggregated to obtain the current flowchart penalty value.
[0109] The preset weights are the weight coefficients corresponding to different evaluation indicators in the flowchart penalty rules.
[0110] Specifically, the spacing penalty value, connector penalty value, and region penalty value are weighted and aggregated based on preset weights to obtain the current flowchart penalty value. It should be noted that the preset weights in this embodiment can be set according to the layout requirements of the chemical process flow diagram, and this embodiment does not impose specific limitations on them.
[0111] S270. Obtain the baseline flowchart penalty value of the previous round's baseline flowchart.
[0112] S280. Based on the current flowchart penalty value and the baseline flowchart penalty value, determine the baseline flowchart for the next round from the current flowchart and the baseline flowchart of the previous round, until the termination condition of the annealing algorithm iteration is met, and obtain the target flowchart; the termination condition is that the current temperature of the current round reaches the termination temperature.
[0113] This invention transforms flowchart layout requirements into quantifiable functions. Based on three key indicators—control spacing, connecting lines, and importance layout—it supports dynamic weight adjustment, aligns with chemical engineering logic, and deeply integrates the annealing algorithm with control layout constraints. This achieves automated layout optimization of chemical engineering flowchart controls, solving the problems of low efficiency and neglect of chemical characteristics in traditional methods, and making the layout scheme more in line with the actual needs of chemical engineering simulation.
[0114] Figure 4 This is a schematic diagram of a flowchart layout optimization device provided in an embodiment of the present invention. This embodiment is applicable to situations requiring flowchart layout optimization, particularly for optimizing the layout of controls in chemical engineering simulation flowcharts. The flowchart layout optimization device can be implemented in hardware and / or software and can be configured in a server. Figure 4 As shown, the flowchart layout optimization device 300 includes an adjustment module 310, an attribute information acquisition module 320, a current flowchart penalty value determination module 330, a baseline flowchart penalty value acquisition module 340, and an iteration module 350.
[0115] The adjustment module 310 is used to adjust the baseline flowchart of the previous round to obtain the current flowchart of the current round.
[0116] The attribute information acquisition module 320 is used to traverse the current flowchart and obtain the current attribute information; the current attribute information includes control attribute information, connection line attribute information and logical relationships between controls;
[0117] The current flowchart penalty value determination module 330 is used to obtain the current flowchart penalty value based on the current attribute information and the flowchart penalty rules.
[0118] The baseline flowchart penalty value acquisition module 340 is used to acquire the baseline flowchart penalty value of the previous round of baseline flowchart.
[0119] The iteration module 350 is used to determine the benchmark flowchart for the next round based on the current flowchart penalty value and the benchmark flowchart penalty value, until the termination condition of the annealing algorithm iteration is met, and the target flowchart is obtained; the termination condition is that the current temperature of the current round reaches the termination temperature.
[0120] This invention provides an embodiment of the process for obtaining the current flowchart by adjusting the baseline flowchart from the previous round; traversing the current flowchart to obtain current attribute information; obtaining the current flowchart penalty value based on the current attribute information and flowchart penalty rules; acquiring the baseline flowchart penalty value from the previous round; and determining the baseline flowchart for the next round based on the current flowchart penalty value and the baseline flowchart penalty value, until the termination condition of the annealing algorithm iteration is met, thus obtaining the target flowchart. The termination condition is that the current temperature of the current round reaches the termination temperature. This technical solution addresses the automatic optimization of the layout of chemical process flowchart controls. By quantifying the control layout and combining iterative optimization with the annealing algorithm, it avoids problems such as control overlap and chaotic connecting lines, facilitating user understanding and further improving the layout quality of the flowchart.
[0121] Optionally, the attribute information acquisition module 320 includes a traversal unit, a control attribute information determination unit, a logical relationship determination unit, and a connection line attribute determination unit;
[0122] The traversal unit is used to traverse the current flowchart and obtain control elements and connecting line elements;
[0123] The control attribute information determination unit is used to determine the control attribute information of control elements based on the size information of the current flowchart and preset rules.
[0124] The logical relationship determination unit is used to determine the logical relationship between controls based on control elements and connecting line elements;
[0125] The connector attribute determination unit is used to determine the connector attribute information based on the control attribute information and the logical relationship between controls; the connector attribute information is the length information of the connector element.
[0126] Optionally, the control attribute information determination unit is also used to determine the coordinate position of the control element based on the size information of the current flowchart;
[0127] The control size information is determined based on its coordinate position; the control size information includes the length and width information of the control element.
[0128] The control type of a control element is determined based on preset rules; the control type includes important, relatively important, or general.
[0129] The initial coordinate information of the control element is determined from its coordinate position based on a preset strategy;
[0130] Use the control's size information, control type, and initial coordinate information as the control's property information.
[0131] Optionally, the flowchart penalty rules include spacing penalty rules, connector penalty rules, and region penalty rules; the current flowchart penalty value determination module 330 includes a spacing penalty value determination unit, a connector penalty value determination unit, a region penalty value determination unit, and a current flowchart penalty value determination unit.
[0132] The spacing penalty value determination unit is used to determine the spacing penalty value based on the control attribute information and spacing penalty rules in the current attribute information.
[0133] The connector penalty value determination unit is used to determine the connector penalty value based on the connector attribute information and connector penalty rules in the current attribute information.
[0134] The region penalty value determination unit is used to determine the region penalty value based on the control attribute information in the current attribute information, the logical relationship between controls, and the region penalty rules.
[0135] The current flowchart penalty value determination unit is used to perform weighted aggregation of spacing penalty value, connector penalty value and region penalty value based on preset weights to obtain the current flowchart penalty value.
[0136] Optionally, the spacing penalty value determination unit is also used to determine the control spacing based on the initial coordinate information and size information in the control property information;
[0137] The spacing penalty value is determined based on the control spacing and spacing penalty rules.
[0138] Optionally, the area penalty value determination unit is also used to determine whether a control element exceeds the preset important area based on the preset important area in the area penalty rule and the control coordinate information of the control attribute information;
[0139] If the control exceeds the preset important area, the area penalty value is determined based on the control type, control coordinate information, and area penalty rules.
[0140] Optionally, the iteration module 350 is also used to compare the baseline flowchart penalty value with the current flowchart penalty value; if the current flowchart penalty value is less than the baseline flowchart penalty value, then the current flowchart is used as the baseline flowchart for the next round.
[0141] If the current flowchart penalty value is greater than the baseline flowchart penalty value, then the adjustment probability is calculated based on the current flowchart penalty value and the baseline flowchart penalty value.
[0142] The adjustment probability is compared with a randomly generated random number; if the random number is less than the adjustment probability, the current flowchart is used as the baseline flowchart for the next round.
[0143] The flowchart layout optimization device provided in this embodiment of the invention can execute the flowchart layout optimization method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method.
[0144] According to embodiments of the present invention, the present invention also provides an electronic device, a readable storage medium, and a computer program product.
[0145] Figure 5 A schematic diagram of an electronic device 10, which can be used to implement embodiments of the present invention, is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0146] like Figure 5 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0147] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0148] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as flowchart layout optimization methods.
[0149] In some embodiments, the flowchart layout optimization method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the flowchart layout optimization method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the flowchart layout optimization method by any other suitable means (e.g., by means of firmware).
[0150] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0151] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0152] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0153] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0154] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0155] A computing system can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product within the cloud computing service system. This addresses the shortcomings of traditional physical hosts and dedicated virtual services, such as high management difficulty and weak business scalability.
[0156] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0157] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A flowchart layout optimization method, characterized in that, include: The current flowchart for the current round is obtained by adjusting the baseline flowchart of the previous round. The current flowchart is traversed to obtain the current attribute information; The current attribute information includes control attribute information, connection line attribute information, and logical relationships between controls; Obtaining the current flowchart penalty value based on the current attribute information and flowchart penalty rules includes: determining a spacing penalty value based on control attribute information and spacing penalty rules in the current attribute information; determining a connector penalty value based on connector attribute information and connector penalty rules in the current attribute information; determining a region penalty value based on control attribute information, logical relationships between controls, and region penalty rules in the current attribute information; and weighting and aggregating the spacing penalty value, the connector penalty value, and the region penalty value based on preset weights to obtain the current flowchart penalty value; the flowchart penalty rules include spacing penalty rules, connector penalty rules, and region penalty rules. Obtain the baseline flowchart penalty value of the previous round's baseline flowchart; Based on the current flowchart penalty value and the baseline flowchart penalty value, the baseline flowchart for the next round is determined from the current flowchart and the baseline flowchart of the previous round, until the termination condition of the annealing algorithm iteration is met, and the target flowchart is obtained; the termination condition is that the current temperature of the current round reaches the termination temperature.
2. The method according to claim 1, characterized in that, The step of traversing the current flowchart to obtain the current attribute information includes: The current flowchart is traversed to obtain control elements and connecting line elements; Based on the size information of the current flowchart and the preset rules, determine the control attribute information of the control element; The logical relationship between controls is determined based on the control elements and the connecting line elements; The connection line attribute information is determined based on the control attribute information and the logical relationship between the controls; the connection line attribute information is the length information of the connection line element.
3. The method according to claim 2, characterized in that, The step of determining the control attribute information of the control element based on the size information of the current flowchart and preset rules includes: The coordinate position of the control element is determined based on the size information of the current flowchart; The control size information is determined based on the coordinate position; the control size information includes the length and width information of the control element. The control type of the control element is determined based on preset rules; the control type includes important, relatively important, or general. The initial coordinate information of the control element is determined from its coordinate position based on a preset strategy. The control size information, the control type, and the initial coordinate information are used as control attribute information.
4. The method according to claim 1, characterized in that, The step of determining the spacing penalty value based on the control attribute information and spacing penalty rules in the current attribute information includes: The spacing between controls is determined based on the initial coordinate and size information in the control attribute information. The spacing penalty value is determined based on the control spacing and spacing penalty rules.
5. The method according to claim 1, characterized in that, The step of determining the region penalty value based on the control attribute information, the logical relationship between controls, and the region penalty rule in the current attribute information includes: Based on the preset important area in the area penalty rule and the control coordinate information of the control attribute information, it is determined whether the control element exceeds the preset important area; If the area exceeds the preset important area, the area penalty value is determined based on the control type, the control coordinate information, and the area penalty rules.
6. The method according to claim 1, characterized in that, The step of determining the benchmark flowchart for the next round based on the current flowchart penalty value and the benchmark flowchart penalty value includes: The baseline flowchart penalty value is compared with the current flowchart penalty value; if the current flowchart penalty value is less than the baseline flowchart penalty value, then the current flowchart is used as the baseline flowchart for the next round. If the current flowchart penalty value is greater than the baseline flowchart penalty value, then the adjustment probability is calculated based on the current flowchart penalty value and the baseline flowchart penalty value; The adjustment probability is compared with a randomly generated random number; if the random number is less than the adjustment probability, the current flowchart is used as the baseline flowchart for the next round.
7. A flowchart layout optimization device, characterized in that, include: The adjustment module is used to adjust the baseline flowchart of the previous round to obtain the current flowchart of the current round; The attribute information acquisition module is used to traverse the current flowchart to obtain the current attribute information; the current attribute information includes control attribute information, connection line attribute information, and logical relationships between controls. The current flowchart penalty value determination module is used to obtain the current flowchart penalty value based on the current attribute information and the flowchart penalty rules; the flowchart penalty rules include spacing penalty rules, connector penalty rules, and region penalty rules. The baseline flowchart penalty value acquisition module is used to acquire the baseline flowchart penalty value of the previous round's baseline flowchart; The iteration module is used to determine the benchmark flowchart for the next round from the current flowchart and the benchmark flowchart of the previous round based on the current flowchart penalty value and the benchmark flowchart penalty value, until the termination condition of the annealing algorithm iteration is met, and the target flowchart is obtained. The termination condition is that the current temperature of the current wheel reaches the termination temperature; The current flowchart penalty value determination module includes a spacing penalty value determination unit, a connector penalty value determination unit, a region penalty value determination unit, and a current flowchart penalty value determination unit. The spacing penalty value determination unit is used to determine the spacing penalty value based on the control attribute information and spacing penalty rules in the current attribute information; The connection line penalty value determination unit is used to determine the connection line penalty value based on the connection line attribute information and connection line penalty rules in the current attribute information. The region penalty value determination unit is used to determine the region penalty value based on the control attribute information, the logical relationship between controls, and the region penalty rule in the current attribute information. The current flowchart penalty value determination unit is used to perform weighted aggregation of the spacing penalty value, the connecting line penalty value and the region penalty value based on preset weights to obtain the current flowchart penalty value.
8. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the flowchart layout optimization method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the flowchart layout optimization method according to any one of claims 1-6.
10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the flowchart layout optimization method according to any one of claims 1-6.