Model counting device and model counting method

Converting logical formulas into tensor trains addresses the inefficiencies of BDDs by reducing size and speeding up calculations while supporting parallel computing for model counting.

WO2025224816A1PCT designated stage Publication Date: 2025-10-30NT T INC
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
PCT/JP2024/015820
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2024-04-23
Publication Date
2025-10-30

AI Technical Summary

Technical Problem

Existing methods for model counting of logic functions, such as Binary Decision Diagrams (BDDs), face issues with increasing representation size, slow calculations, and incompatibility with parallel computing as the problem scale grows.

Method used

Converting logical formulas into tensor trains and performing weighted model counting using operations on tensor trains, which include monomial conversion and logical operations, allowing for reduced representation size and faster calculations compatible with parallel computing.

Benefits of technology

Tensor trains provide exponentially smaller representations and faster model counting, enhancing compatibility with parallel computing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure JP2024015820_30102025_PF_FP_ABST
    Figure JP2024015820_30102025_PF_FP_ABST
Patent Text Reader

Abstract

A model counting device according to the disclosed technology is a device that converts a logical expression consisting of variables x1, x2, ..., xn into a tensor sequence to calculate a model count, and includes a monomial conversion unit and a logical operation unit. The monomial conversion unit uses a sequence of n 1×2×1 tensors (tensor train) to convert xi into a tensor train in which only the (0,0,0) element of the i-th (i=1, 2, ..., n) tensor is set to 0 and the other elements are set to 1, and to convert xi into a tensor train in which only the (0,1,0) element of the i-th (i=1, 2, ..., n) tensor is set to 0 and the other elements are set to 1. The logical operation unit performs a logical negation operation on the tensor trains, and performs a logical product operation that operates on the i-th (i=1, 2, ..., n) tensors of the tensor trains and generates a logical product by arranging the n tensors obtained by the operation.
Need to check novelty before this filing date? Find Prior Art

Description

Model counting device and model counting method

[0001] The disclosed technology relates to model counting of logic functions.

[0002] A logic function is a function that accepts multiple binary inputs and returns a single binary output. Model counting of a logic function is an operation that counts the number of inputs that result in an output of 1. Weighted model counting is a generalization of this, and is an operation that calculates the count value when a weight is assigned to each logic variable.

[0003] Weighted model counting has been applied to solving a variety of real-world problems, one example being network reliability. The problem of calculating the probability that a pair of vertices (nodes) will become disconnected in a network where edges (links) fail probabilistically is called network reliability. This is extremely important, for example, when simulating power outage damage during a disaster. If we consider each edge as a variable, with the binary input indicating whether or not each edge will fail and the binary output indicating whether a given pair of vertices will be connected, network reliability can be thought of as the problem of calculating the probability that the output of a logic function will be 1 for all inputs. This problem can be solved using weighted model counting.

[0004] Another example is inference on Bayesian networks. Bayesian networks are representations of probability distributions, and inference on them is an important problem used in machine learning, etc. It is known that inference on Bayesian networks can be reduced to weighted model counts.

[0005] However, since the number of input types for a logic function increases exponentially with the number of input variables, maintaining the input-output relationships naively results in a huge size, and model counting also takes a lot of time. Therefore, a representation that compresses and expresses logic functions and allows for fast model counting is required.

[0006] Binary Decision Diagram (BDD: Non-Patent Document 1) is a conventional technology for compressing and representing logic functions and performing model counting at high speed. BDDs are data structures that represent logic functions using a directed acyclic graph (DAG) and are known for their ability to efficiently perform various logic operations, including model counting. Furthermore, due to their ability to easily represent real-world logic functions in a compact form, they remain a widely used representation in applications. Furthermore, an algorithm called the Apply operation is known for BDDs, which quickly constructs a BDD corresponding to the logical product of two BDDs. A given CNF (Conjunctive Normal Form) can be converted to a BDD by combining BDDs representing each clause with the Apply operation.

[0007] RE Bryant, "Graph-Based Algorithms for Boolean Function Manipulation", IEEE Transactions on Computers, Vol. 35, Issue 8, pp.677-691, 1986.

[0008] However, BDDs have the following problems: (1) the representation size increases as the problem scale increases, (2) calculations become slower as the size increases, and (3) due to their graph shape, they are not very compatible with parallel computing.

[0009] In order to solve the above problem, the model counting device according to the disclosed technology is n The apparatus converts a logical formula consisting of x into a tensor train and calculates a model count. The apparatus comprises a monomial conversion unit and a logical operation unit. The monomial conversion unit converts x into a tensor train consisting of n 1×2×1 tensors. i is a tensor train in which only the (0,0,0) element of the i-th (i=1,2,…,n) tensor is set to 0 and the other elements are set to 1, and ¬x iconverts the i-th (i=1,2,...,n) tensor into a tensor train with only the (0,1,0) element set to 0 and the other elements set to 1. The logical operation part is an operation to logically negate the tensor train, multiplying the element of the first 1×2×B1 tensor by -1, then expanding it to 1×2×(B1+1) and setting the elements (0,0,B1) and (0,1,B1) to 1, and for the i∈{2,3,...,n-1}-th tensor, A i ×2×B i The tensor (A i +1)×2×(B i +1) tensor and fill the expanded part with 0 and then add the element (A i ,0,B i ) and (A i ,1,B i ) and add 1 to the nth A n ×2×1 tensor (A n +1) × 2 × 1 and expand it to the element (A n ,0,0) and (A n The logic performs a logical negation operation to generate a string of tensors, where n is the number of tensors in a tensor train, with n being 1, 1, 0) and a logical product operation to find the logical product of two tensor trains, where the i-th (i=1, 2, ..., n) tensors in the tensor train are operated on, and the n tensors obtained by the operation are arranged to generate the logical product.

[0010] The disclosed technology provides the following benefits: (1) Representation size may be reduced. It has been confirmed that there are functions that can be expressed exponentially smaller than BDDs when expressed using tensor trains. (2) As the size is reduced, weighted model counting is expected to be faster. (3) It is highly compatible with parallel computing. Tensor trains are expressed as a sequence of three-dimensional tensors. Tensors are highly compatible with parallel computing because they can be stored as multidimensional arrays without using pointers, and the product of tensors is decomposed into a simple sum of products of elements, and the same element is referenced multiple times.

[0011] Fig. 1 is a functional block diagram of a model counting device according to a first embodiment;Fig. 2 is a flowchart illustrating the operation of a conversion unit;Fig. 3 is a flowchart illustrating the operation of a calculation unit;Fig. 4 is a diagram illustrating an example of the functional configuration of a computer;

[0012] [Summary of the Disclosed Technology] The disclosed technology performs weighted model counting of logical expressions. As subtasks for this purpose, we disclose a technology for converting logical expressions to tensor trains and a technology for performing weighted model counting on tensor trains. A tensor train is a method for compressing and representing tensors, i.e., multidimensional arrays. Since the truth table of a logical function can be considered a 2x2x...x2 tensor, it is possible to think of a tensor train as a representation of a logical function.

[0013] First, convert a given logical formula into a tensor train. This is possible by performing logical product, logical disjunction, and logical negation on tensor trains. Each operation can be realized by combining sums, dot products, and Hadamard products on tensor trains. Since it is known that sums, dot products, and Hadamard products on tensor trains can be calculated in polynomial time, it is guaranteed that logical product, logical disjunction, and logical negation can also be calculated in polynomial time. By repeatedly performing logical product, logical disjunction, and logical negation, a tensor train equivalent to the original logical formula can be constructed. It is also possible to perform logical product or logical disjunction with other logical functions later on in the tensor train state.

[0014] Finally, we perform weighted model counting on the tensor train. This can be achieved by slicing each 3D tensor, taking the weighted sum of the resulting matrices, and then taking the matrix product of these. This procedure achieves weighted model counting of logical expressions.

[0015] Hereinafter, embodiments of the disclosed technology will be described in detail. Note that components having the same functions are assigned the same numbers, and duplicated descriptions will be omitted.

[0016] [First Embodiment] Fig. 1 is a functional block diagram showing an example of the configuration of a model counting device according to the first embodiment. The model counting device 10 includes a logical expression input unit 101, a conversion unit 102, a calculation unit 103, a weight input unit 104, and a model count output unit 105. The conversion unit 102 further includes a monomial conversion unit 106 and a logical operation unit 107. The calculation unit 103 further includes a weighted sum calculation unit 108 and a matrix multiplication calculation unit 109. Fig. 2 is a flowchart illustrating an example of the operation of the conversion unit 102. Fig. 3 is a flowchart illustrating an example of the operation of the calculation unit 103. The following description will be made with reference to Figs. 1, 2, and 3.

[0017] [Preparation: Tensors] The tensors used in the disclosed technology are three-dimensional arrays of the form A×2×B. The elements of the three-dimensional array are specified in the form (a,0 / 1,b), where a=0,1,...,A-1, b=0,1,,B-1. For convenience, the A×2×B tensor is expressed in the following format: M1 and M2 are A×B matrices. Imagine a pair of A×B matrices.

[0018] [Conversion of logical formula to tensor train] A user of the model counting device inputs a logical formula to the logical formula input unit (step S201). <Monomial conversion> The conversion unit 102 first converts the variables constituting the logical formula into a tensor train using the monomial conversion unit 106 (step S202). When there are n variables, the monomial is expressed as a sequence of n 1x2x1 tensors (tensor train), and x i is a tensor train in which only the (0,0,0) element of the i-th tensor is 0 and the other elements are 1, and i is represented as a tensor train in which only the (0,1,0) element of the i-th tensor is 0 and the other elements are 1.

[0019] Let's explain this with a specific example. When n = 3, x1 is expressed as follows: [0] and [1] are 1x1 matrices. ¬x2 is expressed as follows:

[0020] <Logical Operation> Next, the logical operation unit 107 operates on the tensor train representing the monomials according to the logical formula, and converts it into a tensor train representing the logical formula (step S203). The logical operation unit 107 operates on logical product and logical negation. Logical sum can be calculated using logical product and logical negation. Specifically, the logical sum x ∨ y is decomposed into the following form and operated (De Morgan's law): By converting the variables into a tensor train and repeating the above logical operations on the tensor train, any logical expression can be converted into a tensor train.

[0021] (Logical AND) The logical AND method is explained below. A tensor train is assumed to consist of n tensors. The i-th (i = 1, 2, ..., n) tensors in the train are operated on, and the n tensors obtained by the operation are arranged and output as the logical AND result. When operating on an A×2×B tensor X and a C×2×D tensor Y, the operation is performed between the A×B matrix and the C×D matrix, which share the same second index, and all matrix elements are multiplied together. The elements after multiplication are arranged according to the following rules.

[0022] Let's explain this with a concrete example. Create the logical product V1V2V3 of the following tensor trains T1T2T3 and U1U2U3. Since U1 is a 1x2x2 tensor, in equation (5), C = 1 and D = 2. The elements of tensor T1 can be listed with their indices as follows: The elements of tensor U1 can be listed with their indices as follows:

[0023] The operations between elements with second index = 0 are as follows: The operations between elements with the second index = 1 are as follows: Therefore, the tensor V1 is Similarly, the following tensor train V1V2V3 is obtained:

[0024] (Logical negation) We will explain how to perform logical negation. First, multiply the elements of the first 3D tensor by -1. Next, for the first 3D tensor, expand the 1×2×B1 tensor to 1×2×(B1+1), and set the elements (0,0,B1) and (0,1,B1) to 1. For each i∈{2,3,…,n-1}th 3D tensor, A i ×2×B i The tensor (A i +1)×2×(B i +1) tensor, fill the expanded part with 0, and i ,0,B i ) and (A i ,1,B i ) and add 1 to A for the n-th 3D tensor. n ×2×1 tensor (A n +1) × 2 × 1, and the element (A n ,0,0) and (A n ,1,0) is set to 1. Let's explain with a concrete example. The following tensor train The logical negation of this produces the following tensor train:

[0025] The conversion unit 102 transmits the generated tensor train to the calculation unit 103 (step S204). This completes the explanation of the conversion from a logical expression to a tensor train. Note that in the above logical product, the product of two tensors with a row number (column number) of 1 results in a tensor with a row number (column number) of 1, and in the above logical negation, a tensor with a row number (column number) of 1 remains as 1, so the first tensor in a tensor train always has a row number of 1 and the last tensor train always has a column number of 1.

[0026] [Weighted Model Count on Tensor Train] The calculation unit 103 receives a tensor train representing a logical expression and weights of variables as input, and outputs a value of a weighted model count.

[0027] <Preparation: Weighted Model Count> First, we will explain weighted model count. We consider a variable logic function f and the weight N(x i ), P(x i ), the weighted model count (WMC) is an operation that calculates the following value: Let's explain with a specific example. Suppose the logic function is f = (x1 ∧ ¬x2) ∨ ¬x3. Also, suppose the weights of the variables are as follows: N(x1)=1, P(x1)=2 N(x2)=3, P(x2)=4 N(x3)=5, P(x3)=6 In this case, the relationship between the inputs (x1, x2, x3) and the weights is as follows: The WMC is the sum of the weights, 141.

[0028] <Weighted Sum Calculation> The user inputs weight information of variables to the weight input unit 104. The calculation unit 103 acquires a tensor train representing a logical expression from the conversion unit 102. The calculation unit 103 also acquires weight information of variables from the weight input unit 104 (step S301). The weighted sum calculation unit 108 first slices an A×2×B tensor based on the second index for each three-dimensional tensor in the tensor train into two A×B matrices. Then, the two A×B matrices are summed using the weight N(x i ) and the weight P(x i ) and sum up (step S302). A specific example will be described. The tensor train to be calculated is assumed to be T1T2T3 below. T i Let T be the matrix obtained by slicing i (0) , T i (1) Then, If the weights are N(x1)=1, P(x1)=2 N(x2)=3, P(x2)=4 N(x3)=5, P(x3)=6, then T i (0) , T i (1) The weighted sum S i becomes as follows:

[0029] <Matrix Multiplication Calculation> The product of the n matrices thus obtained is calculated (step S303). A specific example is as follows.

[0030] The model count output unit outputs the value of the matrix product as the value of the weighted model count (step S304). This concludes the description of the weighted model count on the tensor train.

[0031] The above is the description of the first embodiment.

[0032] [Calculation example of weighted model count] An example of calculation of weighted model count according to the first embodiment will be described below. Assume that the user inputs the following logical formula and weight information into the model counting device 10. <Logical formula> (x1 ∧ ¬x2) ∨ ¬x3 (= ¬{ ¬(x1 ∧ ¬x2) ∧ x3}) <Weight> N(x1)=1, P(x1)=2 N(x2)=3, P(x2)=4 N(x3)=5, P(x3)=6

[0033] The monomial transform unit 106 generates the following tensor train: The logical operation unit 107 operates ¬x2 to obtain the following result.

[0034] The logical operation unit 107 operates x1 ∧ ¬x2 to obtain the following result. The logical operation unit 107 calculates │(x1 ∧ │x2) to obtain the following result. The logical operation unit 107 calculates {circumflex over (x1)} {circumflex over (x2)} {circumflex over (x3)} and obtains the following result. The logical operation unit 107 calculates {|(x1 ∧|x2) ∧ x3} to obtain the following result.

[0035] The conversion unit 102 transmits the tensor train to the calculation unit 103. The weighted sum calculation unit 108 calculates a weighted sum of matrices from the tensor train and the weights of the variables to obtain the following result. The matrix product calculator calculates the matrix product to obtain the weighted model count value 141 .

[0036] [Program, Recording Medium] The functions realized by the components described in this specification may be implemented in circuitry or processing circuitry, including general-purpose processors, application-specific processors, integrated circuits, ASICs (Application Specific Integrated Circuits), CPUs (Central Processing Units), conventional circuits, and / or combinations thereof, programmed to realize the described functions. A processor includes transistors and other circuits and is considered to be circuitry or processing circuitry. A processor may be a programmed processor that executes a program stored in a memory.

[0037] In this specification, a circuitry, unit, or means is hardware that is programmed to realize or performs the described functions, which may be any hardware disclosed herein or any hardware known to be programmed to realize or perform the described functions.

[0038] If the hardware is a processor considered to be a type of circuitry, the circuitry, means, or unit is a combination of the hardware and software used to configure the hardware and / or processor.

[0039] The various processes described above can be implemented by loading a program that executes each step of the above method into the recording unit 2020 of the computer 2000 shown in Figure 4, and operating the control unit 2010, input unit 2030, output unit 2040, display unit 2050, etc.

[0040] The program describing the processing contents can be recorded on a computer-readable recording medium, which may be, for example, a magnetic recording device, an optical disk, a magneto-optical recording medium, a semiconductor memory, or any other suitable recording medium.

[0041] The program may be distributed by, for example, selling, transferring, lending, etc. portable recording media such as DVDs and CD-ROMs on which the program is recorded. Furthermore, the program may be stored in a storage device of a server computer, and then transferred from the server computer to other computers via a network, thereby distributing the program.

[0042] A computer that executes such a program may first temporarily store the program recorded on a portable recording medium or transferred from a server computer in its own storage device. Then, when executing a process, the computer reads the program stored on its own recording medium and executes the process in accordance with the read program. Alternatively, the computer may read the program directly from a portable recording medium and execute the process in accordance with the program. Furthermore, the computer may execute the process in accordance with the program each time a program is transferred from a server computer to the computer. Alternatively, the server computer may not transfer the program to the computer, but may instead execute the process through a so-called ASP (Application Service Provider) service, which realizes the processing function by issuing an execution instruction and obtaining the results. Furthermore, the server computer may execute the process at the terminal using a so-called SaaS (Software as a Service) service, which allows users to use part of a server computer along with the program. In this embodiment, the program includes information used for processing by an electronic computer that is equivalent to a program (such as data that is not a direct instruction to a computer but has properties that dictate computer processing).

[0043] Furthermore, in this embodiment, the device is configured by executing a predetermined program on a computer, but at least a part of the processing contents may be realized by hardware.

[0044] 10 Model count device 101 Logical formula input unit 102 Conversion unit 103 Calculation unit 104 Weight input unit 105 Model count output unit 106 Monomial conversion unit 107 Logical operation unit 108 Weighted sum calculation unit 109 Matrix multiplication calculation unit 2000 Computer 2010 Control unit 2020 Recording unit 2030 Input unit 2040 Output unit 2050 Display unit

Claims

1. Variables x1, x2, …, x n and converting a logical formula consisting of: i is a tensor train in which only the (0,0,0) element of the i-th (i=1,2,…,n) tensor is set to 0 and the other elements are set to 1, and ¬x i converts the i-th (i=1,2,...,n) tensor into a tensor train in which only the (0,1,0) element is set to 0 and the other elements are set to 1, and the logical operation unit performs an operation to logically negate the tensor train, multiplying the element of the first 1×2×B1 tensor by -1, then expanding it to 1×2×(B1+1) and setting the elements (0,0,B1) and (0,1,B1) to 1, and for the i∈{2,3,...,n-1}-th tensor, A i ×2×B i The tensor (A i +1)×2×(B i +1) tensor and fill the expanded part with 0 and then add the element (A i ,0,B i ) and (A i ,1,B i ) and add 1 to the nth A n ×2×1 tensor (A n +1) × 2 × 1 and expand it to the element (A n ,0,0) and (A n A model counting device that performs a logical negation operation to generate a string of tensors, where n (i = 1, 2, ..., n) is set to 1, and a logical product operation to obtain the logical product of two tensor trains, where the i-th (i = 1, 2, ..., n) tensors in the tensor train are calculated, and the n tensors obtained by the calculation are arranged to generate the logical product.

2. A model counting device according to claim 1, wherein the logical product operation performed between the i-th (i=1, 2, ..., n) tensors of the tensor train is, when an Ax2xB tensor X and a Cx2xD tensor Y are operated on, all elements of the AxB matrix and the CxD matrix that share the same second index of the tensors are multiplied together to generate a tensor Z in which the elements after multiplication are arranged according to the following rules (where X(·,·,·), Y(·,·,·), and Z(·,·,·) represent the elements of tensors X, Y, and Z, and i=0,1, ...,A-1, k=0,1, ...,B-1, l=0,1, ...,C-1, m=0,1, ...,D-1, j=0,1); Model counting device.

3. A model counting device according to claim 1, comprising: a weighted sum calculation unit that generates n weighted sum matrices by weighting and summing two A×B matrices obtained by dividing an A×2×B tensor based on a second index for each tensor in the tensor train; and a matrix product calculation unit that calculates the product of the n weighted sum matrices.

4. Variables x1, x2, …, x n A method for calculating a model count by converting a logical formula consisting of: i is a tensor train in which only the (0,0,0) element of the i-th (i=1,2,…,n) tensor is set to 0 and the other elements are set to 1, and ¬x i converts the i-th (i=1,2,...,n) tensor into a tensor train with only the (0,1,0) element set to 0 and the other elements set to 1, and the logical operation unit performs a logical negation operation on the tensor train. After multiplying the element of the first 1×2×B1 tensor by -1, it expands it to 1×2×(B1+1) and sets the elements (0,0,B1) and (0,1,B1) to 1, and for the i∈{2,3,...,n-1}th tensor, A i ×2×B i The tensor (A i +1)×2×(B i +1) tensor and fill the expanded part with 0 and then add the element (A i ,0,B i ) and (A i ,1,B i ) and add 1 to the nth A n ×2×1 tensor (A n +1) × 2 × 1 and expand it to the element (A n ,0,0) and (A n A model counting method that performs a logical negation operation to generate a sequence of tensors, where n is the number of tensors in a tensor train, and n is the number of tensors in a tensor train, where n is the number of tensors in a tensor train.

Citation Information

Patent Citations

  • Network reliability calculation method, network reliability calculation device and program

    JP2024011067A