Let be a set of integers, be a set of nonnegative integers.
A system of nonnegative linear Diophantine equations (NLDE for short) is a linear system
For example, consider the NLDE system with equations and unknowns:
NLDE system (1) is homogenous, if is null vector . Any homogenous NLDE system has the trivial solution .
For any NLDE system a corresponding homogenous system can be constructed replacing right-hand side by . For example, the corresponding homogenous NLDE system for (2) is
If is a solution of (1) and is a solution of the corresponding homogeneous system, then is also a solution of (1) for any nonnegative integer .
Nontrivial solution of homogenous NLDE system is indecomposable if it is not a sum of two nontrivial solutions of the same homogenous system. Solution of NLDE system (1) is indecomposable if it is not a sum of another solution and a nontrivial solution of the corresponding homogenous system. For instance, the solution of NLDE system (2) is decomposable. The solution of the homogenous system (3) is decomposable. The solutions and (of NLDE systems (2) and (3) respectively) are indecomposable.
The notion ``a indecomposable solution'' for NLDE systems is equivalent to ``a minimal solution'', where the minimality is considered with respect to standard component-wise ordering. For example, is minimal (for system (2)) and, therefore, there is no another solution such that ; is minimal (for system (3)) and, therefore, there is no another (nontrivial) solution such that
Hilbert basis of NLDE system (1) is a pair , where is the set of all minimal (indecomposable) solutions of the NLDE system, and is the set of all minimal (indecomposable) solutions of the corresponding homogenous system.
Sets and are always finite. They describe the set of all solutions of (1). Namely, any solution can be computed as:
For example, all solutions of NLDE system (2) are described by the formula:
This is very simular to the theory of linear equations: general solution is a sum of a particular solution and a linear combination of homogenous ones. However, the NLDE case has its own specifics: one particular solution is not enough to describe all solutions; there must be a set (but finite) of particular solutions. For the above example, at least two particular solutions are required.
See monograph [9] and papers [10,11] as classic introduction to the area.
The basic computation problems for a given NLDE system are listed below.
The listed problems are very complex in the computational sense. The solvability and particular solution searching problems are NP-complete [9]. The problem of searching Hilbert basis is even more complex--overNP.
This is a reason for discovering particular classes of NLDE systems that have efficient (polynomial) algorithms for solving. We suggest (basing on the original work of M. Filgueiras and A.-P. Tomás [1]) an interesting approach for this--using formal grammars to establish such classes of NLDE systems.
A formal grammar is assigned to a NLDE system and solution searching is moved from set to a set of derivations in the grammar--one searches a derivation instead of a NLDE solution (see Figure 2). The idea is the same as in operations calculus, where the problem of solving an integral-differential equation is reduced to solving an algebraic equation in complex numbers.
The methods and algorithms of the formal grammars theory have been very developed starting from 50th. Our approach turns out that they can be fruitfully used to construct really efficient algorithms for solving some particular classes of NLDE system. The efficiency means here that the algorithms are polynomial or pseudo-polynomial (comparing with the general NP-complete and overNP case with exponential complexity). The pseudo-polynomiality allows to select those problems (from the set of complex ones) that are permissible for practical solving.
Consider a CF-grammar and two strings and . Let have rules ( ), nonterminals ( ), and terminals ( ). Grammar rules has the form , where is a string in . The start nonterminal symbol is not required.
One can construct an associated with the grammar NLDE system (ANLDE system for short) as follows:
The ANLDE system has unknowns (correspond to grammar rules), equations (correspond to grammar symbols). Each set contains indices such that rule has right-hand side with nonterminal , i.e. . The coefficients is the number of occurrences of nonterminal ( , ) and terminal ( , ) in the right-hand side of the rule . The coefficients is the difference between the number of occurancies of ( , ) and ( , ) in the strings and .
For example, consider the grammar with nonterminals and (),
the only terminal () and rules (listed in
Table 1, col. 1).
Let us note the requirement may be reduced to . If there is some , then one can add to both sides of some equation (but exactly to one equation!). For example, the NLDE system
The following theorem shows the relation between derivations in a CF-grammar and solutions of the ANLDE system.
Therefore, for the ANLDE system form Table 1, each successful derivation corresponds to a solution. Consider such a derivation:
Definition of ANLDE system does not take into account the order of symbols in strings (, , right-hand sides of rules ). Let us define as a multiset of all symbols of (the number of occurances is taken into account!). For example, . Using this notation, means that the strings and differ in order of symbols only. Binary operation is a symmetric difference of two multisets.
According to the theorem, one can take the grammar (see the above example) and . ANLDE system are the same. The derivation
This means one does not take into account i) the order of symbols in , , and ii) symmetric addition/subtraction of symbols in , .
The Web-SynDic system uses ANLDE systems in the following format:
# Comment
x1 + x2 + ... + xK2 = c11*x1 + c12*x2 + ... + c1N*xN
x[K2+1] + x[K2+2] + ... + xK3 = c21*x1 + c22*x2 + ... + c2N*xN
...
x[KM+1] + x[KM+2] + ... + xN = cM1*x1 + cM2*x2 + ... + cMN*xN
The format represents one ANLDE system. c11, c12, ..., c1N, c21, c22, ..., cMN are coefficients (optional, default value is 1). x1, x2, ..., xN are unknowns, may appear in any order, some may be skipped. If there is no unknowns after the ``='' sign, write ``0''. Each unknown must appear in the left-hand side of some equation at most one time. Blank and comment lines are ignored.
The sample of ANLDE system:
# Sample ANLDE system
x1 + x4 = 2*x1 + 3*x3
x2 + x3 = x1 + 2*x2 + x3
Format for a set of ANLDE systems is following:
<ANLDE system 1>
%
<ANLDE system 2>
%
...
<ANLDE System N>
The format represents ANLDE System Set <ANLDE System 1>, ...,
<ANLDE System N>.
Each system is in the ANLDE system format. Blank and comment lines are ignored.
String with symbols(s) '%
' is a delimiter for ANLDE systems.
These strings may additionally contain blank symbols
('
', '\t
') only.
Kirill Kulakov 2005-12-04 |