<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta>
      <journal-title-group>
        <journal-title>from the most detailed survey monograph devoted to the knapsack
problem [7].
The importance of this topic from the point of view of cryptography is confirmed by numerous
works in specialized journals.</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>Dependence of the Average Number of Solutions in the Knapsack Problem on the Parameters of the Constraint Domain</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Vladimir K. Leontiev</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Eduard N. Gordeev</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Bauman Moscow State Technical University</institution>
          ,
          <addr-line>5/1 2nd Baymanskay ul., Moscow, 105005</addr-line>
          ,
          <country country="RU">Russia</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Dorodnicyn Computing Centre of RAS</institution>
          ,
          <addr-line>119133, Moscow, 40 Vavilova ul., Moscow, 119133</addr-line>
          ,
          <country country="RU">Russia</country>
        </aff>
      </contrib-group>
      <fpage>107</fpage>
      <lpage>114</lpage>
      <abstract>
        <p>The knapsack problem is used in many mathematical models, including in the field of information security. Solving a problem (finding the optimal knapsack load) or even answering the question about the existence of a valid solution is an NP-complete problem. In this regard, the question of finding the power of the set of acceptable solutions or estimates of this power is relevant. The paper analyzes the combinatorial aspects of this problem based on the method of generating functions. Formulas and estimates for the number of solutions and the average number of solutions depending on the coefficients of the constraint vector are obtained. On their basis, computational algorithms for finding these values can be constructed. All this can be used to assess the adequacy and quality of the original mathematical model.</p>
      </abstract>
      <kwd-group>
        <kwd>1 Knapsack problem</kwd>
        <kwd>search for an optimal solution</kwd>
        <kwd>optimization problem</kwd>
        <kwd>feasible solutions</kwd>
        <kwd>generating functions</kwd>
        <kwd>estimates of the number of solutions</kwd>
        <kwd>NP-completeness</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>For example, in the works of G.V. Balakin [8] and [9] consider specific classes of systems of
Boolean equations (of recurrent type) and their application in cryptography.</p>
      <p>In the work of A.M. Zubkov [10] the moment characteristics of the weights of vectors in random
binary linear codes are described in terms of the properties of special systems of equations.</p>
      <p>Linearization of systems of Boolean equations is a method for solving systems, which consists in
replacing all monomials of degree higher than the first with new variables, solving the resulting linear
system and then checking the obtained solutions for correctness. This, for example, is the subject of the
articles [11], [12].</p>
      <p>A group of scientists led by N. Courtois proposed improvements to XL4 and XSL5 of the
linearization method for cases when the number of equations in the system is not enough to effectively
apply linearization in the classical form [13]. The essence of these methods is to supplement the system
with new equations that do not change the set of solutions to the system, but increase the size of the
system and the rank of the linearized system. Later N. Courtois and G.V. Bard [14] proposed another
method based on the ElimLin linearization method.</p>
      <p>As it was said in the annotation, in our work we consider the problem of finding the number of
feasible solutions. The results along this path are illustrated by works [15-17]. And in the applied works
of A.S. Meluzov [18] and [19], a software package was developed and implemented to solve the above
problem.</p>
      <p>This article also discusses the problem of parametrization of the system on its right side. The authors
are not aware of any analogues of the approach presented here. To some extent, both classical
algorithms of parametric linear programming and, for example, work [20], where linear equations of
the Boolean type with a “distorted” right-hand side are investigated, are related to it.</p>
      <p>The paper proposes a method for constructing a set containing the desired vector with a probability
not less than a given one, and estimates the cardinality of this set. Theoretical calculations of the
parameters of the method are illustrated by the results of experiments. This approach uses a probabilistic
setting, while the combinatorial apparatus is used here.</p>
      <p>This work consists of an introduction and three sections. The main lemma is given in the next
section. In the third section, we consider the question of the average number of solutions depending on
the values of the right-hand side, and then in the section following this we consider the case of a
hypercube of bounded volume.</p>
      <p>Some definitions, concepts and methods of proof were previously used by the authors in [3-6].</p>
      <p>In what follows, we will assume that all the parameters of the problem under consideration, the
numbers c1,…,cn; a1,…,an; b - non-negative integers.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Generating functions for the number of feasible solutions</title>
      <p>The answer to the question about the existence of solutions to the problem under consideration is
already an NP-complete problem. Therefore, finding the number of solutions to the knapsack problem
is currently carried out either by exhaustive search algorithms, or is estimated from heuristic methods.</p>
      <p>In both cases, knowledge of the average number of solutions can be used both for constructing
algorithms and for modifying them. In addition, formulas for finding the average number of solutions
depending on the parameters of the problem can be used to assess the feasibility of using both
exhaustive search and heuristic algorithms.</p>
      <p>For example, we need to find at least one solution to an individual problem that lies in a class of
problems with a fixed right-hand side. We find the average number of solutions in this class. If it is
large, then this can serve as a justification for the expediency of using heuristic or probabilistic methods.
Otherwise, the exhaustive search algorithm is most likely more reasonable.</p>
      <p>The main method that is used in the work is the method of generating functions.</p>
      <p>First, we directly express the volume of feasible solutions using the generating function for
Pb ( z1,..., zn ) = ∑ z a1x1 z a2x2 ...znanxn .</p>
      <p>1 2
x∈Vb</p>
      <sec id="sec-2-1">
        <title>The following lemma was proved in [4].</title>
        <p>Lemma 1. The following formula is valid</p>
        <p>1 − u
Consequence. Let 0 &lt;ρ &lt;1. Then equality holds for the volume of the region of feasible solutions:
1 (1 + ua1 )...(1 + uan )
| Vb |=</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3. Average number of feasible solutions</title>
      <p>Let us now consider the question of the average value of the volume of solutions.
Let be</p>
      <p>
        Recall that our variables are Boolean. The number b is fixed, and the dimension n is also fixed.
Therefore, each coefficient of the constraint vector varies from 0 to b, i.e. takes n + 1 values. Hence
(
        <xref ref-type="bibr" rid="ref5">5</xref>
        ) follows.
      </p>
      <p>Of course, the question of the average number of solutions is rather theoretical in nature.
However, it sheds light on the combinatorics of the problem when investigating the interdependence
of b and n.</p>
      <p>Below we give several statements that give various formulas (calculation algorithms) for the
average number of solutions. As an illustration of the use of the method of generating functions,
their proofs are presented.</p>
      <p>Theorem 1. The following formula is valid</p>
      <p>1 n
| Vb | =1)n∑k=0 (b + CnkCbn−k (b + 2)k .</p>
      <p>
        Proof. Directly from (
        <xref ref-type="bibr" rid="ref4">4</xref>
        ) and (
        <xref ref-type="bibr" rid="ref5">5</xref>
        ) we have
(
        <xref ref-type="bibr" rid="ref3">3</xref>
        )
(
        <xref ref-type="bibr" rid="ref4">4</xref>
        )
(
        <xref ref-type="bibr" rid="ref5">5</xref>
        )
(
        <xref ref-type="bibr" rid="ref6">6</xref>
        )
Further, we note that, firstly,
b
∑ (1 + uak ) = 2 + (1 + u) + ... + (1 + ub ) = 2 + b +
ak =0
u − ub+1
1 − u
      </p>
      <p>.
n−k
Secondly, (1 − ub )n−k =1 − Cn1−kub + Cn2−ku2b − ... =∑ (−1)i Cni −kuib .</p>
      <p>i=0</p>
      <p>Therefore, further we have</p>
      <p>
         u 
∫  
2π i |u|=ρ  1 − u 
ub+1
Therefore, from (
        <xref ref-type="bibr" rid="ref7">7</xref>
        ) it follows:
n−k
(1 − ub )n−k =1 − Cn1−kub + Cn2−ku2b − ... =∑ (−1)i Cni −kuib .
      </p>
      <p>i=0</p>
      <sec id="sec-3-1">
        <title>After obvious transformations, we obtain</title>
        <p>
          (−1)b+k −n C−bn++kk−−n1 =(−1)b+k −n C−b(+nk−−kn+1) =−n Cbb+k
But now the assertion of the theorem follows from (
          <xref ref-type="bibr" rid="ref7">7</xref>
          ) and (
          <xref ref-type="bibr" rid="ref8">8</xref>
          ).
        </p>
        <p>The theorem is proved.
=n−k. C
b
Let's look at this expression from the other side.</p>
        <p>Theorem 2. The following formula is valid</p>
        <p>(b +11)n ∑n0 k =u−b+n−k Cnk (b + 2)k Couef {(1 + u)b −1} =(b +11)n Couef  (1u+b−un+)1b ∑n0 k Cnk  b +u 2 k  =
1  (1 + u)b  b + 2 n 
=Couef (b + 1)n  ub−n+1 (1 +  u  </p>
        <p>1  (1 + u)b
=Coef 
(b + 1)n u  ub+1</p>
        <p>
(u + b + 2)n 

=
1  (1 + u)b
=Coef 
(b + 1)n u  ub+1</p>
        <p>
((1 + u) + (b + 1))n 

 n
 ∑ Cnk (1 + u)k (b + 1)n−k 
=Couef (b1+)n  k =0 ub+1  (1 + u)b =
 
1 n  (1 + u)b+k 
=∑ Cnk (b + 1)n−k Coef   (1 + u)b
(b + 1)n k =0 u  ub+1 
1 n
=∑ CnkCbb+k (b + 1)n−k .</p>
        <p>(b + 1)n k =0</p>
      </sec>
      <sec id="sec-3-2">
        <title>The theorem is proved. 110 (7) (8)</title>
        <p>
          (
          <xref ref-type="bibr" rid="ref9">9</xref>
          )
Examples.
1. Let n=b=2, then we have 9 restrictions: 1) x1+x2≤2; 2) 2x1+x2≤2; 3) x1+2x2≤2; 4) 2x1+2x2≤2.
. And 4 more with one variable, as well as with two zero coefficients for variables. The last 5
have four solutions, and for the first four we have: |V1|=4; |V2|=3; |V3|=3; |V4|=3.
        </p>
        <p>Directly we get: | Vb |
=33 / 9
4. Average number of solutions to the knapsack problem on a hypercube of a
fixed size</p>
        <p>Let us now consider the question of the average value of the volume of feasible solutions on a
hypercube of a fixed size.</p>
        <p>Let be
tb (a1,..., an ) =
1
∫

2π i |u|=ρ
(1 + ua1 )...(1 + uan )
=1,..., n and t c is the average value for the volume of feasible solutions on a
.</p>
        <p>Therefore, we have
t c</p>
        <p>  c + 2 +
1 1  
= ∫
(c + 1)n 2π i |u| ρ 


  u − uc+1 n </p>
        <p> 
1 − u   1 1</p>
        <p> du
=u)ub+1 (1 −


=1n 1</p>
        <p>∑ Cnk (c + 2)k
(c + 1)n k =0
Now we will find the sum of the residues to calculate the integral
 ((c + 2)(1 − u) + u(1 − uc ))n 
=(1 (c + 1)n 2π i |u|∫ρ =u)n+1ub+1 −  du

1  (1 − u)−n+k −1(1 − uc )n−k 
2π i |u|∫=ρ  ub+1+k −n  du .</p>
        <p>n−k
Now, note that, (1 − uс )n−k =1 − Cn1−kuс + Cn2−ku2с − ... =∑ (−1)i Cni −kuiс .
i=0
Therefore</p>
        <p>1 n
t c = (c + 1)n ∑k0 Cnk (c + 2)k</p>
        <p>1  (1 − u )k −n−1 n−k
=i|u|∫=ρ 2π  ub+k −n+1 ∑r0 =du (−1)r Cnr−ku rc =
=
1 n n−k 1  (1 − u )k −n−1 </p>
        <p>∑ Cnk (c + 2)k ∑ (−1)r Cnr−k 2π i |u|=ρ  ub+k −n+1−rc  du .</p>
        <p>(c + 1)n k =0 r =0 ∫  
Notice, that
1  (1 − u)−n+k −1 </p>
        <p>∫ 
2π i |u|=ρ  ub+1+k −n−кс  du
</p>
        <p> 0, b − rc ≤ 0
=−n+b−rc (−1)k C−b(−nr−c−k+n1+)k , b − rc ≥ n − k .</p>
        <p>
In the general case, we obtain</p>
        <p>1 n n−k
t c = ∑ Cnk (c + 2)k ∑ (−1)r Cnr−k (−1)k −n+b−rc C−b(−nr−c−k+n1+)k
(c + 1)n k =0 r =0
1 n n−k
= ∑ Cnk (c + 2)k ∑ (−1)r Cnr−kCbn−−rkc .</p>
        <p>(c + 1)n k =0 r =0</p>
      </sec>
      <sec id="sec-3-3">
        <title>The theorem is proved.</title>
        <p>=1 ∑n Cnk (c + 2)k ∑n−k (−1)r Cnr−kCbb−−rrcc−n+k
(c + 1)n k =0 r =0</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>5. Conclusions</title>
      <p>The method of generating functions can be successfully applied to the analysis of problems of a
"combinatorial" nature. In the above study, with its help, new formulas were obtained for the number
of olutions and the average number of solutions in the knapsack problem.</p>
      <p>They can be improved and refined by considering equations not of a general, but of a special form.
It is these problems that arise in specific applied areas, in particular, in mathematical models of
information security, taking into account the real features of the original formulations.</p>
      <p>Therefore, the results presented here can serve as a basis for further research.</p>
      <p>The reliability of the results follows from the correctness of the definitions and proofs of the
theorems.</p>
    </sec>
    <sec id="sec-5">
      <title>6. Acknowledgements</title>
      <p>The work was carried out with the support of a grant from the Russian Academy of Sciences: RFBR
grant 20-01-00645.</p>
      <p>.</p>
    </sec>
    <sec id="sec-6">
      <title>7. References</title>
      <p>[14] N. Courtois, G.V. Bard, Algebraic cryptanalysis of the data encryption standard, IMA International
Conference on Cryptography and Coding Theory. Lecture Notes in Computer Science
SpringerVerlag, Berlin, 2007, pp. 152-169. doi: https://doi.org/10.1007/3-540-36178-2_17.
[15] F. Massacci, L. Marraro, Logical Cryptanalysis as a SAT Problem, Journal of Automated</p>
      <p>Reasoning 24 (2000) 165-203. doi:10.1023/A:1006326723002.
[16] C. Fiorini, E. Martinelli, F. Massacci, How to fake an RSA signature by encoding modular root
nding as a SAT problem, Discrete Applied Mathematics 130 (2003) 101-127.
[17] I. Mironov , L. Zhang, Applications of SAT Solvers to Cryptanalysis of Hash Functions, in: A.</p>
      <p>Biere , C.P. Gomes (Eds), Theory and Applications of Satisfiability Testing - SAT 2006, Lecture
Notes in Computer Science, Springer, Berlin, Heidelberg, Vol. 4121, 2006, pp. 102-115. doi:
https://doi.org/10.1007/11814948_13
[18] A.S. Meluzov, Construction of effective algorithms for solving systems of polynomial Boolean
equations by testing a part of variables, Discrete Math. Appl., 21 (2011) 381–395. doi:
10.1515/DMA.2011.024.
[19] A.S. Meluzov, The use of associative information processing for constructing algorithms for
solving systems of Boolean equations, Mathematics and Mathematical Physics 50(2010)
19251940. doi:10.1134/S0965542510110151.
[20] E.K. Alekseev, I.V. Oshkin, V.O. Popov, S.V. Smyshlyaev, Solving systems of linear Boolean
equations with noisy right-hand sides over the reals, Discrete Math. Appl., 28 (2018) 1-5. doi:
10.1515/dma-2018-0001.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>H.</given-names>
            <surname>Papadimitriou</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Steiglitz</surname>
          </string-name>
          ,
          <article-title>Combinatorial optimization</article-title>
          .
          <source>Mir</source>
          , Moscow,
          <year>1989</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>S.P.</given-names>
            <surname>Gorshkov</surname>
          </string-name>
          <string-name>
            <surname>S. P.</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.V.</given-names>
            <surname>Tarasov</surname>
          </string-name>
          ,
          <article-title>The complexity of solving systems of Boolean equations</article-title>
          .
          <source>Kurs</source>
          , Moscow
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>V.K.</given-names>
            <surname>Leontiev</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.N.</given-names>
            <surname>Gordeev</surname>
          </string-name>
          ,
          <article-title>Generating functions in the knapsack problem</article-title>
          ,
          <source>Reports of the Academy of Sciences</source>
          <volume>481</volume>
          (
          <year>2018</year>
          )
          <fpage>478</fpage>
          -
          <lpage>480</lpage>
          . doi:
          <volume>10</volume>
          .31857/S086956520002139-5.
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>V.K.</given-names>
            <surname>Leontiev</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.N.</given-names>
            <surname>Gordeev</surname>
          </string-name>
          ,
          <article-title>On some combinatorial properties of the backpack problem</article-title>
          ,
          <source>Journal of computational mathematics and mathematical physics</source>
          <volume>59</volume>
          (
          <year>2019</year>
          )
          <fpage>1439</fpage>
          -
          <lpage>1447</lpage>
          . doi:
          <volume>10</volume>
          .1134/S0044466919080076.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>V.K.</given-names>
            <surname>Leontiev</surname>
          </string-name>
          ,
          <article-title>Boolean polynomials and linear transformations</article-title>
          ,
          <source>Reports of the Academy of Sciences</source>
          <volume>425</volume>
          (
          <year>2009</year>
          )
          <fpage>478</fpage>
          -
          <lpage>480</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>V.K.</given-names>
            <surname>Leontiev</surname>
          </string-name>
          ,
          <source>Combinatorics and information. Part</source>
          <volume>1</volume>
          .
          <string-name>
            <surname>Combinatorial</surname>
            <given-names>analysis</given-names>
          </string-name>
          , Moscow, MFTI,
          <year>2015</year>
          , 174 p.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>H.</given-names>
            <surname>Kellerer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>U.</given-names>
            <surname>Pferschy</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Pisinger</surname>
          </string-name>
          , Knapsack problems, Berlin, Springer,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>G.V.</given-names>
            <surname>Balakin</surname>
          </string-name>
          ,
          <article-title>On solving some classes of systems of Boolean equations of recurrent type</article-title>
          ,
          <source>Mathematical questions of cryptography 4-1</source>
          (
          <year>2013</year>
          )
          <fpage>5</fpage>
          -
          <lpage>25</lpage>
          . doi:
          <volume>10</volume>
          .4213/mvk71.
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>G.V.</given-names>
            <surname>Balakin</surname>
          </string-name>
          ,
          <article-title>On the possibility of partial recovery of some sequences from observations</article-title>
          ,
          <source>Mathematical questions of cryptography 4-4</source>
          (
          <year>2013</year>
          )
          <fpage>7</fpage>
          -
          <lpage>25</lpage>
          . doi: https://doi.org/10.4213/mvk97.
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <surname>A.M. Zubkov</surname>
            ,
            <given-names>V.I. Kruglov</given-names>
          </string-name>
          ,
          <article-title>Moment characteristics of vector weights in random binary linear codes</article-title>
          ,
          <source>Mathematical questions of cryptography 3-4</source>
          (
          <year>2013</year>
          )
          <fpage>55</fpage>
          -
          <lpage>70</lpage>
          . doi: https://doi.org/10.4213/mvk67.
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <surname>J.-C Faug</surname>
          </string-name>
          <article-title>'re, A new efficient algorithm for computation Grebner bases (F4 )</article-title>
          ,
          <source>Journal of pure and applied algebra</source>
          <volume>139</volume>
          (
          <year>1999</year>
          ) Issues 1-3
          <fpage>61</fpage>
          -
          <lpage>88</lpage>
          . doi: https://doi.org/10.1016/S0022-
          <volume>4049</volume>
          (
          <issue>99</issue>
          )
          <fpage>00005</fpage>
          -
          <lpage>5</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <surname>J.-C Faug</surname>
          </string-name>
          <article-title>'re, A new efficient algorithm for computation Grebner e o bases without reduction to zero (F5 )</article-title>
          ,
          <source>Proceedings of the 2002 international symposium on Symbolic and algebraic computation</source>
          <year>2002</year>
          , Universit´e de Lille, France, ACM Press,
          <year>2002</year>
          , pp.
          <fpage>75</fpage>
          -
          <lpage>83</lpage>
          . doi: https://doi.org/10.1145/780506.780516.
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>N.</given-names>
            <surname>Courtois</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Pieprzyk</surname>
          </string-name>
          ,
          <article-title>Cryptanalysis of block chiphers with overdened systems of equations</article-title>
          ,
          <source>Proc. 8th Int. Conf. on the Theory and Application of Cryptology and Information Security</source>
          . Springer, Berlin,
          <year>2002</year>
          , pp.
          <fpage>267</fpage>
          -
          <lpage>287</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>