Method and system for run analysis of CAD routing algorithm connection program
By constructing static complexity and runtime pressure scoring functions to optimize the working parameters of the CAD pathfinding algorithm connection program, the latency problem of the CAD pathfinding algorithm under frequent graphic redrawing is solved, and stable and efficient execution under complex drawings is achieved.
Patent Information
- Application Number
- CN202511340778.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-19
- Publication Date
- 2026-05-05
- Estimated Expiration
- 2045-09-19
AI Technical Summary
Existing program analysis algorithms do not specifically analyze the frequency of graphic redrawing operations and video memory refresh load in CAD pathfinding algorithm connection programs, resulting in refresh delay issues in high-resolution displays or complex primitives.
By constructing a static complexity scoring function and a runtime pressure scoring function, the initial working parameters of the CAD pathfinding algorithm connection program are optimized, and the runtime pressure is monitored in real time. The working parameters are dynamically adjusted to ensure that the program remains stable and efficient under changes in complexity.
It achieves stable and efficient execution under complex CAD files, improves the accuracy of wiring results and drawing efficiency, balances system resource consumption and program response speed, avoids excessive resource consumption or idleness, and ensures smooth and reliable wiring operations.
Smart Images

Figure CN121257049B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of program execution analysis technology, and in particular to a method and system for analyzing the execution of CAD pathfinding algorithm connection programs. Background Technology
[0002] Currently, CAD software is widely used for path layout and equipment connection in scenarios such as industrial design, electrical construction drawing, intelligent cabling, and building electromechanical integration. To improve drawing efficiency and path rationality, more and more systems have integrated automatic pathfinding algorithms in recent years to assist in the wiring design of drawings. These systems not only require accurate generation of connection paths but also need to ensure the smoothness of system response and interface stability during graphics processing. Therefore, the analysis and control of their operational status has gradually become a key research direction.
[0003] During the execution of the routing procedure, runtime analysis mainly focuses on parameters such as the computational cost, number of iterations, memory usage, and path feasibility assessment in path search. Existing analysis methods typically establish runtime performance indicators by recording data such as node expansion during the pathfinding process, path search time, and routing success rate, thereby providing a reference for algorithm optimization and routing quality evaluation.
[0004] For example, Chinese invention patent CN119883861 B discloses a method and system for static program analysis based on LLVM, which includes: converting source files into LLVMIR files with source-level debugging information; traversing modules, functions, basic blocks, and instructions in the LLVMIR file to obtain static tracing information of the target function; constructing a basic block-level control flow graph of the LLVMIR file and annotating relevant information; identifying and annotating loop information during path traversal to obtain execution paths with loop comments, replacing basic blocks in the execution path with corresponding memory access information, and generating static memory tracing with loop comments; static memory tracing based on loop comments, and calculating the memory access reuse distance distribution through a recursive algorithm.
[0005] For example, Chinese invention patent CN114207594B discloses a static and runtime analysis of a computer program system, including identifying static dependencies between ecosystem elements based on the values of parameters in a parameter set associated with an ecosystem. These elements include computer programs and data resources associated with the computer programs. The method includes performing a runtime analysis of the ecosystem, including identifying elements used to process data records during the execution of the ecosystem. The method also includes performing a scheduling analysis of the ecosystem, including identifying computer programs with scheduling dependencies on another computer program. The method further includes identifying a subset of these elements as ecosystem units based on the results of the static analysis, runtime analysis, and scheduling analysis; and migrating the ecosystem units from a first computer system to a second computer system, testing the ecosystem units, or both.
[0006] The above-mentioned technology has at least the following technical problems:
[0007] Existing program analysis algorithms mostly focus on static tracing of code logic structure (such as instruction-level control flow analysis and memory access pattern calculation), cross-program ecosystem dependency identification (such as program-data resource association and scheduling dependency analysis), or runtime performance optimization of general programs (such as loop execution efficiency and memory reuse rate improvement). The core revolves around the functional correctness at the code level and the resource scheduling efficiency of general systems, without designing specific analysis logic for the specific runtime characteristics of CAD programs. However, for CAD pathfinding algorithm connection programs, since their core function implementation relies on the ObjectARX interface to complete graphical interaction, a graphical redrawing operation is triggered every time a connection or pathfinding calculation is performed. This process directly leads to frequent updates of graphic data and dynamic refresh of video memory. Especially when the CAD file is in high-resolution display mode or contains a large number of layers and complex graphic elements (such as blocks and intersecting line segments), the amount of data to be processed in a single redraw increases exponentially, the load on video memory refresh increases sharply, and ultimately the program exhibits significant refresh delay. Summary of the Invention
[0008] To address the aforementioned technical problems in the existing technology, embodiments of the present invention provide a method and system for analyzing the operation of a CAD pathfinding algorithm connection program. The technical solution is as follows:
[0009] On the one hand, it provides a method for analyzing the operation of CAD pathfinding algorithm connection programs, including:
[0010] The CAD file to be executed in the CAD pathfinding algorithm connection program is designated as the target executable file. A static complexity scoring function is constructed to output the static complexity score of the target executable file. Before executing the CAD pathfinding algorithm connection program, the initial working parameters of the CAD pathfinding algorithm connection program are optimized based on the static complexity score of the target executable file.
[0011] The CAD routing algorithm connection program is executed based on its initial working parameters. During execution, the program's operating pressure is monitored in real time. An operating pressure scoring function is constructed, and the operating pressure score is output, thereby determining the first execution path of the CAD routing algorithm connection program.
[0012] When the first execution path of the CAD routing algorithm connection program is to optimize and adjust the working parameters, the working parameters of the CAD routing algorithm connection program are optimized and adjusted in a preset parameter adjustment order. After each optimization and adjustment is completed, the adjustment effect is analyzed, thereby determining the second execution path of the CAD routing algorithm connection program.
[0013] On the other hand, an operational analysis system for CAD pathfinding algorithm connection programs is provided, which includes: an initial working parameter optimization setting module, a first execution path determination module, and a second execution path determination module.
[0014] The initial working parameter optimization setting module is used to denote the CAD file of the CAD pathfinding algorithm connection program to be executed as the target execution file, construct a static complexity scoring function, output the static complexity score of the target execution file, and optimize the initial working parameters of the CAD pathfinding algorithm connection program based on the static complexity score of the target execution file before executing the CAD pathfinding algorithm connection program.
[0015] The first execution path determination module is used to execute the CAD routing algorithm connection program based on the initial working parameters of the CAD routing algorithm connection program. During the execution process, it monitors the running pressure of the CAD routing algorithm connection program in real time, constructs a running pressure scoring function, outputs the running pressure score, and thus determines the first execution path of the CAD routing algorithm connection program.
[0016] The second execution path determination module is used to perform the working parameter optimization adjustment of the CAD path finding algorithm connection program in a preset parameter adjustment order when the first execution path of the CAD path finding algorithm connection program is to perform working parameter optimization adjustment, and to analyze the adjustment effect after each optimization adjustment, thereby determining the second execution path of the CAD path finding algorithm connection program.
[0017] The beneficial effects of the technical solutions provided in the embodiments of the present invention include at least the following:
[0018] 1. The operational analysis method for CAD routing algorithm connection programs provided by this invention can achieve a fine quantitative characterization of CAD files through static complexity scoring before program execution, and dynamically monitor and control the process by combining real-time operational pressure scoring. This ensures that the routing connection program maintains a stable and efficient execution state under drawings of varying complexity. This method not only improves the accuracy and drawing efficiency of wiring results, but also effectively balances system resource consumption and program response speed, ensuring smoother and more reliable connection operations in complex design tasks.
[0019] 2. By determining the first execution path of the CAD pathfinding algorithm connection program, this invention can automatically select to continue pathfinding or enter parameter optimization adjustment based on the real-time running pressure score during operation. This achieves dynamic adaptation and precise control of the program's running state, effectively ensuring the stability and efficiency of the connection process, while avoiding excessive consumption or idleness of system resources. This allows the CAD pathfinding task to maintain a smooth and reliable execution effect even under complex drawing conditions.
[0020] 3. By determining the second execution path of the CAD pathfinding algorithm connection program, this invention can quantitatively analyze the adjustment effect after each parameter optimization adjustment, and select to continue fine-tuning, trigger rollback, or generate an adjustment completion signal accordingly, thereby ensuring the scientific nature and adaptability of the parameter setting process, and effectively improving the stability of program operation and the overall efficiency of pathfinding connection. Attached Figure Description
[0021] 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.
[0022] Figure 1 This is a schematic diagram of the running analysis method for the CAD pathfinding algorithm connection program provided in an embodiment of the present invention.
[0023] Figure 2 This is a structural diagram of the running analysis system for the CAD pathfinding algorithm connection program provided in an embodiment of the present invention.
[0024] Figure 3 This is the interactive interface of the CAD pathfinding algorithm connection program involved in the embodiments of the present invention.
[0025] Figure 4 This is a plan view of the CAD pathfinding algorithm connection program before application in the embodiments of the present invention.
[0026] Figure 5This is a planar view of the file after automatic connection, as described in an embodiment of the present invention.
[0027] Figure 6 This is a planar rendering of a file after automatic pathfinding, as described in an embodiment of the present invention. Detailed Implementation
[0028] The technical solution of the present invention will now be described with reference to the accompanying drawings.
[0029] In embodiments of the present invention, words such as "exemplarily," "for example," etc., are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" in the present invention should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of the word "exemplary" is intended to present the concept in a concrete manner. Furthermore, in embodiments of the present invention, the meaning expressed by "and / or" can be both, or either one.
[0030] In the embodiments of this invention, the terms "image" and "picture" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction between them, their intended meanings are consistent. Similarly, the terms "of," "corresponding (relevant)," and "corresponding" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction between them, their intended meanings are consistent.
[0031] In this embodiment of the invention, sometimes a subscript such as W1 may be written in a non-subscript form such as W1. When the difference is not emphasized, the meaning they express is the same.
[0032] To make the technical problems, technical solutions and advantages of the present invention clearer, a detailed description will be given below in conjunction with the accompanying drawings and specific embodiments.
[0033] like Figure 3 The image shows the interactive interface of the CAD pathfinding algorithm connection program involved in the embodiment of the present invention, including an automatic connection function area and an automatic pathfinding function area.
[0034] The automatic wiring function area is used to automatically generate connection lines in batches based on the equipment blocks, path segments, lead wire information, etc. selected by the user. It is suitable for automatically drawing connection paths for cables, cable trays, etc.
[0035] Among them, selecting the connection block reference, such as "Hemisphere Camera Cabinet (42u)" in the figure, indicates the starting equipment block; selecting the path polyline, such as "CABLETRAY_PDS_DOTE;", specifies the cable tray path that can be used for connection; connection layer name, such as "Auto-Connect-Pl ine", defines the layer to which the generated connection line belongs; polyline header top / bottom, such as "CAT6×1 / RVV2×1.0 / JDG20×1" and "WC / WS / FC / ...", indicates the labeling description of the connection line; height / rib is used to control the height position and wire end size of the cable in the drawing; the result output box prompts such as "40 connection lines successfully generated".
[0036] The automatic pathfinding function area is used to calculate and draw the optimal path in the specified path network based on the selected start and end device blocks using a shortest path algorithm (such as Dijkstra).
[0037] Among them, selecting the start point / end point tile specifies the device or module at the beginning and end of the path; selecting the path polyline, similar to automatic connection, specifies the path network used for pathfinding; the path layer name, such as "Shortest-Route-Pline", is used to identify the layer of the drawing result; the automatic pathfinding button performs path search and drawing; and the result output box, such as "37 paths successfully drawn".
[0038] like Figure 1 The flowchart shown here illustrates the operational analysis method for the CAD pathfinding algorithm connection program, including:
[0039] The CAD file to be executed in the CAD pathfinding algorithm connection program is designated as the target executable file. A static complexity scoring function is constructed to output the static complexity score of the target executable file. Before executing the CAD pathfinding algorithm connection program, the initial working parameters of the CAD pathfinding algorithm connection program are optimized based on the static complexity score of the target executable file.
[0040] Furthermore, a static complexity scoring function is constructed to output the static complexity score of the target executable file. The specific process is as follows:
[0041] The number of blocks, total number of primitives, number of main lines, and number of endpoints are compared with their corresponding reference values. A complexity allocation coefficient is introduced to perform weighted coupling processing on the comparison results. The weighted coupling processing results are then combined with the primitive type weights for coupling processing, thereby constructing a static complexity scoring function.
[0042] In CAD, a block is a repetitive or encapsulated collection of graphics, typically used to represent modular objects such as equipment, symbols, and components. The block count is the number of block instances defined or inserted in a drawing. The number of BlockReferences can be read and counted by calling the BlockTable through CAD APIs (such as ObjectARX, AutoLISP, VBA, and .NET API).
[0043] Primitives are the basic elements that make up graphics in CAD, including lines, polylines, circles, text, and hatches. The total number of primitives represents the sum of all objects in the drawing that can be rendered / drawn. This can be accumulated by using Entity as the base class type during the iteration of ModelSpace or PaperSpace. For example, in ObjectARX, you can use AcDbBlockTableRecordIterator to iterate through AcDbEntities and record the total number.
[0044] The trunk line generally refers to the critical segment in a cable tray system or main cabling path, used to carry multiple connected devices or branches. This parameter measures the "skeleton-level" structure of the wiring complexity. Trunk lines need to be distinguished in CAD drawings based on layer naming, line width, color, or characteristic attributes; for example, a cable tray trunk line might reside in a layer named Trunk_Cable. The number of Line or Polyline elements on a layer can be filtered and counted.
[0045] Endpoints refer to device interface points, connectors, sockets, etc., that require connection. They are often identified by insertion points, point entities, or blocks with attributes in the block definition. The number of endpoints is a critical node for the start and end of the algorithm's calculation path. It can be obtained by identifying insertion points contained in blocks (such as device symbols), block attributes, or Point elements on dedicated layers.
[0046] Primitive type weights are used to express the degree of influence of different primitives on the complexity of the connection algorithm. For example, curved polylines may be more complex than straight lines, and filled patterns may obstruct the path, so different weights are assigned. The weight design is generally set by experience. In this embodiment, the weights can be obtained and assigned as follows: Traverse primitive types, such as Line, Arc, Polyline, Hatch, and Solid, and define weights based on factors such as entity complexity, interactivity, and whether the path is obstructed (e.g., Line = 1, Polyline = 2, Hatch = 3). The weights are then included in the score in the static complexity scoring function in the form of weight × number of primitives.
[0047] When the number of blocks increases, it often means an increase in modular elements such as devices and interface symbols. This will directly lead to an increase in the number of endpoints (because each block usually represents a node that needs to be connected). It may also bring more elements (such as inserted lines, text, and graphics), thus increasing the total number of elements. An increase in the total number of elements may mean that the overall structure in the drawing is more dense. If the layer design used for cable trays or main lines in the drawing remains unchanged, the number of trunk lines may also be pushed up. The change in the number of trunk lines will affect the connection distribution density between endpoints and main lines. If the number of trunk lines increases, the number of endpoints handled by each trunk line may decrease, and the connection strategy may be more flexible. Conversely, the connection will be congested.
[0048] Extract the preset number of reference blocks, total number of reference elements, number of reference trunk lines, and number of reference endpoints from the database.
[0049] Extract the pre-defined complexity allocation coefficients for the number of tiles, the total number of primitives, the main line, and the endpoints from the database.
[0050] In this embodiment, the system database pre-stores configuration data for multiple complexity allocation coefficients used for the quantitative analysis of static complexity of CAD target executable files. These coefficients characterize the weighting of different graphic parameters (in this embodiment, the number of blocks, total number of primitives, number of trunk lines, and number of endpoints in the CAD target executable file) in the overall static complexity score calculation. The configuration data is managed in the form of a structured coefficient parameter set. This parameter set is determined comprehensively based on a large amount of experimental data from pathfinding algorithms for CAD files with different complexities, the analysis results of the impact of graphic elements on the load of the connection program, and the verification conclusions regarding the correlation between static complexity scores and program running efficiency. Based on this parameter set, the system can directly read the block number complexity allocation coefficient, the total number of primitives complexity allocation coefficient, the trunk line number complexity allocation coefficient, and the endpoint number complexity allocation coefficient from the database before constructing the static complexity scoring function and calculating the static complexity score of the target executable file. The allocation coefficients are real values between 0 and 1, and the sum of the four is 1. This ensures that when the comparison results of each graphic parameter and its corresponding reference value are weighted and coupled, the influence ratio of different graphic parameters on the static complexity score is stable and the quantification logic is rigorous. This ensures that the final output static complexity score can accurately reflect the execution difficulty of the target executable file on the CAD pathfinding algorithm connection program.
[0051] In a specific embodiment, the static complexity scoring function is expressed as follows:
[0052]
[0053] Where, f(x) ALet y5 be the static complexity scoring function, where a(x) is the number of tiles, b(x) is the total number of primitives, c(x) is the number of trunk lines, d(x) is the number of endpoints, y5 is the primitive type weight, a0 is the number of reference tiles, b0 is the total number of reference primitives, c0 is the number of reference trunk lines, d0 is the number of reference endpoints, y1 is the complexity allocation coefficient for the number of tiles, y2 is the complexity allocation coefficient for the total number of primitives, y3 is the complexity allocation coefficient for the number of trunk lines, and y4 is the complexity allocation coefficient for the number of endpoints.
[0054] Obtain the number of blocks, total number of primitives, number of trunk lines, number of endpoints, and primitive type weights of the target executable file, and input these as input data into the static complexity scoring function to output the static complexity score of the target executable file.
[0055] The static complexity score of the target executable file is a quantitative representation of the execution complexity of the target executable file, which is composed of the number of blocks, the total number of primitives, the number of trunk lines, the number of endpoints, and the primitive type weight.
[0056] Furthermore, the initial working parameters of the CAD pathfinding algorithm connection program are optimized based on the static complexity score of the target executable file. The specific analysis process is as follows:
[0057] Using the static complexity score of the target executable file as the query key, the historical cache is queried. If a historical cache exists, the working parameters corresponding to the static complexity score of the target executable file stored in the historical cache are used as the initial working parameters of the CAD routing algorithm connection program.
[0058] When querying the historical cache using the static complexity score of the target executable file as the query key, the query interface of the historical cache database is first called. The calculated static complexity score of the target executable file is used as the core retrieval parameter and input into the preset cache query logic. This query logic automatically traverses all entries stored in the historical cache database, comparing the consistency between the static complexity score associated with each entry and the current query key. If a historical cache entry with a completely matching score exists, the working parameters of the CAD routing algorithm connection program corresponding to that static complexity score recorded in the entry are extracted and output as the query result. If no historical cache entry matching the current query key is found after the traversal, a query feedback signal of "no matching historical cache" is generated, providing a trigger for subsequent queries of working parameters from the static complexity score-working parameter setting matching table, ensuring the continuity and accuracy of the entire initial working parameter setting process.
[0059] If no historical cache exists, the static complexity score of the target executable file is used as the query key to retrieve the working parameters from the static complexity score-working parameter setting matching table, and these working parameters are recorded as the initial working parameters of the CAD pathfinding algorithm connection program.
[0060] If no matching result is found in the historical cache, indicating that no historical cache data corresponding to the static complexity score of the target executable file exists, the static complexity score is used as the unique query key and input into the pre-built static complexity score-working parameter setting matching table. This matching table contains a mapping relationship between the static complexity score interval and the working parameters of the corresponding CAD pathfinding algorithm connection program. Through preset interval matching logic, the specific score interval to which the static complexity score of the target executable file belongs is first determined, and then the working parameter data associated with that score interval in the table is called. This working parameter data includes the path merging tolerance and batch drawing element count of the orthogonal algorithm, and the graphics refresh interval, path merging tolerance, and batch drawing element count of the Dijkstra algorithm. After extracting the above working parameter data, it is directly recorded as the initial working parameters of the CAD pathfinding algorithm connection program to be executed, completing the matching and determination of the initial working parameters and providing a parameter basis for the subsequent startup and execution of the CAD pathfinding algorithm connection program.
[0061] The initial working parameters of the CAD pathfinding algorithm connection program include the initial working parameters of the orthogonal algorithm and the initial working parameters of the Dijkstra algorithm.
[0062] The initial working parameters of the orthogonal algorithm include the path merging tolerance and the number of batch plotting elements.
[0063] In orthogonal algorithms, path merging tolerance refers to the maximum distance threshold allowed when processing CAD pathfinding and connection. This threshold allows multiple adjacent or similar orthogonal paths to be considered mergingable. Its purpose is to reduce path redundancy by setting a reasonable distance range, avoiding drawing clutter and resource waste caused by excessive path subdivision, while ensuring that the merged paths still meet the accuracy requirements of the CAD drawing, thus improving the simplicity and standardization of the pathfinding and connection results. The batch drawing element count refers to the upper limit of the number of graphic elements (such as lines and nodes) loaded and processed by the orthogonal algorithm in a single drawing execution. Its purpose is to balance drawing efficiency and system load. When the batch drawing element count is set reasonably, it can reduce the frequency of resource calls and data interactions during the drawing process, speeding up the overall drawing speed, while avoiding system lag and response delays caused by processing too many graphic elements at once, ensuring the stable operation of the orthogonal algorithm in CAD file pathfinding and connection with varying complexity.
[0064] The initial operating parameters of Dijkstra's algorithm include the graphics refresh interval, path merging tolerance, and the number of batch drawing elements.
[0065] In Dijkstra's algorithm, the graphics refresh interval refers to the time interval at which the algorithm updates the graphic content of the drawing interface during CAD pathfinding and connection. Its purpose is to balance the visualization effect of the pathfinding process with the consumption of system resources: a reasonable refresh interval can avoid wasting system computing power and causing interface lag due to excessively frequent refreshes, while ensuring that users can observe the pathfinding progress and path generation status in a timely manner, improving the user experience. Path merging tolerance refers to the maximum distance threshold at which the algorithm determines whether multiple similar pathfinding paths can be merged into a single path. Its purpose is to simplify the path structure of the pathfinding results, reduce redundant lines caused by excessive path subdivision, reduce the complexity of CAD graphics, and ensure that the merged path still meets the actual pathfinding requirements and graphic accuracy standards, avoiding path deviation. The number of drawing elements in a batch refers to the upper limit of the number of primitives (such as path segments, node markers, etc.) that the algorithm loads and executes drawing operations in a single operation. Its function is to optimize the resource scheduling of the drawing process: by controlling the number of primitives processed in a single operation, it can avoid excessive memory consumption and drawing response delay caused by loading too many primitives in a single operation, while reducing the efficiency loss caused by frequent data interaction, and ensuring the stability and efficiency of Dijkstra's algorithm when processing pathfinding and connection in complex CAD files.
[0066] The CAD routing algorithm connection program is executed based on its initial working parameters. During execution, the program's operating pressure is monitored in real time. An operating pressure scoring function is constructed, and the operating pressure score is output, thereby determining the first execution path of the CAD routing algorithm connection program.
[0067] Furthermore, the CAD pathfinding algorithm connection program is executed based on the initial working parameters of the CAD pathfinding algorithm connection program. The specific execution process is as follows:
[0068] A1. Analyze the primitives of the target executable file and construct a connection relationship diagram.
[0069] A2, based on the orthogonal connection algorithm, generates orthogonal paths, ensuring that the connecting lines conform to the horizontal-vertical polyline rule, and automatically avoids obstacles and avoids overlapping connections.
[0070] A3, based on Dijkstra's algorithm, performs shortest path search in the constructed connection graph and selects the optimal path according to preset rules.
[0071] A4 converts the generated optimal path into a CAD-drawable graphic element, thereby drawing the optimal path onto the drawing.
[0072] It should be noted that, in the process of path generation and drawing, this invention first traverses various primitives in the current drawing file through the CAD platform API, and constructs a node-edge connection graph based on primitive type and spatial relationship. During the path generation stage, an orthogonal connection strategy is used to construct initial candidate connections, and Dijkstra's algorithm is called to search for the shortest path. The path weight comprehensively considers distance, obstacle avoidance cost, and the number of line segments. Finally, the path is converted into Polyline primitives and drawn onto the CAD layer, with specific line types, colors, and layer attributes set to ensure visualization consistency.
[0073] This embodiment uses ObjectARX as the CAD platform API.
[0074] ObjectARX (AutoCAD Runtime Extension) is a C++ API framework provided by Autodesk to extend the functionality of AutoCAD. Through ObjectARX, developers can directly manipulate AutoCAD's drawing database (AcDbDatabase) and entity primitives (such as AcDbLine, AcDbPolyline, AcDbBlockReference, etc.) to implement custom drawing, data processing, and interactive functions. After inserting or modifying primitives (such as lines or paths) in the program, the relevant drawing refresh functions must be explicitly called to visualize the changes.
[0075] Furthermore, a performance stress scoring function is constructed to output the performance stress score. The specific process is as follows:
[0076] The time consumed by drawing and updating a single frame, the number of primitives in a single frame, and the blocking time of the UI thread are compared with the corresponding reference values. Then, a pressure allocation factor is introduced to couple the results of each comparison, thereby constructing a runtime pressure scoring function.
[0077] Single-frame drawing update time refers to the time required to perform a single drawing refresh (or a single path drawing update) in the CAD graphics interface, usually measured in milliseconds (ms). It measures the time taken for the main drawing thread to complete a full primitive rendering and for the interface to refresh. It is a key indicator for assessing system lag and the presence of rendering bottlenecks. In AutoCAD's ObjectARX environment, this can be achieved using `acedGetAcadDwgViewUpdateTime()` or by customizing the timestamp collection method before and after the drawing function.
[0078] The number of primitives per frame refers to the total number of primitives (such as Line, Polyline, BlockReference, etc.) rendered or processed in a given frame of drawing operations. It is used to measure the data density of the current drawing workload. In the ObjectARX environment, the number of active primitives in the current graphics space can be traversed using AcDbBlockTableRecordIterator.
[0079] UI thread blocking duration refers to the duration during the drawing process when the UI thread is not responding to user interaction or interface updates due to performing computationally intensive tasks (such as path calculation, batch drawing, and file I / O). Message response latency is detected in the UI thread message loop (e.g., monitoring the processing time of messages such as WM_PAINT and WM_MOUSEMOVE through hook functions) and recorded as the UI thread blocking duration.
[0080] Extract the preset reference single-frame drawing update time, reference single-frame primitive count, and reference UI thread blocking time from the database.
[0081] Extract the preset pressure allocation factors for single-frame drawing update time, single-frame primitive quantity, and UI thread blocking duration from the database.
[0082] In this embodiment, the system database pre-stores configuration data for multiple pressure allocation factors used for quantitative analysis of the running pressure of the CAD pathfinding algorithm connection program. These factors characterize the proportional relationship between different running pressure parameters (in this embodiment, single-frame drawing update time, single-frame primitive quantity, and UI thread blocking duration) in the overall running pressure score calculation. The configuration data is managed in the form of a structured weighted parameter set, which is determined comprehensively based on long-term measured data of the CAD pathfinding algorithm operation, the drawing load monitoring results of CAD files with different complexities, and the program stuttering / delay response analysis conclusions. Based on this parameter set, the system can directly read the single-frame drawing update time pressure allocation factor, the single-frame primitive quantity pressure allocation factor, and the UI thread blocking duration pressure allocation factor from the database before constructing the running pressure scoring function and conducting program running pressure assessment. The allocation factors are real values between 0 and 1, and the sum of the three is 1. This ensures that when calculating the running pressure score using weighted coupling, the proportion of the influence of different pressure parameters on the program's running state is stable, and the physical meaning of the quantification logic is clear, avoiding deviations in the running pressure assessment results from the actual running situation due to parameter weight imbalances.
[0083] With a preset monitoring cycle, the single-frame drawing update time, single-frame primitive count, and UI thread blocking duration of the target executable file are obtained and used as input data to the runtime stress scoring function, thereby outputting the runtime stress score.
[0084] The runtime stress score is a quantitative basis for the impact of single-frame drawing update time, single-frame primitive quantity, and UI thread blocking time on the runtime stress of the CAD pathfinding algorithm connection program.
[0085] Furthermore, the first execution path of the CAD pathfinding algorithm connection program is determined, and the specific analysis process is as follows:
[0086] Extract the preset ideal range of operating pressure scores from the database.
[0087] If the running stress score is within the ideal range, then the first execution path of the CAD pathfinding algorithm connection program is recorded as the pathfinding connection for continuing the target execution file.
[0088] If the running stress score is within the ideal range, it means that the current CAD pathfinding algorithm connection program is running in accordance with the preset optimal running standards on the target executable file. The time consumed for single-frame drawing update, the number of single-frame primitives, and the UI thread blocking time are all within a reasonable range. The system resource consumption and program running efficiency are balanced. There is no need to adjust the working parameters. Continuing to execute pathfinding connection can ensure that the program can stably and efficiently complete the pathfinding task of the target CAD file.
[0089] If the operational stress score is not within the ideal range, the first execution path of the CAD pathfinding algorithm connection program is recorded as the execution of operational parameter optimization adjustment. The direction information of operational parameter optimization adjustment is analyzed. The specific process is as follows:
[0090] If the running stress score is not within the ideal range, it means that the current running status of the CAD pathfinding algorithm connection program has deviated from the preset optimal running standard. The program's running efficiency or system load is no longer as expected. It is necessary to optimize and adjust the working parameters to correct the running status and bring the program back to a stable and efficient running range.
[0091] If the operating pressure score is lower than the lower limit of the ideal range for operating pressure scores, the direction of the optimized adjustment of the working parameters will be recorded as high-efficiency adjustment.
[0092] If the running pressure score is lower than the lower limit of the ideal running pressure score range, it indicates that the running pressure of the current CAD pathfinding algorithm connection program is too low, the single frame drawing update time is too short, the number of single frame primitives is too small, or the UI thread blocking time is too short, there are many idle system resources, the program running efficiency has not been maximized, and it is necessary to adjust the working parameters with the aim of improving efficiency, so as to make full use of idle resources to improve the pathfinding connection speed and shorten the overall task completion time.
[0093] If the operating pressure score is higher than the upper limit of the ideal range for operating pressure scores, the direction information for optimizing the adjustment of operating parameters will be recorded as low load adjustment.
[0094] If the running pressure score is higher than the upper limit of the ideal running pressure score range, it indicates that the current CAD pathfinding algorithm connection program is under too much running pressure. The single frame drawing update takes too long, the number of single frame primitives is too large, or the UI thread is blocked for too long. The system resource consumption is close to or exceeds the capacity limit. The program may experience problems such as lag and response delay. It is necessary to adjust the working parameters to reduce the load, thereby reducing the system resource occupation, alleviating the running pressure, and ensuring the stable operation of the program.
[0095] When the first execution path of the CAD routing algorithm connection program is to optimize and adjust the working parameters, the working parameters of the CAD routing algorithm connection program are optimized and adjusted in a preset parameter adjustment order. After each optimization and adjustment is completed, the adjustment effect is analyzed, thereby determining the second execution path of the CAD routing algorithm connection program.
[0096] Furthermore, the working parameters of the CAD pathfinding algorithm connection program were optimized and adjusted according to a preset parameter adjustment sequence. The specific analysis process is as follows:
[0097] During high-efficiency adjustment, the difference between the lower limit of the ideal range of the operating pressure score and the operating pressure score is processed to obtain the first operating pressure score deviation value. That is, the result of subtracting the operating pressure score from the lower limit of the ideal range of the operating pressure score is recorded as the first operating pressure score deviation value.
[0098] During low-load adjustment, the difference between the operating pressure score and the upper limit of the ideal range of the operating pressure score is used to obtain the second operating pressure score deviation value. That is, the result of subtracting the upper limit of the ideal range of the operating pressure score from the operating pressure score is recorded as the second operating pressure score deviation value.
[0099] Using the first operating pressure score deviation value or the second operating pressure score deviation value as the query key, the set of optimized operating parameters is obtained from the operating pressure score deviation-operating parameter adjustment matching table.
[0100] The first or second operating pressure score deviation value is used as the unique query key and input into a pre-built operating pressure score deviation-working parameter adjustment matching table. This matching table contains a built-in mapping relationship between different operating pressure score deviation value ranges and the corresponding working parameter adjustment amounts of the CAD routing algorithm connection program. Its mapping logic is preset based on the results of historical operating data statistical analysis and the verification conclusions of multiple rounds of parameter adjustment effects, which can achieve accurate matching between deviation values and adjustment amounts. During the query process, the interval matching algorithm integrated into the table first determines the interval to which the input first or second operating pressure score deviation value belongs, thus identifying its specific deviation value range. Then, based on this deviation value range, the pre-stored working parameter optimization adjustment set associated with that range is called from the matching table. After the above working parameter optimization adjustment set is extracted, the query process is completed, providing a clear and executable parameter adjustment basis for the subsequent execution of the working parameter optimization adjustment of the CAD routing algorithm connection program according to the preset parameter adjustment order, ensuring the scientific nature and effectiveness of the parameter adjustment process.
[0101] The set of working parameter optimization adjustments includes the set of working parameter optimization adjustments for orthogonal algorithms and the set of working parameter optimization adjustments for Dijkstra's algorithm.
[0102] The set of optimization and adjustment parameters for the orthogonal algorithm includes the optimization adjustment values for the number of batch drawing elements, the path merging tolerance, and the algorithm backoff threshold.
[0103] The set of optimization and adjustment parameters for the Dijkstra algorithm includes the optimization adjustment values for the number of batch drawing elements, the path merging tolerance, the graphics refresh interval, and the algorithm backoff threshold.
[0104] In one specific embodiment, assuming high-efficiency adjustment, the adjustment direction for the orthogonal algorithm's working parameters is "increase" for the batch drawing element quantity optimization value. This increases the number of primitives processed in a single drawing operation, reducing the frequency of resource calls and data interactions during the drawing process, and fully utilizing idle system resources to improve drawing efficiency. The adjustment direction for the path merging tolerance optimization value is also "increase," expanding the distance threshold for mergeable paths, reducing the number of path subdivisions, lowering the amount of drawing computation, and further accelerating pathfinding and connection speed. The adjustment direction for the algorithm backoff threshold optimization value is also "increase," raising the threshold for triggering the algorithm's backoff mechanism, reducing unnecessary backoff operations, avoiding efficiency losses caused by frequent backoffs, and ensuring the algorithm's continuous and efficient operation.
[0105] For the optimization and adjustment set of Dijkstra's algorithm working parameters, the adjustment direction for the batch drawing element quantity optimization value is "increase" to increase the number of primitives processed in a single load and improve the drawing execution speed; the adjustment direction for the path merging tolerance optimization value is "increase" to simplify the path structure and reduce the computational load; the adjustment direction for the graphics refresh interval optimization value is "decrease" to shorten the time interval of interface graphics updates, allowing users to obtain pathfinding progress feedback more promptly under the premise of sufficient system resources, without affecting the overall running efficiency; the adjustment direction for the algorithm backoff threshold optimization value is "increase" to reduce unnecessary backoff frequency and ensure that the algorithm efficiently advances the pathfinding process.
[0106] In another specific embodiment, assuming low-load adjustment, the optimization adjustment set for the working parameters of the orthogonal algorithm is as follows: the adjustment direction for the batch drawing element quantity optimization value is "reduced", which reduces the number of primitives processed in a single drawing, reduces the system's resource consumption per unit time, and alleviates the operating pressure; the adjustment direction for the path merging tolerance optimization value is "reduced", which narrows the distance threshold of mergeable paths, avoids path accuracy degradation due to excessive merging, and reduces unnecessary calculations by controlling the merging range, balancing accuracy and load; the adjustment direction for the algorithm rollback threshold optimization value is "reduced", which lowers the threshold for the algorithm to trigger the rollback mechanism, and rolls back in time when abnormal operation symptoms appear, avoiding further accumulation of system load and ensuring stable program operation.
[0107] For the optimization and adjustment set of Dijkstra's algorithm working parameters, the adjustment direction for the batch drawing element quantity optimization value is "decreasing" to reduce the number of primitives loaded at one time, thereby reducing system memory and computing power consumption; the adjustment direction for the path merging tolerance optimization value is "decreasing" to ensure path accuracy while controlling the computational load; the adjustment direction for the graphics refresh interval optimization value is "increasing" to extend the time interval between interface graphics updates, reduce the system resource occupation of graphics rendering, and prioritize the stability of the core operation of the pathfinding algorithm; the adjustment direction for the algorithm rollback threshold optimization value is "decreasing" to promptly trigger the rollback mechanism to avoid operational risks and prevent the program from freezing or crashing due to excessive system load.
[0108] The working parameters of the CAD routing algorithm connection program are optimized and adjusted based on the preset parameter adjustment sequence and the set of working parameters.
[0109] In this embodiment, the preset parameter adjustment order is as follows: batch drawing element quantity optimization adjustment, path merging tolerance optimization adjustment, graphic refresh interval optimization adjustment (if any), and algorithm rollback threshold optimization adjustment.
[0110] The number of elements drawn in a batch directly determines the scale of primitives processed by the algorithm in a single run. It is the most critical and direct parameter affecting system load (such as memory usage and computing power consumption) and operating efficiency (such as drawing speed). Adjusting it can quickly change the intensity of resource consumption per unit time and significantly improve the operating pressure in a short period of time (such as increasing the number when adjusting for high efficiency can quickly utilize idle resources, and decreasing the number when adjusting for low load can quickly reduce resource usage). Therefore, it can be used as the first parameter to adjust, which can prioritize solving the core contradiction of operating pressure.
[0111] The path merging tolerance directly affects the drawing computation load and path generation efficiency by influencing the decision range of path merging: increasing the tolerance can reduce the number of path subdivisions to reduce the computational load, while decreasing the tolerance can control invalid calculations while ensuring accuracy. The impact of this parameter on the operating pressure is second only to the number of batch drawing elements. After adjusting the core load parameters, it can further optimize the balance between computational efficiency and graphics quality.
[0112] The graphics refresh interval (only relevant to the Dijkstra algorithm) primarily affects the frequency of UI visualization updates. Its adjustment does not directly change the load and efficiency of the core computation of the pathfinding algorithm. It only assists in optimization by adjusting the resource allocation ratio between "computation" and "rendering" (e.g., increasing the interval can reduce rendering resource consumption when adjusting under low load, and decreasing the interval can improve the interactive experience when adjusting under high efficiency). Therefore, this parameter has a weaker impact on the running pressure than the previous two parameters. Furthermore, it needs to be optimized for adaptability after the core computation parameters have been adjusted to a stable level. Therefore, it is set as the third parameter to be adjusted to avoid increasing the complexity of parameter tuning without resolving the core running problems.
[0113] Algorithm rollback threshold is a fallback parameter to ensure stable program operation. Its function is to control the threshold at which the algorithm triggers the rollback mechanism (e.g., reducing the threshold during low-load adjustments can trigger timely rollback to avoid overload risks, while increasing the threshold during high-efficiency adjustments can reduce unnecessary rollbacks). This parameter does not directly improve operating pressure or efficiency, but rather provides stability assurance based on the operating state after the previous parameters have been adjusted. If it is adjusted first, the rollback mechanism may be falsely triggered or fail due to the uncertainty of the core operating state. Therefore, it is used as the last adjustment parameter, and the stability of program operation can be optimized in a targeted manner after the core parameters have been adjusted.
[0114] Furthermore, after each optimization adjustment, the adjustment effect is analyzed to determine the second execution path of the CAD pathfinding algorithm connection program. The specific analysis process is as follows:
[0115] Using the first operating pressure score deviation value or the second operating pressure score deviation value as the query key, the monitoring duration is obtained from the operating pressure score deviation-monitoring duration matching table, and the ideal variation range of the operating pressure score is obtained from the operating pressure score deviation-ideal optimization effect matching table.
[0116] The first or second operating pressure score deviation value is used as the unique query key and input into a pre-built operating pressure score deviation-monitoring duration matching table. This operating pressure score deviation-monitoring duration matching table has a built-in mapping relationship between different operating pressure score deviation value ranges and corresponding monitoring durations. Its mapping logic is preset based on the correlation analysis results of the deviation value magnitude and the time required for the operating state to stabilize after parameter adjustment in historical parameter adjustment data. The larger the first or second operating pressure score deviation value, the greater the gap between the current operating state and the ideal state, and the longer the system needs to reach a stable operating state after parameter adjustment, so the matched monitoring duration is longer. The smaller the first or second operating pressure score deviation value, the shorter the time required for the system to stabilize, and the matched monitoring duration is correspondingly shortened. During the query, the specific interval to which the input deviation value belongs is first determined by the interval matching algorithm integrated in the table. Then, the preset monitoring duration data associated with that interval is called to complete the query of the monitoring duration. This monitoring duration will serve as the time benchmark for subsequent re-analysis of the operating pressure score, ensuring that the obtained operating pressure score can accurately reflect the stability effect after parameter adjustment and avoiding misjudgment of the adjustment effect due to insufficient monitoring time.
[0117] When querying the ideal variation range of the operating pressure score from the operating pressure score deviation-ideal optimization effect matching table using either the first or second operating pressure score deviation as the query key, the corresponding scenario for the query key must first be clarified: when in a high-efficiency adjustment scenario, the query key is the first operating pressure score deviation; when in a low-load adjustment scenario, the query key is the second operating pressure score deviation. This operating pressure score deviation-ideal optimization effect matching table is constructed based on multi-round parameter adjustment experimental data. It contains a built-in mapping relationship between different deviation value ranges and the corresponding ideal variation range of the operating pressure score. The mapping logic follows the principle of positive correlation between deviation values and the ideal variation range of the operating pressure score; that is, the larger the deviation value, the greater the difference in operating pressure that needs to be reduced through parameter adjustment, and the larger the corresponding ideal variation range of the operating pressure score (the expected reduction / increase in operating pressure score after adjustment compared to before adjustment). Furthermore, the mapping coefficients under different adjustment scenarios (high efficiency / low load) have been experimentally calibrated to ensure that the ideal variation range of the operating pressure score conforms to the actual adjustment capability. During the query process, the determined first or second operating pressure score deviation value is input into the matching table as the core query key value. Through the preset interval matching rules in the table, the specific interval range to which the input deviation value belongs is first determined, and then the ideal change interval of the operating pressure score associated with the interval is extracted. This interval is the core basis for judging whether the parameter optimization and adjustment effect meets the standard, and is used to distinguish the second execution path of the subsequent CAD path finding algorithm connection program.
[0118] Based on the monitoring duration, the operational pressure score is re-analyzed and recorded as the first operational pressure score.
[0119] If the first operating pressure score is less than the operating pressure score after low load adjustment, or greater than the operating pressure score during high efficiency adjustment, then the second execution path of the CAD pathfinding algorithm connection program is recorded as the command to generate the rollback mechanism, and a warning message is generated simultaneously.
[0120] In this embodiment, the core objective of low-load adjustment is to reduce the operational pressure of the CAD pathfinding algorithm connection program (e.g., reducing memory usage and computational power consumption). If the first operational pressure score after adjustment is less than the operational pressure score before adjustment, it indicates that the adjustment is excessive. This not only fails to achieve the goal of moderately reducing load and ensuring stability, but also leads to excessively low operational pressure, resulting in idle system resources and decreased program efficiency (e.g., insufficient single-frame primitive processing and slower drawing speed). The core objective of high-efficiency adjustment is to improve program efficiency and fully utilize idle resources. If the first operational pressure score after adjustment is greater than the operational pressure score before adjustment, it indicates that the adjustment direction deviates from expectations and actually increases operational pressure (e.g., longer single-frame drawing update time and increased UI thread blocking time), potentially causing program lag and response delays. Both situations indicate that the current working parameter optimization adjustment scheme is unreasonable, requiring a rollback mechanism to restore the state before adjustment. Simultaneously, a warning message is generated to prevent further impact of improper adjustment on subsequent program operation.
[0121] If the first operating pressure score is not less than the operating pressure score after low-load adjustment, or if the first operating pressure score is not greater than the operating pressure score during high-efficiency adjustment, then the deviation value of the third operating pressure score is obtained.
[0122] In this embodiment, if it is a low-load adjustment, the third operating pressure score deviation value is the result of subtracting the operating pressure score from the first operating pressure score; if it is a high-efficiency adjustment, the third operating pressure score deviation value is the result of subtracting the first operating pressure score from the operating pressure score.
[0123] In this embodiment, the first operating pressure score after low-load adjustment is not less than the operating pressure score before adjustment, indicating that the adjustment did not result in excessive load reduction, the operating pressure was not too low due to adjustment, and system resources were not unnecessarily idle, which is in line with the adjustment direction of reducing the load to a reasonable range and ensuring stable program operation. Similarly, the first operating pressure score after high-efficiency adjustment is not greater than the operating pressure score before adjustment, indicating that the adjustment did not cause an abnormal increase in operating pressure, and did not trigger risks such as system resource overload or program lag, which is in line with the adjustment goal of improving efficiency without increasing additional load. Both cases indicate that the current direction of optimizing the working parameters is basically reasonable, and there is no adverse deterioration problem, providing a basis for further quantitative evaluation of the adjustment effect. Therefore, it is necessary to calculate the deviation value of the third operating pressure score to determine whether the adjustment effect has reached the ideal standard.
[0124] If the deviation value of the third operating pressure score is not within the ideal variation range of the operating pressure score, then the second execution path of the CAD pathfinding algorithm connection program is recorded as a slight adjustment.
[0125] If the deviation value of the third operating pressure score is not within the ideal range of operating pressure score variation at this time, there are two possibilities: First, if the deviation value of the third operating pressure score is too small, it means that the adjustment effect has not met expectations. In low-load adjustment, a small deviation value indicates that the operating pressure reduction is insufficient, the system is still under high load, and there may be a risk of lag. In high-efficiency adjustment, a small deviation value indicates that the operating pressure increase is insufficient, idle system resources are not fully utilized, and program operating efficiency is not effectively improved. Second, if the deviation value of the third operating pressure score is too large, it also does not meet the adjustment requirements. In low-load adjustment, a large deviation value indicates that the operating pressure has been reduced excessively. Although it alleviates the load problem, it leads to serious idle system resources and a significant decrease in program operating efficiency. In high-efficiency adjustment, a large deviation value indicates that the operating pressure has been increased excessively. Although idle resources are utilized, it may exceed the system's capacity limit, causing new risks of lag and delay. Whether the deviation value of the third operating pressure score is too small or too large, it indicates that the current adjustment effect does not meet the preset standard. The second execution path of the CAD pathfinding algorithm connection program should be recorded as a slight adjustment. By further optimizing the working parameters, the deviation value can be brought closer to the ideal change range, so as to achieve the match between the adjustment effect and the operating requirements.
[0126] If the deviation value of the third operating pressure score is within the ideal variation range of the operating pressure score, then the second execution path of the CAD pathfinding algorithm connection program is recorded as the signal for generating adjustment completion, the parameter settings for this operation are recorded, and written to the configuration cache.
[0127] If the deviation value of the third operating pressure score is within the ideal range of the operating pressure score at this time, it indicates that the effect of the current optimization and adjustment of the working parameters fully meets the expected standards. In low-load adjustment, the deviation value of the third operating pressure score being within the ideal range means that the reduction in operating pressure is moderate, and the system load has been reduced to a reasonable range, which alleviates the risks of lag and delay, and avoids excessive resource idleness. In high-efficiency adjustment, the deviation value of the third operating pressure score being within the ideal range means that the increase in operating pressure is reasonable, which makes full use of the idle system resources, significantly improves the program's operating efficiency, and does not exceed the system's capacity limit, ensuring the stable operation of the program. At this time, there is no need to continue parameter adjustment, and it can be determined that the current optimization and adjustment task is completed. Therefore, the second execution path of the CAD pathfinding algorithm connection program is recorded as the signal for generating the adjustment completion signal. At the same time, the working parameters of this adaptation are recorded and written to the configuration cache, providing data support for quickly calling the matching parameters when processing CAD files of the same complexity in the future. This improves the efficiency of parameter setting and ensures the stability and consistency of program operation.
[0128] Further, minor adjustments were made, and the specific execution process is as follows:
[0129] If the deviation value of the third operating pressure score is less than the lower limit of the ideal variation range of the operating pressure score, then the first regulation effect characterization factor is obtained by subtracting the deviation value of the third operating pressure score from the lower limit of the ideal variation range of the operating pressure score.
[0130] For high-efficiency adjustments, the first adjustment effect is used as the characterization factor. The set of adjustment values is supplemented by querying the number of elements in the batch plot, and then a slight fine-tuning is performed.
[0131] The set of batch plotting element quantity adjustment values includes the batch plotting element quantity supplementary adjustment values of the orthogonal algorithm and the batch plotting element quantity supplementary adjustment values of the Dijkstra algorithm.
[0132] The core objective of high-efficiency adjustment is to fully utilize idle resources and improve program efficiency. If the deviation value of the third running pressure score is too small, it indicates that the increase in running pressure after adjustment is insufficient, and the system still has unused idle resources (such as a small number of primitives processed per frame or slow drawing speed). In this case, it is necessary to slightly increase the number of drawing elements. By appropriately increasing the scale of primitives processed per load by the algorithm (e.g., from 50 to 60 primitives per load), the resource consumption intensity per unit time can be increased without causing system overload, quickly narrowing the gap between the deviation value and the ideal range, thus achieving efficiency improvement.
[0133] For low-load adjustments, the set of adjustment values for reducing the number of plotted elements is queried using the second adjustment effect characterization factor as the query key, thereby performing a slight fine-tuning.
[0134] The core objective of low-load adjustment is to reduce system load and prevent program lag. If the deviation value of the third running pressure score is too small, it indicates that the reduction in running pressure after adjustment is insufficient, and the system is still under high load (e.g., high memory usage, high computing power consumption). In this case, it is necessary to slightly reduce the number of batch drawing elements. By appropriately reducing the scale of primitives processed per batch (e.g., from 70 primitives to 60), resource consumption per unit time can be quickly reduced, the gap between the deviation value and the ideal range can be narrowed, and the load pressure can be alleviated.
[0135] The set of batch plotting element number adjustment values includes batch plotting element number reduction adjustment values for the orthogonal algorithm and batch plotting element number reduction adjustment values for the Dijkstra algorithm.
[0136] If the deviation value of the third operating pressure score is greater than the upper limit of the ideal variation range of the operating pressure score, then the second regulation effect characterization factor is obtained by subtracting the upper limit of the ideal variation range of the operating pressure score from the deviation value of the third operating pressure score.
[0137] For high-efficiency adjustment, the second adjustment effect characterization factor is used as the query key value to query the set of adjustment values for reducing the number of plot elements in the batch, thereby performing a slight fine-tuning.
[0138] If the deviation value of the third running pressure score is too large at this time, it indicates that the running pressure has been increased excessively after adjustment. Although idle resources have been utilized, it may be close to the system's capacity limit (such as high memory usage and risk of lag). At this time, it is necessary to slightly reduce the number of batch drawing elements. By appropriately reducing the scale of elements processed in a single batch, the resource consumption intensity can be reduced while retaining some efficiency improvement results, so that the deviation value falls back to the ideal range, balancing efficiency and stability.
[0139] For low-load adjustments, the second adjustment effect characterization factor is used as the query key to query the set of adjustment values for the increase or decrease of the number of elements in the batch plot, thereby performing a slight fine-tuning.
[0140] If the deviation value of the third operating pressure score is too large at this time, it indicates that the operating pressure has been reduced excessively after adjustment. Although the load problem has been solved, it has led to serious idle system resources (such as a small number of primitives processed per frame and slow drawing speed). At this time, it is necessary to slightly increase the number of drawing elements in a batch. By appropriately increasing the scale of primitives processed per batch, the operating efficiency can be improved by utilizing idle resources without causing a load rebound, so that the deviation value returns to the ideal range.
[0141] like Figure 2 The diagram shown is a structural diagram of the operation analysis system for the CAD pathfinding algorithm connection program. The system includes: an initial working parameter optimization setting module, a first execution path determination module, and a second execution path determination module.
[0142] The initial working parameter optimization setting module is used to denote the CAD file of the CAD pathfinding algorithm connection program to be executed as the target execution file, construct a static complexity scoring function, output the static complexity score of the target execution file, and optimize the initial working parameters of the CAD pathfinding algorithm connection program based on the static complexity score of the target execution file before executing the CAD pathfinding algorithm connection program.
[0143] The first execution path determination module is used to execute the CAD routing algorithm connection program based on the initial working parameters of the CAD routing algorithm connection program. During the execution process, it monitors the running pressure of the CAD routing algorithm connection program in real time, constructs a running pressure scoring function, outputs the running pressure score, and thus determines the first execution path of the CAD routing algorithm connection program.
[0144] The second execution path determination module is used to perform the working parameter optimization adjustment of the CAD path finding algorithm connection program in a preset parameter adjustment order when the first execution path of the CAD path finding algorithm connection program is to perform working parameter optimization adjustment, and to analyze the adjustment effect after each optimization adjustment, thereby determining the second execution path of the CAD path finding algorithm connection program.
[0145] In a specific embodiment, taking a floor plan as an example, the purpose of this floor plan is to connect the camera and the cabinet to the main line (blue line in the diagram), such as... Figure 4 This is a floor plan of the CAD routing algorithm connection program involved in this embodiment of the invention, showing the camera and cabinet connected to the main line, and the effect after the connection requirements are met. Figure 5 The diagram shows the file layout after automatic wiring in this embodiment of the invention. Some cameras need to be connected to the main line at right angles. After automatic wiring, the cameras need to find the shortest path within the cabinet using the already connected branch lines (green lines in the diagram) and the main line. The result after automatic pathfinding is as follows: Figure 6 The image shows the file layout after automatic pathfinding, as described in this embodiment of the invention.
[0146] The above embodiments can be implemented, in whole or in part, by software, hardware (such as circuits), 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. A 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 flow or function according to the embodiments of the present invention is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. Computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, 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. A 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. Available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media. Semiconductor media can be solid-state drives.
[0147] It should be understood that the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. A and B can be singular or plural. Additionally, the character " / " in this article generally indicates an "or" relationship between the preceding and following related objects, but it can also represent an "and / or" relationship. Please refer to the context for a more accurate understanding.
[0148] In this invention, "at least one" means one or more, and "more than one" means two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of a single item or a plurality of items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, and c can be a single item or multiple items.
[0149] It should be understood that, in various embodiments of the present invention, the order of the above-mentioned process numbers does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0150] Those skilled in the art will recognize that the units 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 implementations should not be considered beyond the scope of this invention.
[0151] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the devices, apparatuses, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0152] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0153] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part 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 of the various embodiments of this invention. 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.
[0154] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention 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 the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for analyzing the operation of a CAD pathfinding algorithm connection program, characterized in that, Includes the following steps: The CAD file to be executed in the CAD pathfinding algorithm connection program is denoted as the target execution file. A static complexity scoring function is constructed to output the static complexity score of the target execution file. Before executing the CAD pathfinding algorithm connection program, the initial working parameters of the CAD pathfinding algorithm connection program are optimized based on the static complexity score of the target execution file. The CAD routing algorithm connection program is executed based on the initial working parameters of the CAD routing algorithm connection program. During the execution, the running pressure of the CAD routing algorithm connection program is monitored in real time, a running pressure scoring function is constructed, and the running pressure score is output, thereby determining the first execution path of the CAD routing algorithm connection program. When the first execution path of the CAD routing algorithm connection program is to optimize and adjust the working parameters, the working parameters of the CAD routing algorithm connection program are optimized and adjusted in a preset parameter adjustment order. After each optimization and adjustment is completed, the adjustment effect is analyzed, thereby determining the second execution path of the CAD routing algorithm connection program.
2. The method for analyzing the operation of a CAD pathfinding algorithm connection program according to claim 1, characterized in that, The process of constructing the static complexity scoring function and outputting the static complexity score of the target executable file is as follows: The number of blocks, total number of primitives, number of main lines and number of endpoints are compared with their corresponding reference values. A complexity allocation coefficient is introduced to perform weighted coupling processing on the comparison results. The weighted coupling processing results are combined with the primitive type weight for coupling processing, thereby constructing a static complexity scoring function. Obtain the number of blocks, total number of primitives, number of trunk lines, number of endpoints, and primitive type weights of the target executable file, and input them as input data into the static complexity scoring function to output the static complexity score of the target executable file; The static complexity score of the target executable file is a quantitative representation of the execution complexity of the target executable file, which is composed of the number of blocks, the total number of primitives, the number of trunk lines, the number of endpoints, and the primitive type weight.
3. The method for analyzing the operation of a CAD pathfinding algorithm connection program according to claim 2, characterized in that, The initial working parameters of the CAD pathfinding algorithm connection program are optimized based on the static complexity score of the target executable file. The specific analysis process is as follows: Using the static complexity score of the target executable file as the query key, query the historical cache. If a historical cache exists, use the working parameters corresponding to the static complexity score of the target executable file stored in the historical cache as the initial working parameters of the CAD pathfinding algorithm connection program. If no historical cache exists, the static complexity score of the target executable file is used as the query key to query the working parameters from the static complexity score-working parameter setting matching table, and the working parameters are recorded as the initial working parameters of the CAD pathfinding algorithm connection program. The initial working parameters of the CAD pathfinding algorithm connection program include the initial working parameters of the orthogonal algorithm and the initial working parameters of the Dijkstra algorithm. The initial working parameters of the orthogonal algorithm include the path merging tolerance and the number of batch drawing elements; The initial operating parameters of the Dijkstra algorithm include the graphics refresh interval, path merging tolerance, and number of batch drawing elements.
4. The method for analyzing the operation of a CAD pathfinding algorithm connection program according to claim 3, characterized in that, The initial working parameters of the CAD routing algorithm connection program are executed by the CAD routing algorithm connection program. The specific execution process is as follows: A1. Analyze the primitives of the target executable file and construct the connection relationship diagram; A2, based on the orthogonal connection algorithm, generates orthogonal paths, ensuring that the connecting lines conform to the horizontal-vertical polyline rule, and automatically avoids obstacles and avoids overlapping connections; A3, based on Dijkstra's algorithm, performs shortest path search in the constructed connection graph and selects the optimal path according to preset rules; A4 converts the generated optimal path into a CAD-drawable graphic element, thereby drawing the optimal path onto the drawing.
5. The method for analyzing the operation of a CAD pathfinding algorithm connection program according to claim 1, characterized in that, The process of constructing the operational stress scoring function and outputting the operational stress score is as follows: The time consumed by drawing and updating a single frame, the number of primitives in a single frame, and the blocking time of the UI thread are compared with the corresponding reference values. Then, a pressure allocation factor is introduced to couple the results of each comparison, thereby constructing a runtime pressure scoring function. With a preset monitoring cycle, the single-frame drawing update time, single-frame primitive count, and UI thread blocking duration of the target executable file are obtained and used as input data to the runtime stress scoring function, thereby outputting the runtime stress score. The operational pressure score is a quantitative basis for the impact of single-frame drawing update time, single-frame primitive quantity, and UI thread blocking time on the operational pressure of the CAD pathfinding algorithm connection program.
6. The method for analyzing the operation of a CAD pathfinding algorithm connection program according to claim 5, characterized in that, The specific analysis process for determining the first execution path of the CAD pathfinding algorithm connection program is as follows: Extract the preset ideal range of operating pressure scores from the database; If the running stress score is within the ideal range of the running stress score, then the first execution path of the CAD pathfinding algorithm connection program is recorded as the pathfinding connection for continuing the target execution file; If the operational stress score is not within the ideal range, the first execution path of the CAD pathfinding algorithm connection program is recorded as the execution of operational parameter optimization adjustment. The direction information of operational parameter optimization adjustment is analyzed. The specific process is as follows: If the operating pressure score is lower than the lower limit of the ideal range for operating pressure scores, the direction of optimization adjustment of the working parameters will be recorded as high-efficiency adjustment. If the operating pressure score is higher than the upper limit of the ideal range for operating pressure scores, the direction information for optimizing the adjustment of operating parameters will be recorded as low load adjustment.
7. The method for analyzing the operation of a CAD pathfinding algorithm connection program according to claim 1, characterized in that, The specific analysis process for optimizing and adjusting the working parameters of the CAD routing algorithm connection program, which executes the preset parameter adjustment sequence, is as follows: During high-efficiency adjustment, the difference between the lower limit of the ideal range of the operating pressure score and the operating pressure score is processed to obtain the first operating pressure score deviation value; During low-load adjustment, the difference between the operating pressure score and the upper limit of the ideal range of the operating pressure score is used to obtain the second operating pressure score deviation value; Using the first operating pressure score deviation value or the second operating pressure score deviation value as the query key, the set of optimized operating parameters is obtained from the operating pressure score deviation-operating parameter adjustment matching table; The set of working parameter optimization adjustments includes the set of working parameter optimization adjustments for orthogonal algorithms and the set of working parameter optimization adjustments for Dijkstra's algorithm. The orthogonal algorithm working parameter optimization and adjustment set includes the batch drawing element number optimization adjustment value, path merging tolerance optimization adjustment value, and algorithm backoff threshold optimization adjustment value of the orthogonal algorithm; The set of optimized and adjusted working parameters for the Dijkstra algorithm includes optimized adjustment values for the number of batch drawing elements, path merging tolerance, graphics refresh interval, and algorithm rollback threshold. The working parameters of the CAD routing algorithm connection program are optimized and adjusted based on the preset parameter adjustment sequence and the set of working parameters.
8. The method for analyzing the operation of a CAD pathfinding algorithm connection program according to claim 1, characterized in that, After each optimization adjustment, the adjustment effect is analyzed to determine the second execution path of the CAD pathfinding algorithm connection program. The specific analysis process is as follows: Using the first operating pressure score deviation value or the second operating pressure score deviation value as the query key, the monitoring duration is obtained from the operating pressure score deviation-monitoring duration matching table, and the ideal variation range of the operating pressure score is obtained from the operating pressure score deviation-ideal optimization effect matching table. Based on the monitoring duration, the operational pressure score was re-analyzed and recorded as the first operational pressure score. If the first operating pressure score is less than the operating pressure score after low load adjustment, or greater than the operating pressure score during high efficiency adjustment, then the second execution path of the CAD pathfinding algorithm connection program is recorded as the command to generate the rollback mechanism, and a warning message is generated simultaneously. If the first operating pressure score is not less than the operating pressure score after low load adjustment, or if the first operating pressure score is not greater than the operating pressure score during high efficiency adjustment, then the deviation value of the third operating pressure score is obtained. If the deviation value of the third operating pressure score is not within the ideal variation range of the operating pressure score, then the second execution path of the CAD pathfinding algorithm connection program is recorded as performing a slight fine-tuning. If the deviation value of the third operating pressure score is within the ideal variation range of the operating pressure score, then the second execution path of the CAD pathfinding algorithm connection program is recorded as the signal for generating adjustment completion, the parameter settings for this operation are recorded, and written to the configuration cache.
9. The method for analyzing the operation of a CAD pathfinding algorithm connection program according to claim 8, characterized in that, The process of performing minor adjustments is as follows: If the deviation value of the third operating pressure score is less than the lower limit of the ideal variation range of the operating pressure score, then the first regulation effect characterization factor is obtained by subtracting the deviation value of the third operating pressure score from the lower limit of the ideal variation range of the operating pressure score. For high-efficiency adjustments, the first adjustment effect is used as the characterization factor. The set of adjustment values is supplemented by querying the number of elements in the batch plot, and then a slight fine-tuning is performed. The set of batch plotting element quantity adjustment values includes the batch plotting element quantity supplementary adjustment values of the orthogonal algorithm and the batch plotting element quantity supplementary adjustment values of the Dijkstra algorithm. For low-load adjustments, the second adjustment effect characterization factor is used as the query key to query the set of adjustment values for reducing the number of plot elements in the batch, thereby performing a slight fine-tuning. The set of batch plotting element quantity adjustment values includes batch plotting element quantity reduction adjustment values of the orthogonal algorithm and batch plotting element quantity reduction adjustment values of the Dijkstra algorithm. If the deviation value of the third operating pressure score is greater than the upper limit of the ideal variation range of the operating pressure score, then the second regulation effect characterization factor is obtained by subtracting the upper limit of the ideal variation range of the operating pressure score from the deviation value of the third operating pressure score. For high-efficiency adjustment, the second adjustment effect characterization factor is used as the query key value to query the set of adjustment values for reducing the number of plot elements in the batch, thereby performing a slight fine-tuning; For low-load adjustments, the second adjustment effect characterization factor is used as the query key to query the set of adjustment values for the increase or decrease of the number of elements in the batch plot, thereby performing a slight fine-tuning.
10. A system for analyzing the operation of a CAD pathfinding algorithm connection program, used to implement the method for analyzing the operation of a CAD pathfinding algorithm connection program as described in any one of claims 1-9, characterized in that, The system includes: an initial working parameter optimization setting module, a first execution path determination module, and a second execution path determination module; The initial working parameter optimization setting module is used to record the CAD file of the CAD pathfinding algorithm connection program to be executed as the target execution file, construct a static complexity scoring function, output the static complexity score of the target execution file, and optimize the initial working parameters of the CAD pathfinding algorithm connection program based on the static complexity score of the target execution file before executing the CAD pathfinding algorithm connection program. The first execution path determination module is used to execute the CAD routing algorithm connection program based on the initial working parameters of the CAD routing algorithm connection program, and during the execution process, monitor the running pressure of the CAD routing algorithm connection program in real time, construct a running pressure scoring function, output the running pressure score, and thereby determine the first execution path of the CAD routing algorithm connection program. The second execution path determination module is used to perform the working parameter optimization adjustment of the CAD path finding algorithm connection program in a preset parameter adjustment order when the first execution path of the CAD path finding algorithm connection program is to perform working parameter optimization adjustment, and to analyze the adjustment effect after each optimization adjustment, thereby determining the second execution path of the CAD path finding algorithm connection program.
Citation Information
Patent Citations
Static and runtime analysis of computer program systems
CN114207594B
LLVM-based Program Static Analysis Method and System
CN119883861B
Circuit diagram fusion loading method and device, equipment and storage medium
CN116451637A
Computing task scheduling method and system applied to numerical control machining system
CN120355196A
