[go: up one dir, main page]

CN118504486B - Method for adapting constraint solver, electronic equipment and storage medium - Google Patents

Method for adapting constraint solver, electronic equipment and storage medium Download PDF

Info

Publication number
CN118504486B
CN118504486B CN202410981947.9A CN202410981947A CN118504486B CN 118504486 B CN118504486 B CN 118504486B CN 202410981947 A CN202410981947 A CN 202410981947A CN 118504486 B CN118504486 B CN 118504486B
Authority
CN
China
Prior art keywords
constraint
solver
tree
node
solvers
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202410981947.9A
Other languages
Chinese (zh)
Other versions
CN118504486A (en
Inventor
倪恩志
石光辉
陈颖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Rongjian Software Technology Co ltd
Shanghai Hejian Industrial Software Group Co Ltd
Original Assignee
Chengdu Rongjian Software Technology Co ltd
Shanghai Hejian Industrial Software Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengdu Rongjian Software Technology Co ltd, Shanghai Hejian Industrial Software Group Co Ltd filed Critical Chengdu Rongjian Software Technology Co ltd
Priority to CN202410981947.9A priority Critical patent/CN118504486B/en
Publication of CN118504486A publication Critical patent/CN118504486A/en
Application granted granted Critical
Publication of CN118504486B publication Critical patent/CN118504486B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/30Circuit design
    • G06F30/32Circuit design at the digital level
    • G06F30/33Design verification, e.g. functional simulation or model checking
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2111/00Details relating to CAD techniques
    • G06F2111/04Constraint-based CAD

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Evolutionary Computation (AREA)
  • Geometry (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention relates to the field of chip verification, in particular to a method, electronic equipment and a storage medium for adapting constraint solvers, which are used for converting constraint expressions to be adapted into a tree structure through presetting constraint solvers of different types and operation types of the adaptation, adapting the obtained operation types to the preset constraint solvers of different types in the process of traversing the tree structure, replacing the maximum subtree of the adaptation with a node of an intermediate variable, and then continuing traversing the adaptation, so that the constraint expressions are finally disassembled into sub-constraints of a plurality of adaptation different constraint solvers, wherein the sub-constraint obtained by each constraint solver is the operation type good for the current constraint solver, and the solving efficiency of the constraint solver and the accuracy of a solving result are improved.

Description

Method for adapting constraint solver, electronic equipment and storage medium
Technical Field
The present invention relates to the field of chip verification, and in particular, to a method for adapting a constraint solver, an electronic device, and a storage medium.
Background
In the field of chip verification, constraint satisfaction problems are often encountered, particularly in various scenarios that ensure functional correctness and performance metrics of a design conform to predefined specifications, such as boolean functional relationships or other logical relationships between logic gates, combinational logic circuits, and sequential logic circuits that need to be satisfied in logic function verification, or constraints designed to ensure minimum pitch or avoid shorts in place and route stages, by checking whether delay constraints on all signal paths are satisfied in sequential constraints. And design constraint satisfaction problems in low power consumption verification, formal verification, or random constraints. Many problems in the field of chip verification can be converted into constraint problems, so that a general constraint solver is adopted for solving.
Common solvers applied to constraint problem solving are SAT (Boolean satisfiability problem) solvers, SMT (Satisfiability modulo theories) solvers, CSP (Constraint satisfaction problem) solvers, and BDD (Binary decision diagram) -based solvers, each of which has differences in solving the problem. Wherein the SAT solver is adept at solving bit operations; SMT solvers are adept at solving combined problems, such as arithmetic, boolean logic, array, etc. combined constraint problems; CSP solvers are adept at arithmetic operations, relational operations, collective relational operations, etc.; BDD solvers are adept at dealing with the representation and optimization problems of boolean functions.
At present, when constraint problems are processed, corresponding constraint problems are generally classified into different operation categories in advance according to operation types, then a proper target solver is matched according to the operation categories, and the target solver is used for solving. When each constraint expression in a complex constraint problem comprises different operation types, classifying according to a preset priority rule, classifying the expressions into corresponding categories, and solving through a corresponding target solver. However, when an operation type which is not good for the target solver exists in the constraint expression, the solving efficiency of the target solver is low, and the solving result is inaccurate. Therefore, a method for improving the computational efficiency and accuracy of constraint solvers is needed.
Disclosure of Invention
Aiming at the technical problems, the invention adopts the following technical scheme: a method of adapting a constraint solver, the method comprising the steps of:
S100, acquiring N types of constraint solver sequences CS to be adapted and the operation types of the N types of constraint solver sequences CS to be adapted; wherein cs= { CS 1,CS2,…,CSi,…,CSN},CSi is an i-th type constraint solver in CS, and the value range of i is 1 to N.
S200, obtaining a constraint expression exp of the constraint solver to be adapted.
S300, constructing a tree structure tree of the constraint expression according to exp.
S400, traversing the tree to obtain an operation type, and obtaining a constraint condition P= { P 1,P2,…,Pi,…,PN},Pi adapting to each type of constraint solver as a constraint sub-condition adapting to CS i; p i=(V,VMi,VMC(i),CCi, CF), V is the original variable set of all variables in exp, VM i is the current intermediate variable set generated by adapting CS i, VMC (i) is the other intermediate variable set of all constraint solvers except CS i in CS, CC i is the new sub-constraint set generated by CS i, and CF is the remaining constraint set that cannot be matched by the N-type constraint solvers; the generating step of the j-th current intermediate variable VM ij and the new child constraint CC ij thereof in P i comprises the following steps:
S410, acquiring the tree' -with the last updated tree structure.
S420, traversing upwards from the leaf node of the tree', acquiring an adapted maximum subtree subtree i according to the operation type of the traversed adapted CS i, and obtaining a j-th sub-expression subexp ij of the CS i according to subtree i.
S430, the j-th current intermediate variable VM ij of CS i is created.
S440, replacing subtree i in the tree 'with a node bound with the VM ij to obtain an updated tree structure tree'.
S450, generating the new child constraint CC ij of CS i from VMs ij and subexp ij.
The present invention also provides a non-transitory computer readable storage medium having stored therein at least one instruction or at least one program loaded and executed by a processor to implement the above-described method.
Furthermore, the invention also provides an electronic device comprising a processor and the non-transitory computer readable storage medium.
The invention has at least the following beneficial effects:
The invention provides a method, electronic equipment and storage medium for adapting constraint solvers, which are used for presetting constraint solvers of different types and adaptive operation types thereof, adapting the operation types of sub-expressions of constraint expressions to different constraint solvers, disassembling the constraint expressions into a plurality of sub-constraints of the different constraint solvers, wherein the sub-constraint obtained by each constraint solver is the good operation type of the current constraint solver, and improving the solving efficiency of the constraint solver and the accuracy of solving results.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for adapting a constraint solver according to a first embodiment of the present invention;
FIG. 2 is a flow chart of a comparison of the traversing tree structure according to the first embodiment of the present invention;
Fig. 3 is a flowchart of a method for adapting a constraint solver according to a second embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Example 1
Referring to fig. 1, a flow chart of a method of adapting a constraint solver is shown, the method comprising the steps of:
S100, acquiring N types of constraint solver sequences CS to be adapted and the operation types of the N types of constraint solver sequences CS to be adapted; wherein cs= { CS 1,CS2,…,CSi,…,CSN},CSi is an i-th type constraint solver in CS, and the value range of i is 1 to N.
Optionally, the constraint solver is one of a SAT (Boolean satisfiability problem) solver, a SMT (Satisfiability modulo theories) solver, a CSP (Constraint satisfaction problem) solver, or a BDD (Binary decision diagram) -based solver. Other types of solvers of the prior art are within the scope of the present invention.
Wherein the types of constraint solvers are different in CS.
Wherein the adapted operation type refers to the operation type good for the constraint solver.
Optionally, the SAT solver is adapted to a bit operation, and the non-adapted operation is selected from the group consisting of an arithmetic operation, a relational operation and an arithmetic operation. The CSP solver is adapted to arithmetic operations, relational operations and collective relational operations, and the non-adapted operation type is bit operation. The operation types which are adapted by the SAT solver and the CSP solver are logic operations. In the prior art, other constraint solvers and the adaptive operation types thereof also fall within the protection scope of the invention.
S200, obtaining a constraint expression exp of the constraint solver to be adapted.
The constraint problems include variables, constants, and constraint expressions, among others. Wherein the variables are signed or unsigned bit vectors having a fixed bit width.
Wherein the constraint expression includes an operand and an operator, the operand being a constant or a variable.
Optionally, the operator is one or more of a logical operator, a bit operator, an arithmetic operator, a relational operator, an if-then-else operator, a collective relational operator. Other operators included in the expressions in the prior art are also within the scope of the present invention.
As one example, the constraint problem is: x is a random variable of an 8-bit vector, and the constraint expression is: x >0& & x <11.
S300, constructing a tree structure tree of the constraint expression according to exp.
It should be noted that S300 converts the text form expression exp into the structured form expression tree, which is more beneficial to computer processing.
Wherein each node in the tree is an operand or an operator, and the edges between the nodes are relationships between the nodes.
In the prior art, the method for constructing the tree structure according to the expression falls into the protection scope of the invention.
S400, traversing the tree to obtain an operation type, and obtaining a constraint condition P= { P 1,P2,…,Pi,…,PN},Pi adapting to each type of constraint solver as a constraint sub-condition adapting to CS i; p i=(V,VMi,VMC(i),CCi, CF), V is the original variable set of all variables in exp, VM i is the current intermediate variable set generated by adapting CS i, VMC (i) is the other intermediate variable set of all constraint solvers except CS i in CS, CC i is the new sub-constraint set generated by CS i, and CF is the remaining constraint set that cannot be matched by all N-type constraint solvers.
And matching the operation type of the sub-expression corresponding to the maximum subtree obtained by traversing the tree to a constraint solver which is good at processing the current operation type.
Wherein P i may be null. When traversing the tree, if the operation type of the adaptation CS i does not exist in the tree, P i is null.
The original variable set V of all the sub constraint conditions in P is the same, and all variables in exp are all variables. After traversing the tree, V is obtained.
Wherein each intermediate variable in VM i is created when the current constraint solver is adapted. Each intermediate variable in VM i has a corresponding new child constraint in CC i, and the number of elements in VM i is equal to the number of elements in CC i. The new child constraint in VM i is defined as the mapping of the child expressions in each current intermediate variable and its alternate exp.
Wherein, when the subtree in which VM rp is located in VMC (i) is replaced by VM ij in VM i, VM rp includes VM rp in CC ij for adapting to the p-th current intermediate variable VM rp generated by class r constraint solver CS r. By analogy, all intermediate variables produced appear in all adapted sub-expressions, and therefore all variables and intermediate variables are included in constraint P i of adaptation CS i: v, VM i, VMC (i). Similarly, all variables and intermediate variables are included in constraint sub-conditions that are adapted to other constraint solvers.
Each remaining constraint in the remaining constraint set CF is a constraint corresponding to an operation type that cannot be adapted after the N types of constraint solvers are respectively adapted. The remaining constraint set for all sub-constraints in P is the same.
Further, the adaptation step of the j-th current intermediate variable VM ij and the new-child constraint CC ij in P i includes:
S410, obtaining the tree' of the tree structure updated in the last adapting process.
During the traversal, each adaptation is performed on the basis of the last updated tree structure.
S420, traversing upwards from the leaf node of the tree', acquiring an adapted maximum subtree subtree i according to the operation type of the traversed adapted CS i, and obtaining a j-th sub-expression subexp ij of the CS i according to subtree i.
Wherein, subtree i the step of obtaining includes:
s421, traversing upwards from the leaf node along the path to the root node, and continuing traversing upwards when the operation type of the traversed node is adapted to CS i; when the operation type to which the traversed operator node belongs does not adapt to the CS i, the operation node is rolled back to the adapting CS i of the previous traversal, and the traversal is continued on the other branch after the operation node is rolled back. The judging method of the operation type of the node comprises the following steps: when traversing to the operator node, determining the operation type according to the operator node.
S422, after traversing all potential paths, finishing the traversal, and obtaining subtree i.
After traversing the entire tree, the largest subtrees of the multiple adaptation CS i can be obtained.
In the prior art, other methods of obtaining subtree i fall within the scope of the present invention.
S430, the j-th current intermediate variable VM ij of CS i is created.
S440, replacing subtree i in the tree 'with a node bound with the VM ij to obtain an updated tree structure tree'.
Wherein the node bound to VM ij is a leaf node in the tree ". Nodes in the tree "include variables, operators, and intermediate variables.
S450, generating the new child constraint CC ij of CS i from VMs ij and subexp ij.
Optionally, VM ij and CC ij satisfy: CC ij:=VMij==subexpij. Where "=" is a definition symbol, i.e., defining the constraint on CC ij as "VM ij==subexpij","VMij==subexpij" means subexp ij by VM ij. Other methods of defining constraints according to VM ij and subexp ij are within the scope of the invention.
As one example, when the sub-expression represented by VM ij is "a| (b & c)", CC ij satisfies: CC ij:=VMij = a| (b & c).
As a preferred embodiment, S400 further includes:
s470, acquiring a residual constraint set CF, wherein the step of acquiring the h residual constraint CF ih comprises the following steps:
S471, when traversing upwards from the leaf node of the tree', obtaining the target operation type of the traversed node, and when the target operation type is not matched with the N-type constraint solver, obtaining the h-th discomfort sub tree Usubtree ih; and according to Usubtree ih, the h-th discomfort gamete expression Usubexp ih is obtained. The judging method of the target operation type of the node comprises the following steps: when traversing to the operator node, determining the target operation type according to the operator node.
S472, creating an h intermediate variable VF h.
And S473, generating the h residual constraint CF ih of the CF according to the VFs h and Usubexp ih.
In the prior art, other methods for obtaining the remaining constraint set fall within the protection scope of the present invention.
As a preferred embodiment, S400 further includes: and when the operation type of the traversed current operator is matched with the L-type constraint solver and the last matched constraint solver is one of the L-type constraint solvers, the current operator is matched with the last matched constraint solver.
It will be appreciated that during the traversal process, the adapted largest sub-tree subtree i is replaced with the intermediate variable VM ij and the tree structure tree "is updated, and the traversal is based on the tree" when traversing the next node. And after all traversals are completed, all constraint conditions of all constraint solvers of exp adaptation are obtained.
As an example, cs= { CS 1,CS2 }, where CS 1 is a SAT solver, CS 2 is a CSP solver, CS 1 adapted operations are bit operations and logical operations, the operations that CS 2 adapts are arithmetic operations, relational operations, collective relational operations, and logical operations. The constraint expression is: g- > ((x+ (y x z)) > (a| (b & c))), the tree structure of the constraint expression is a tree, see fig. 2 (a), which shows the tree. First, CS 1 is adapted, and traversal is performed upwards from the leaf node of the tree, so that the sub-expression corresponding to the largest sub-tree subtree 1,subtree1 of the adapted CS 1 is "a| (b & c)". the first intermediate variable VM 11 of CS 1 is created, replaced subtree 1 with VM 11, And updating the tree structure to obtain tree', and generating a first new child constraint according to VM 11 and subtree 1: CC 11:=VM11 = (a| (b & c)). the tree structure of tree 'is shown in fig. 2 (b), and then the adaptation CS 2 traverses up from the leaf node of tree', resulting in the sub-expression corresponding to the largest sub-tree subtree 2,subtree2 of the adaptation CS 2 being "((x+ (y×z)) > VM 11". The first intermediate variable VM 21 of CS 2 is created, replaced subtree 2 with VM 21, and updating the tree structure to obtain a tree ", generating a first new child constraint according to VM 21 and subtree 2: CC 21:=VM21==((x+(y×z)) > VM11. tree "as shown in fig. 2 (c), since the last operator left is" - > ", the type of operation of this logical operation is adapted to both CS 1 and CS 2, since the last adapted constraint solver is CS 2, In order to optimize the algorithm, at this time, i.e. continue to adapt CS 2, the tree's leaf node is traversed upwards, resulting in the sub-expression corresponding to the largest sub-tree subtree 3,subtree3 of the adapted CS 2 being "g- > VM 21". A second intermediate variable VM 22 of CS 2 is created, replaced subtree 3 with VM 22, Finally, replacing the tree structure with a node, and generating a second new child constraint according to the VMs 22 and subtree 3: CC 22:=VM22==g->VM21. After the traversal is completed, constraint conditions P= { P 1,P2 } of each type of constraint solver are adapted, wherein ,P1=(V,VM1,VM2,CC1,CF),P2=(V,VM2,VM1,CC2,CF). is obtained, and the original variable set is obtained V={a,b,c,x,y,z,g},VM1={VM11},VM2={VM21,VM22},CC1={CC11},CC2={CC21,CC22},CF=
In summary, the present invention provides a method for adapting a constraint solver, which is to preset constraint solvers of different types and operation types thereof, convert constraint expressions to be adapted into a tree structure, adapt the obtained operation types to the preset constraint solvers of different types in the process of traversing the tree structure, replace the maximum subtree of adaptation with a node of an intermediate variable, and then continue traversing adaptation, so as to finally complete the disassembly of the constraint expressions into sub-constraints of a plurality of different constraint solvers, wherein the sub-constraint obtained by each constraint solver is the operation type good for the current constraint solver, thereby improving the solving efficiency of the constraint solver and the accuracy of the solving result.
An embodiment of the present invention also provides a non-transitory computer readable storage medium, which may be disposed in an electronic device, to store at least one instruction or at least one program related to implementing a method in the method embodiment, where the at least one instruction or the at least one program is loaded and executed by the processor to implement the method provided in the above embodiment.
An embodiment of the present invention also provides an electronic device including a processor and the aforementioned non-transitory computer-readable storage medium.
An embodiment of the invention also provides a computer program product comprising program code for causing an electronic device to carry out the steps of the method according to various exemplary embodiments of the invention as described in the specification, when said program product is run on the electronic device.
According to the method provided by the embodiment of the invention, the solving efficiency and the solving accuracy of each solver can be improved, but a dependency relationship possibly exists among a plurality of sub-constraints adapted by different constraint solvers, and when N constraint solvers jointly solve the same constraint expression, mutual waiting among the sub-constraints possibly occurs, so that the calculating efficiency is low. Therefore, on the basis of the first embodiment, the invention also provides a second embodiment, which optimizes the cooperative process of the N constraint solvers and improves the calculation efficiency.
Example two
Referring to fig. 3, a flow chart of a collaborative method based on a plurality of constraint solvers is shown, the method comprising:
and P100, acquiring N types of constraint solvers CS.
Alternatively, the constraint solver may also be the core algorithm of the constraint solver.
P200, obtaining constraint conditions P of each type of constraint solver in the constraint expression exp adaptation CS, wherein the constraint conditions of each type of constraint solver comprise an original variable set V of all variables in exp, a current intermediate variable set VM generated by the adaptation current constraint solver, other intermediate variable sets VMC of all constraint solvers except the current constraint solver, an new sub-constraint set CC generated by the current constraint solver and a residual constraint set CF which cannot be matched by N types of constraint solvers.
It should be noted that, in the first embodiment, the constraint solver CS, the constraint expression exp, the constraint condition P, and the obtaining steps thereof are applicable to the second embodiment, and are not described in detail.
As can be seen from the first embodiment, the step of obtaining the j-th current intermediate variable VM ij in the VM i of the i-th constraint solver CS i includes: when the operation type of sub-expression subexp ij of exp matches the operation type of the good-quality operation type bound to class i constraint solver CS i, the step of replacing subexp ij with the j-th new child constraint CC ij in CC i of VM ij.CSi includes: new child constraints CC ij for CS i are generated from subexp ij and VM ij.
P300, calculating exp according to P, comprising the following steps:
And P310, selecting candidate variables from V and respective VM by each type of constraint solver in CS to obtain candidate variables of each type of constraint solver.
Wherein the step of choosing candidate variables is done inside the respective constraint solver. The candidate variables chosen by each constraint solver are either the original variables in the original set of variables or the intermediate variables in the current set of intermediate variables.
Optionally, each type of constraint solver picks candidate variables according to preset internal rules. The internal rules are rules of selecting variables in the respective internal parts of constraint solvers of each type preset in advance by a user.
P320, the cooperative scheduler selects L target candidate variables from all candidate variables of CS, and respectively obtains random values of the L target candidate variables, wherein L is greater than or equal to 1, and L is less than or equal to N.
Optionally, the collaborative scheduler is configured to collaborative solve a plurality of constraint solvers, and is a pre-designed reusable software structure framework, where the framework is responsible for scheduling each constraint solver to perform collaborative calculation solution.
Optionally, the co-scheduler picks the target candidate variable according to a preset global rule. The global rule is a rule preset in advance for selecting a target candidate variable from candidate variables of all constraint solvers again. Optionally, the global rule includes a frequency of occurrence of the candidate variable, a range of values of the candidate variable. Other rules for selecting target candidate variables in the prior art fall within the scope of the present invention.
And P330, adding the L target candidate variables and random values thereof into the to-be-propagated list bList.
And P340, when the target candidate variable in bList is empty, obtaining a collaborative calculation result of exp, and ending the cycle.
It should be noted that when the target candidate variable in bList is empty, it is noted that all the original variables of V in P310 and all the intermediate variables of all the constraint solvers have been selected and propagated, and all the variables have obtained corresponding values, so that a collaborative calculation result of exp can be obtained.
P350, each constraint solver propagates bList within the respective CC and CF ranges when the target candidate variable in bList is not null.
It will be appreciated that by propagating bList, it can be ensured that, in the range of each of the respective CCs and CFs of each constraint solver, when the value of the target candidate variable changes, all other variables affected by the change and constraint conditions can be updated accordingly, thereby achieving a state in which the whole system satisfies all constraints. According to the cooperative method, the target candidate variable and the random value thereof are selected through the cooperative scheduler, so that N constraint solvers can perform cooperative calculation, and the calculation efficiency is improved.
The prior art propagation mechanisms for propagating values of variables fall within the scope of the present invention.
It will be appreciated that when the value of a variable is propagated updated, the effect of the updated value of the variable on the constraints and other variables associated therewith is examined. If the updated values do not satisfy the current constraint, the values of other variables associated therewith are adjusted to re-satisfy the current constraint, and the process proceeds recursively until a steady state is reached, i.e., all constraints are satisfied, or no solution is determined.
As a preferred embodiment, the P350 further includes the step of the i-th constraint solver CS i propagating the t-th target candidate variable var t and its r-th random value data r:
And P351, returning to the cooperative scheduler when conflict occurs in the CS i propagation process, and calling the rollback function of the CS i by the cooperative scheduler to execute the steps P3511-P3513 for rollback.
Where a conflict refers to a change or assignment of a variable value that violates other existing constraints. Conflicts include multiple conflict types, for example, a logical conflict may occur when a variable's value results in a directly related constraint no longer being established.
Wherein each constraint solver has three functions, the first function is to pick candidate variables, the second function is a propagation function, and the third function is a rollback function.
P3511, obtain the current value range rang t of var t.
Where data r is the random value of var t and rang t is all possible values that var t could theoretically take. During propagation, if the value of var t is determined, the actual scaling down rang t is scaled down to data r. When data r fails to propagate, it is stated that data r cannot meet the constraint and needs to be excluded from rang t.
P3512, data r is excluded from rang t, resulting in an updated value range rang t' for var t.
P3513, when rang t' is not null, reverting to S310; otherwise, the rollback is unsuccessful, the calculation fails, and the loop of S300 is exited.
It should be noted that if rang t' is null, it indicates that no possible value can satisfy all relevant constraints, i.e., the constraint expression has no solution, and thus the calculation fails. The calculation amount can be reduced and the calculation efficiency can be improved by determining the value of each variable in the rollback mode.
Other rollback methods for conflict in the prior art fall within the protection scope of the present invention.
As a preferred embodiment, the P350 further includes the step of propagating the t-th target candidate variable var t and its r-th random value data r of the i-th constraint solver CS i:
p352, when no conflict occurs in the CS i propagation process, comprises the following steps:
p3521 checks V, CS i whether there is a change in the current value range of the variable in the current intermediate variable set VM i, the other intermediate variable sets VMC (i) of all constraint solvers except CS i.
When the data r of the var t changes, the value fields of other variables directly or indirectly dependent on the var t change. That is, when the random value data r of var t is determined, the constraint conditions associated with the values are re-evaluated, and the legal value ranges of other variables depending on the constraints are affected. The propagation of data r not only updates the actual value of var t, but more importantly adjusts the value fields of the variables in all constraints by propagation.
P3522, if present, acquires the intersection of the value ranges before and after the change.
If the intersection is not null, then var t and rang t are added to the to-be-propagated list and P350 is returned. The obtained values of the variables meeting the constraint are synchronized to all constraint solvers in the mode.
Other methods of synchronizing variable values in the prior art fall within the scope of the present invention.
As a preferred embodiment, P352 further comprises:
If the intersection is empty, P3524 determines that a collision occurs, and the rollback process is performed according to P351.
As a preferred embodiment, P350 further comprises:
P353, the co-scheduler excludes bList the target candidate variable for which the value has been determined, and returns to S310. For example, the following two cases are those in which a candidate variable worth targeting has been determined: first, when the random value of the current variable is successfully propagated, the value range of the current variable is the random value successfully propagated. Second, the range of a variable is reduced to a single value during propagation. It has been determined that the value of the current variable satisfies all constraints and therefore no further propagation is required.
In summary, the present invention provides a collaborative method based on a plurality of constraint solvers, which selects candidate variables through each constraint solver, then selects a target candidate variable from all candidate variables again through a collaborative scheduler, obtains a random value of the target candidate variable, adds the target candidate variable and the random value thereof into a propagation list, and propagates bList in the range of each new added sub-constraint set and the residual constraint set. The collaborative method can enable all constraint solvers to cooperatively calculate, and improves the efficiency and accuracy of calculating constraint expressions.
Embodiments of the present invention also provide a non-transitory computer readable storage medium that may be disposed in an electronic device to store at least one instruction or at least one program for implementing one of the methods embodiments, the at least one instruction or the at least one program being loaded and executed by the processor to implement the methods provided by the embodiments described above.
Embodiments of the present invention also provide an electronic device comprising a processor and the aforementioned non-transitory computer-readable storage medium.
Embodiments of the present invention also provide a computer program product comprising program code for causing an electronic device to carry out the steps of the method according to the various exemplary embodiments of the invention as described in the specification, when said program product is run on the electronic device.
While certain specific embodiments of the invention have been described in detail by way of example, it will be appreciated by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the invention. Those skilled in the art will also appreciate that many modifications may be made to the embodiments without departing from the scope and spirit of the invention. The scope of the present disclosure is defined by the appended claims.

Claims (8)

1. A method of adapting a constraint solver, the method comprising the steps of:
S100, acquiring N types of constraint solver sequences CS to be adapted and the operation types of the N types of constraint solver sequences CS to be adapted; wherein cs= { CS 1,CS2,…,CSi,…,CSN},CSi is an i-th type constraint solver in CS, and the value range of i is 1 to N;
s200, obtaining a constraint expression exp of a constraint solver to be adapted;
s300, constructing a tree structure tree of the constraint expression according to exp;
S400, traversing the tree to obtain an operation type, and obtaining a constraint condition P= { P 1,P2,…,Pi,…,PN},Pi adapting to each type of constraint solver as a constraint sub-condition adapting to CS i; p i=(V,VMi,VMC(i),CCi, CF), V is the original variable set of all variables in exp, VM i is the current intermediate variable set generated by adapting CS i, VMC (i) is the other intermediate variable set of all constraint solvers except CS i in CS, CC i is the new sub-constraint set generated by CS i, and CF is the remaining constraint set that cannot be matched by the N-type constraint solvers; the generating step of the j-th current intermediate variable VM ij and the new child constraint CC ij thereof in P i comprises the following steps:
s410, acquiring a tree' -of a tree structure updated last time;
S420, traversing upwards from leaf nodes of tree', acquiring an adapted maximum subtree subtree i according to the operation type of the traversed adapted CS i, and obtaining a j-th sub-expression subexp ij of CS i according to subtree i;
s430, creating a j-th current intermediate variable VM ij of the CS i;
S440, replacing subtree i in the tree 'with a node bound with the VM ij to obtain an updated tree structure tree';
S450, generating a new amplicon constraint CC ij of CS i according to VM ij and VM subexp ij;
Wherein the method further comprises:
s470, acquiring a residual constraint set CF, wherein the step of acquiring the h residual constraint CF ih comprises the following steps:
S471, when traversing upwards from the leaf node of the tree', obtaining the target operation type of the traversed node, and when the target operation type is not matched with the N-type constraint solver, obtaining the h-th discomfort sub tree Usubtree ih; and obtaining an h discomfort gamete expression Usubexp ih according to Usubtree ih;
s472, creating an h intermediate variable VF h;
S473, generating an h residual constraint CF ih of the CF according to Usubexp ih;
Wherein S420 further comprises: subtree i acquisition:
S421, traversing upwards from the leaf node along the path to the root node, and continuing traversing upwards when the operation type of the traversed operator node is adapted to CS i; when the operation type of the traversed operator node is not suitable for CS i, returning to the operator node of the adapting CS i of the previous traversal, and continuing to traverse on the other branch after returning;
s422, after traversing all potential paths, finishing the traversal, and obtaining subtree i.
2. The method of claim 1, wherein S450 further comprises:
VM ij and CC ij satisfy: CC ij:=VMij==subexpij; wherein "=" is a definition symbol.
3. The method of claim 1, wherein S400 further comprises: and when the operation type of the traversed current operator is matched with the L-type constraint solver and the last matched constraint solver is one of the L-type constraint solvers, the current operator is matched with the last matched constraint solver.
4. The method of claim 1, wherein the original set of variables V for all sub-constraints in P are the same, all variables in exp.
5. The method of claim 1, wherein the constraint expression in S200 comprises an operand and an operator, the operand being a constant or a variable.
6. The method of claim 5, wherein S421 further comprises: the judging method of the operation type of the node is as follows: when traversing to the operator node, determining the operation type according to the operator node.
7. A non-transitory computer readable storage medium having stored therein at least one instruction or at least one program, wherein the at least one instruction or the at least one program is loaded and executed by a processor to implement the method of any one of claims 1-6.
8. An electronic device comprising a processor and the non-transitory computer readable storage medium of claim 7.
CN202410981947.9A 2024-07-22 2024-07-22 Method for adapting constraint solver, electronic equipment and storage medium Active CN118504486B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410981947.9A CN118504486B (en) 2024-07-22 2024-07-22 Method for adapting constraint solver, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410981947.9A CN118504486B (en) 2024-07-22 2024-07-22 Method for adapting constraint solver, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN118504486A CN118504486A (en) 2024-08-16
CN118504486B true CN118504486B (en) 2024-09-27

Family

ID=92233221

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410981947.9A Active CN118504486B (en) 2024-07-22 2024-07-22 Method for adapting constraint solver, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN118504486B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116933015A (en) * 2023-09-15 2023-10-24 北京云枢创新软件技术有限公司 Preprocessing method for input signal of constraint solver, electronic equipment and storage medium
CN117473201A (en) * 2022-07-20 2024-01-30 华为技术有限公司 Determination method and device for feasible solution of constraint expression and electronic equipment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8521785B2 (en) * 2012-01-03 2013-08-27 Oracle International Corporation System and method for efficient representation of dynamic ranges of numeric values
CN115729554A (en) * 2021-08-31 2023-03-03 华为技术有限公司 Formalized verification constraint solving method and related equipment
CN118013342B (en) * 2024-04-09 2024-06-21 成都融见软件科技有限公司 Constraint variable classification method, electronic equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117473201A (en) * 2022-07-20 2024-01-30 华为技术有限公司 Determination method and device for feasible solution of constraint expression and electronic equipment
CN116933015A (en) * 2023-09-15 2023-10-24 北京云枢创新软件技术有限公司 Preprocessing method for input signal of constraint solver, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN118504486A (en) 2024-08-16

Similar Documents

Publication Publication Date Title
Alviano et al. A MaxSAT Algorithm Using Cardinality Constraints of Bounded Size.
Lee et al. Equivalence checking of scheduling with speculative code transformations in high-level synthesis
US10956417B2 (en) Dynamic operation scheduling for distributed data processing
US9286570B2 (en) Property reactive modifications in a rete network
CN116933015B (en) Preprocessing method for input signal of constraint solver, electronic equipment and storage medium
JPH0795274B2 (en) Array subscript analysis method
WO2018066073A1 (en) Information processing device, information processing method, and information processing program
JP3741544B2 (en) Sequential circuit state search method and apparatus, and recording medium storing state search program
Nadeem et al. Polynomial formal verification of approximate adders with constant cutwidth
CN118504486B (en) Method for adapting constraint solver, electronic equipment and storage medium
Moraglio et al. Evolving recursive programs using non-recursive scaffolding
CN118966095B (en) Collaborative method based on multiple constraint solvers, electronic equipment and storage medium
CN118690837A (en) Operator fusion method, device and electronic equipment
Ioualalen et al. Synthesizing accurate floating-point formulas
Banerjee et al. A value propagation based equivalence checking method for verification of code motion techniques
Turlea et al. A test suite generation approach based on EFSMs using a multi-objective genetic algorithm
US6609234B2 (en) Ordering binary decision diagrams used in the formal equivalence verification of digital designs
Datta et al. Uniform adaptive scaling of equality and inequality constraints within hybrid evolutionary-cum-classical optimization
Chistikov et al. Acyclic Petri and workflow nets with resets
CN113836386B (en) Parallel mode search space construction system and method
Nadeem et al. Polynomial formal verification of multi-valued logic circuits within constant cutwidth architectures
Schmitt et al. Fast-extract with cube hashing
CN112800669B (en) Method for evaluating various approximate technical errors based on probability map model in special accelerator
US8990748B1 (en) Timing in a circuit design having finite state machines
US9098800B2 (en) Apparatus and method for managing axiom, and reasoning apparatus including the same

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant