Parametric graph automatic correction system based on constraint satisfaction analysis

The parameterized automatic graphic correction system based on constraint satisfaction analysis solves the problems of low efficiency and poor accuracy of manual adjustment by users in the existing technology, and realizes automated and intelligent graphic correction, adapting to high-precision correction in complex scenarios and user-friendly interaction.

CN122199722APending Publication Date: 2026-06-12MEIDENG KEJI

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
MEIDENG KEJI
Filing Date
2026-03-16
Publication Date
2026-06-12

Smart Images

  • Figure CN122199722A_ABST
    Figure CN122199722A_ABST
Patent Text Reader

Abstract

The application discloses a parameterized graph automatic correction system based on constraint satisfaction analysis and belongs to the technical field of parameterized graph processing. The system comprises the following modules: an input and semantic analysis module, a parameter and object model module, a constraint modeling and constraint library module, a constraint satisfaction analysis module, a conflict positioning and responsibility attribution module, an automatic correction strategy module, a solving and optimization module, a verification and rollback module, an interaction and visual feedback module, and a log and learning module. The system can automatically correct constraint violations without manual adjustment of the user, solve the problem of low efficiency caused by traditional manual operation, adapt to complex scenes, and improve accuracy. The system supports multiple types of constraints such as collinearity, perpendicularity and equal length, can realize high-precision correction of complex geometric figures through quantitative satisfaction analysis and accurate conflict positioning, and avoids the limitation of rough correction of single constraints.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of parametric graphics processing technology, and in particular to a parametric graphics automatic correction system based on constraint satisfaction analysis. Background Technology

[0002] In parametric graphic editing scenarios (such as CAD drawing and geometric modeling tools), users can easily break preset geometric constraints (such as points on circles, two line segments of equal length, and perpendicular lines) when editing graphics by dragging and modifying parameters. In existing technologies, correction of constraint violations mainly relies on manual adjustments by the user, which is inefficient and inaccurate. Some simple correction systems can only achieve coarse correction of single constraints, lacking a systematic constraint satisfaction quantification analysis and precise conflict parameter location mechanism. Furthermore, they have not constructed a complete "analysis-analysis-location-correction-verification" process, making them unable to adapt to the automatic correction needs of complex geometric scenarios, resulting in a low level of automation and intelligence in graphic editing. Summary of the Invention

[0003] Purpose of the invention: The purpose of this invention is to provide a parametric automatic graphic correction system based on constraint satisfaction analysis; it can solve the problems of low efficiency and poor accuracy of existing systems that rely on manual adjustment.

[0004] Technical solution: To solve the above-mentioned technical problems, according to one aspect of the present invention, more specifically, a parametric graphical automatic correction system based on constraint satisfaction analysis, comprising: an input and semantic parsing module, a parameter and object model module, a constraint modeling and constraint library module, a constraint satisfaction analysis module, a conflict location and responsibility attribution module, an automatic correction strategy module, a solution and optimization module, a verification and rollback module, an interactive and visual feedback module, and a log and learning module; Input and semantic parsing module: used to receive graphical descriptions and parse them into internal structures. Specifically, it parses DSL / AST / JSON to generate object and parameter tables, validates references / types / parameter ranges, and standardizes units / coordinate systems. The parameter and object model module is used for unified management of geometric objects and parameter dependencies. Constraint Modeling and Constraint Library Module: Used to convert geometric relations into computable constraints; Constraint Satisfaction Analysis Module: Used to calculate the satisfaction of each constraint and the global index; Conflict location and responsibility attribution module: used to locate the parameters that cause constraint violations; Automatic correction strategy module: used to determine the correction parameters, magnitude, and priority; Solving and Optimization Module: Used to solve for parameters to minimize constraint residuals; Verification and rollback module: Used to ensure that the correction results are available and support rollback; Interactive and visual feedback module: used to explain the location of constraint violations and the correction method; Log and Learning Module: Used to record the correction process and optimize subsequent strategies.

[0005] Furthermore, when the parameter and object model module uniformly manages geometric objects and parameter dependencies, it maintains an object table containing Point / Line / Circle / Segment categories, marks parameter types as adjustable / locked / derived, and constructs a directed acyclic graph (DAG) of parameter dependencies.

[0006] Furthermore, when the constraint modeling and constraint library module converts geometric relationships into computable constraints, it constructs a constraint library containing collinear / perpendicular / equal length / equal angle / tangent types, compiles constraints into residual functions r(p), and defines the weight / tolerance / priority / soft and hard constraint metadata of the constraints. The construction of the residual function includes: The residual function of a point on a circle is: |OP| - r = 0, where O is the center of circle C, r is the radius of circle C, and P is the target point; The residual function for two line segments of equal length is: |AB| - |CD| = 0, where AB and CD are the target line segments; The residual function of two perpendicular lines is: A1A2 + B1B2 = 0, where A1 and B1 are the coefficients of line L1, and A2 and B2 are the coefficients of line L2.

[0007] Furthermore, when the constraint satisfaction analysis module calculates the satisfaction of each constraint and the global index, it calculates the residual r_i of each constraint; normalization: e_i=|r_i| / tol_i; satisfaction: s_i=1 / (1+e_i) or exp(-e_i); global score: S=Σ(w_i*s_i) / Σ(w_i).

[0008] Furthermore, when the conflict location and responsibility attribution module locates the parameters that cause constraint violations, it calculates the Jacobian matrix J=∂r / ∂p, evaluates the parameter contribution and sensitivity according to |J|, and approximates the solution of the minimum conflict set (MUS) or Top-K responsibility parameters.

[0009] Furthermore, when the automatic correction strategy module determines the parameters, magnitude, and priority of the correction, it prioritizes keeping the locked parameters unchanged and correcting the adjustable parameters, constructs a cost function L2 / L1 weighted to minimize the parameter changes, and outputs a candidate parameter set plus an initial correction direction.

[0010] Furthermore, when the solution and optimization module solves the parameters to minimize the constraint difference, it employs the nonlinear least squares algorithm Gauss-Newton / LM, incorporates upper and lower bounds for the parameters and a geometrically feasible interval, and uses the previous solution as the initial value during incremental solving.

[0011] Furthermore, the verification and rollback module ensures that the correction results are available and supports rollback by recalculating the global satisfaction S and comparing it with the threshold, rolling back to the previous stable snapshot when hard constraints are violated, and saving historical snapshots to support undo operations.

[0012] Furthermore, when the interactive and visual feedback module explains the location and correction method of constraint violation, it highlights the geometric object or edge that violates the constraint, displays correction suggestions, and displays a satisfaction progress bar and error value.

[0013] Furthermore, when the log and learning module records the correction process and optimizes subsequent strategies, it records parameter changes, time consumption, and satisfaction changes, analyzes high-frequency conflict types, and adjusts weights and strategies.

[0014] Beneficial effects: Automated correction and improved efficiency: The system automatically corrects constraint violations without requiring manual adjustments by the user, solving the problems of traditional manual reliance and low efficiency.

[0015] Adapt to complex scenarios and improve accuracy: Supports multiple types of constraints such as collinearity, perpendicularity, and equal length. Through quantitative satisfaction analysis and precise conflict location, it achieves high-precision correction of complex geometric figures and avoids the limitations of coarse correction of single constraints.

[0016] A complete closed-loop process ensures reliability: The entire process of "parsing-analysis-location-correction-verification" is constructed, coupled with a rollback mechanism and snapshot saving, to ensure that the correction results are available and can be undone, reducing operational risks.

[0017] User-friendly interface and continuous optimization: Visual feedback clearly identifies the location of constraint violations and the correction method. The log learning module can accumulate high-frequency conflict types, dynamically adjust strategies, and improve the adaptability of subsequent corrections. Attached Figure Description

[0018] Figure 1 This is a schematic diagram of the system principle. Detailed Implementation

[0019] To make the technical solution of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0020] Execution process of each module in the system 1. Input and Semantic Parsing Module Receive the user-edited graphic description (JSON format), which includes geometric object information: rectangle ABCD (vertices A(1,2), B(4,3), C(5,6), D(2,5)), and inscribed circle O (center (3,4), radius 1.5). Parse and generate object tables (Point class: A / B / C / D / O; Line class: AB / BC / CD / DA; Circle class: O) and parameter tables (vertex coordinates, circle radius, etc.); Verify parameter range (coordinate values ​​conform to the tool coordinate system [0, 10] range, no invalid references); Standardized unit (uniformly "centimeter", coordinate system follows the tool's default Cartesian coordinate system).

[0021] 2. Parameters and Object Model Module Maintain the object table: clearly define the category of Point / Line / Circle / Segment, where the four sides of the rectangle belong to the Segment category (AB / BC / CD / DA). Mark parameter types: Circle radius (1.5cm) is set to "Locked" (user-specified and cannot be modified), rectangle vertex coordinates (x / y values ​​of A / B / C / D) are set to "Adjustable", no "Derived parameters"; Construct a parameter-dependent DAG: vertex coordinates → rectangle side length / angle → tangency relationship between circle and rectangle, with no circular dependencies.

[0022] 3. Constraint Modeling and Constraint Library Module Call the constraint library: Select three types of constraints: "Equal length" (opposite sides of rectangle AB=CD, BC=DA), "Perpendicular" (adjacent sides of rectangle AB⊥BC, BC⊥CD, etc.), and "Tangent" (circle O is tangent to the four sides AB / BC / CD / DA); Define constraint metadata: hard constraints (perpendicular, tangent, weight w=2.0, tolerance tol=0.01), soft constraints (equal length, weight w=1.0, tolerance tol=0.05); Compile residual functions: Equal length constraint (AB=CD): r1=|AB| - |CD|, where |AB|=√[(4-1)] 2 +(3-2) 2 ]=√10≈3.16, |CD|=√[(2-5) 2 +(5-6) 2 =√10≈3.16 (Initially no deviation, changes after dragging). Vertical constraint (AB⊥BC): r2=A1A2 + B1B2, the equation of line AB is x-3y+5=0 (A1=1, B1=-3), the equation of line BC is x+y-7=0 (A2=1, B2=1), r2=1×1 + (-3)×1=-2≠0 (constraint violated); Tangency constraint (circle O is tangent to AB): r3 = |distance from O to AB| - radius, distance from O to AB = |3 - 12 + 5| / √(1 + 9) = 4 / √10 ≈ 1.26 ≠ 1.5 (violation of constraint).

[0023] 4. Constraint Satisfaction Analysis Module Calculate the constraint residual: r1=0 (After dragging, AB becomes √[(5-1)]) 2 +(4-2) 2 =√20≈4.47, CD is still √10≈3.16, r1=4.47-3.16=1.31), r2=-2, r3=1.26-1.5=-0.24; Normalization: e1 = |1.31| / 0.05 = 26.2, e2 = |-2| / 0.01 = 200, e3 = |-0.24| / 0.01 = 24; Satisfaction rate calculation: using s_i=1 / (1+e_i), s1=1 / (1+26.2)≈0.037, s2=1 / (1+200)≈0.005, s3=1 / (1+24)=0.04; Global score: S=(1.0×0.037 + 2.0×0.005 + 2.0×0.04) / (1.0+2.0+2.0)=(0.037+0.01+0.08) / 5≈0.025 (far below the threshold of 0.8, needs correction).

[0024] 5. Conflict Location and Responsibility Attribution Module Calculate the Jacobian matrix J = ∂r / ∂p, where p is an adjustable parameter (x / y value of A / B / C / D), for example ∂r2 / ∂Ax (x coordinate of point A) = ∂(A1A2+B1B2) / ∂Ax. Through geometric derivation, the absolute value of the corresponding element in J is 0.86. The contribution of the parameter was evaluated according to |J|: the y coordinate of point B (modified to 4) had the highest contribution (|J|=1.2), followed by the x coordinate of point C (modified to 6) (|J|=1.0). Solving for the Minimum Conflict Set (MUS): The core responsibility parameters for locating the point are the y-coordinate of point B and the x-coordinate of point C (modifying either of these would result in simultaneous violations of perpendicularity, equal length, and tangency constraints).

[0025] 6. Automatic calibration strategy module Priority rule: Keep the circle radius (locked parameter) unchanged, and only adjust the adjustable parameters of the rectangle vertices; Constructing the cost function: Using L2 weighting, the objective is to minimize the parameter changes, i.e., min(ΔB.y). 2 + ΔC.x 2(Δ is the parameter correction amount); Output candidate parameter set: y coordinate of point B, x coordinate of point C, with the initial correction direction being decreasing By (from 4→3.2) and decreasing Cx (from 6→4.8).

[0026] 7. Solving and Optimization Module The nonlinear least squares algorithm LM (Levenberg-Marquardt) is used, with the initial correction direction and upper and lower bounds of the parameters as input (the vertex coordinates are still in the range of [0, 10]). Incremental solution: Using the parameters from the previous edit as initial values, iteratively calculate the parameter combination that minimizes the constraint residuals; Iteration results: The y-coordinate of point B is corrected to 3.1, and the x-coordinate of point C is corrected to 4.9. At this point, r1 = |√[(5-1)] 2 +(3.1-2) 2 ] - √[(2-4.9) 2 +(5-6) 2 ]|≈|4.15-1.97|=2.18→ Gradually converge to r1=0.02; r2=0.008; r3=0.009.

[0027] 8. Verification and Rollback Module Recalculate the global satisfaction score: S = (1.0 × (1 / (1+0.02 / 0.05)) + 2.0 × (1 / (1+0.008 / 0.01)) + 2.0 × (1 / (1+0.009 / 0.01))) / 5 ≈ (1.0 × 0.71 + 2.0 × 0.5 + 2.0 × 0.51) / 5 ≈ (0.71 + 1.0 + 1.02) / 5 ≈ 0.546 (still below the threshold, continue iterating); After the second optimization: point B y=3.0, point C x=4.5, global score S≈0.92 (higher than the threshold of 0.8); Verify hard constraints: The residuals of both vertical and tangent constraints are less than the tolerance of 0.01, indicating no violation and no need for rollback; save the current parameter snapshot (version V2).

[0028] 9. Interactive and Visual Feedback Module Highlighting: In the CAD interface, mark the edges AB and BC that violate the constraints, as well as the point of tangency between circle O and AB, with a red dashed box; Suggested fix: A pop-up message box should appear stating "The position of the rectangle vertices has been automatically corrected, restoring the constraints of equal side length, perpendicular adjacent sides, and tangency between the circle and the four sides." Data display: The progress bar for satisfaction is shown (92%), and the values ​​of each constraint error are marked (equal length error 0.01cm, perpendicularity error 0.007, tangency error 0.008).

[0029] 10. Log and Learning Module Record the calibration process: parameter changes (By from 4→3.0, Cx from 6→4.5), calibration time 0.3 seconds, satisfaction rate from 0.025→0.92; Analysis of conflict types: "Drag of rectangle vertices causes multiple constraints to be violated simultaneously" is marked as a high-frequency conflict (this is the 12th time this type has been triggered). Optimization strategy: Adjust the constraint weight of this type of conflict, increase the "tangent" constraint weight from 2.0 to 2.5, and prioritize tangent accuracy when encountering similar conflicts in the future.

[0030] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.

Claims

1. A parametric automatic graphic correction system based on constraint satisfaction analysis, characterized in that, include: The module includes: Input and Semantic Parsing, Parameter and Object Model, Constraint Modeling and Constraint Library, Constraint Satisfaction Analysis, Conflict Location and Responsibility Attribution, Automatic Correction Strategy, Solving and Optimization, Verification and Rollback, Interactive and Visual Feedback, and Log and Learning. Input and semantic parsing module: used to receive graphical descriptions and parse them into internal structures. Specifically, it parses DSL / AST / JSON to generate object and parameter tables, validates references / types / parameter ranges, and standardizes units / coordinate systems. The parameter and object model module is used for unified management of geometric objects and parameter dependencies. Constraint Modeling and Constraint Library Module: Used to convert geometric relations into computable constraints; Constraint Satisfaction Analysis Module: Used to calculate the satisfaction of each constraint and the global index; Conflict location and responsibility attribution module: used to locate the parameters that cause constraint violations; Automatic correction strategy module: used to determine the correction parameters, magnitude, and priority; Solving and Optimization Module: Used to solve for parameters to minimize constraint residuals; Verification and rollback module: Used to ensure that the correction results are available and support rollback; Interactive and visual feedback module: used to explain the location of constraint violations and the correction method; Log and Learning Module: Used to record the correction process and optimize subsequent strategies.

2. The parameterized automatic graphic correction system based on constraint satisfaction analysis according to claim 1, characterized in that: When the parameter and object model module manages geometric objects and parameter dependencies in a unified manner, it maintains an object table containing Point / Line / Circle / Segment categories, marks parameter types as adjustable / locked / derived, and constructs a directed acyclic graph (DAG) of parameter dependencies.

3. The parameterized automatic graphic correction system based on constraint satisfaction analysis according to claim 1, characterized in that: When the constraint modeling and constraint library module converts geometric relationships into computable constraints, it constructs a constraint library containing collinear / perpendicular / equal length / equal angle / tangent types, compiles constraints into residual functions r(p), and defines the weight / tolerance / priority / soft and hard constraint metadata of the constraints. The construction of the residual function includes: The residual function of a point on a circle is: |OP| - r = 0, where O is the center of circle C, r is the radius of circle C, and P is the target point; The residual function for two line segments of equal length is: |AB| - |CD| = 0, where AB and CD are the target line segments; The residual function of two perpendicular lines is: A1A2 + B1B2 = 0, where A1 and B1 are the coefficients of line L1, and A2 and B2 are the coefficients of line L2.

4. The parameterized automatic graphic correction system based on constraint satisfaction analysis according to claim 1, characterized in that: When the constraint satisfaction analysis module calculates the satisfaction of each constraint and the global index, it also calculates the residual r_i of each constraint. Normalization: e_i=|r_i| / tol_i; Satisfaction: s_i=1 / (1+e_i) or exp(-e_i); Global score: S=Σ(w_i*s_i) / Σ(w_i).

5. The parameterized automatic graphic correction system based on constraint satisfaction analysis according to claim 1, characterized in that: When the conflict location and responsibility attribution module locates the parameters that cause constraint violations, it calculates the Jacobian matrix J=∂r / ∂p, evaluates the parameter contribution and sensitivity according to |J|, and approximates the solution of the minimum conflict set MUS or Top-K responsibility parameters.

6. The parameterized automatic graphic correction system based on constraint satisfaction analysis according to claim 1, characterized in that: When the automatic correction strategy module determines the parameters, magnitude, and priority of the correction, it prioritizes keeping the locked parameters unchanged and correcting the adjustable parameters, constructs a cost function L2 / L1 weighted to minimize the parameter changes, and outputs a candidate parameter set plus an initial correction direction.

7. The parameterized automatic graphic correction system based on constraint satisfaction analysis according to claim 1, characterized in that: When the solution and optimization module solves the parameters to minimize the constraint difference, it adopts the nonlinear least squares algorithm Gauss-Newton / LM, adds upper and lower bounds and geometrically feasible intervals for parameters, and uses the previous solution as the initial value for incremental solution.

8. The parameterized automatic graphic correction system based on constraint satisfaction analysis according to claim 1, characterized in that: The verification and rollback module ensures that the correction results are available and supports rollback by recalculating the global satisfaction S and comparing it with the threshold, rolling back to the previous stable snapshot when hard constraints are violated, and saving historical snapshots to support undo operations.

9. The parameterized automatic graphic correction system based on constraint satisfaction analysis according to claim 1, characterized in that: When the interactive and visual feedback module explains the location and correction method of constraint violation, it highlights the geometric object or edge that violates the constraint, displays correction suggestions, and displays a satisfaction progress bar and error value.

10. The parameterized automatic graphic correction system based on constraint satisfaction analysis according to claim 1, characterized in that: When the log and learning module records the correction process and optimizes subsequent strategies, it records parameter changes, time consumption, and satisfaction changes, analyzes high-frequency conflict types, and adjusts weights and strategies.