PageRenderTime 38ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/Applications/LatinSquares/plans/general.hpp

https://github.com/exp04shy/oklibrary
C++ Header | 223 lines | 4 code | 4 blank | 215 comment | 0 complexity | d02d631bef2e447a9d6b6991af2fc206 MD5 | raw file
  1. // Oliver Kullmann, 16.1.2006 (Swansea)
  2. /* Copyright 2006 - 2007, 2008, 2009 Oliver Kullmann
  3. This file is part of the OKlibrary. OKlibrary is free software; you can redistribute
  4. it and/or modify it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation and included in this library; either version 3 of the
  6. License, or any later version. */
  7. /*!
  8. \file Applications/LatinSquares/plans/general.hpp
  9. \brief Plans for the module on searching latin squares and generalisations
  10. \todo Update namespaces.
  11. \todo Update milestones.
  12. \todo Update the following todos.
  13. \todo Review: Software and literature review.
  14. \todo Connections to other modules
  15. <ul>
  16. <li> See
  17. ComputerAlgebra/CombinatorialMatrices/Lisp/LatinSquares/plans/general.hpp.
  18. </li>
  19. <li> See
  20. ComputerAlgebra/Satisfiability/Lisp/Generators/plans/LatinSquares.hpp
  21. for generators for SAT-problems at Maxima/Lisp level. </li>
  22. <li> Compare topic "Generators for finding incidence structures and
  23. designs" in Transformers/Generators/plans/general.hpp. </li>
  24. </ul>
  25. \todo Basic direct algorithms
  26. <ul>
  27. <li> Write tests, whether one square is a latin square, and whether
  28. a sequence of squares is mutually orthogonal (these tests are only for
  29. result-checking). </li>
  30. <li> See predicates ls_p, ols_p and mols_p in
  31. ComputerAlgebra/Satisfiability/Lisp/Generators/tests/LatinSquares.mac.
  32. </li>
  33. </ul>
  34. \todo Active clause-sets
  35. <ul>
  36. <li> By combinining injectivity (bijectivity) constraints,
  37. the extension problem for latin squares and the problem of finding
  38. mutually orthogonal sets of latin squares (MOLS) shall be provided as
  39. an active clause-set. </li>
  40. <li> Perhaps the matching techniques
  41. underlying the injectivity constraints can be generalised?! </li>
  42. <li> Perhaps is makes sense for an array v_ij of variables
  43. to have an active clause-set LS((v_ij)), expressing that the variables
  44. form a latin square. </li>
  45. <li> The direct implementation of LS((v_ij))
  46. uses INJ((v_1j, ..., v_nj) and INJ(v_i1, ..., v_in). </li>
  47. <li> Such active clause-sets do not offer poly-time performance for (e.g.)
  48. satisfiability checking, but they might be useful if it has
  49. nevertheless "special knowledge". LS(V) could offer
  50. only incomplete services (then it should be poly-time), or it
  51. might offer complete services (then it won't be poly-time).
  52. </ul>
  53. \todo Completing partial latin squares
  54. <ul>
  55. <li> Every partial latin squares of order n with n-1 entries can be
  56. completed (and there exists an efficient algorithm for it): How do the
  57. various (generalised) SAT algorithms perform here? </li>
  58. <li> Consider a partial latin square of order n with n+k entries. One could
  59. conjecture that it can be completed iff the alliance of active clause-sets
  60. given by the bijectivity-constraints is not found inconsistent by r_k
  61. reduction? (The case k = 0 follows by [Andersen, Hilton, 1983].) </li>
  62. </ul>
  63. \todo Strong hypergraph colouring
  64. <ul>
  65. <li> A latin square of dimension n is nothing else than a
  66. hypergraph G_n with 2n hyperedges of size n for the
  67. rows and columns together with the strong n-colouring
  68. problem for hypergraphs
  69. (see Hypergraphs/Colourings/plans/StrongColouring.hpp). </li>
  70. <li> What can be done specially for latin squares, which cannot
  71. be done in general for the strong hypergraph colouring problem?
  72. (For example regarding symmetries?) </li>
  73. </ul>
  74. \todo MOLS
  75. <ul>
  76. <li> MOLS((v_ijk)) can be expressed by
  77. <ol>
  78. <li> LS((v_ij1)), ..., LS((v_ijn))
  79. <li> for 1 <= k1 < k2 <= k introduce variables w_{ij(k1,k2)} with
  80. domains {1,...,n}^2 and
  81. w_{ij(k1,k2)} = (v1, v2) <-> v_{ijk1} = v1 and v_{ijk2} = v2; </li>
  82. <li> now require INJ(w_{ij(k1,k2)}) for every pair (k1,k2). </li>
  83. </ol>
  84. </li>
  85. <li> The second type of active clause-sets can be captured by active
  86. clause-sets MOS((v_ij), (v'_ij)) ("mutually orthogonal squares"; note that
  87. this notion makes sense for arbitrary squares). Thus MOLS((v_ijk)) becomes
  88. the conjunction of LS for all single squares and MOS for all
  89. pairs of squares. </li>
  90. <li> The new variables w are only necessary if we want to use INJ directly
  91. on variables; expressing INJ "by hand", we can express MOS(v, v') as a
  92. conjunction of of (n^2 over 2) * n^2 = n^4 * (n^2 - 1) / 2 4-clauses using
  93. only the variables v, v'. </li>
  94. <li> If n is the uniform domain size (the order of the latin square), then
  95. for all 2-sets {(p,q), (p',q')}, where p,q,p',q' in {1, ..., n}, and for all
  96. eps, eps' {1, ..., n} we get the 4-clause
  97. (v_pq <> eps or v_p'q' <> eps or v'_pq <> eps' or v'_p'q' <> eps'). </li>
  98. </ul>
  99. \todo Sizes
  100. <ul>
  101. <li> Thus the sizes for the direct clause representation are (using LS(n)
  102. for the clause-set expressing the condition on the existence of a latin
  103. square of order n, and MOS(n,k) for the condition on the existence of k
  104. squares of order n which are mutually orthogonal):
  105. <ol>
  106. <li> LS(n) has 2*n*binomial(n,2)*n = n^3 * (n-1) = O(n^4) 2-clauses
  107. (using n^2 variables, each with domain size n). </li>
  108. <li> MOS(n, k) has binomial(k,2)*n^4*(n^2-1)/2 = k*(k-1)*n^4*(n^2-1)/4 =
  109. O(k^2 * n^6) 4-clauses (using k*n^2 variables, each with domain size n).
  110. </li>
  111. <li> MOLS(n,k) has k * n^3 * (n-1) = O(k * n^4) 2-clauses and
  112. k*(k-1)*n^4*(n^2-1)/4 = O(k^2 * n^6) 4-clauses
  113. (using k*n^2 variables, each with domain size n). </li>
  114. </ol>
  115. </li>
  116. <li> For n=10 we get that MOLS(n,k) has k * 9000 2-clauses (9000 for each
  117. LS), and k*(k-1) * 247500 4-clauses, and that with k * 100 variables of
  118. domain size 10. </li>
  119. <li> For k=3 we get 27,000 2-clauses and 1,485,000 4-clauses with 300
  120. variables of domain size 10, which is pretty big. In principle one can
  121. run a SAT solver on it, but likely without active clause-sets we won't have
  122. a chance. </li>
  123. </ul>
  124. \todo N(n)
  125. <ul>
  126. <li> For n >= 1 let N(n) be the maximal number of MOLS. Thus
  127. <ol>
  128. <li> N(1) = 1 </li>
  129. <li> N(n) <= n - 1 for n >= 2 </li>
  130. <li> N(n) = n - 1 if n = p^k for a prime number p and a natural number
  131. k >= 1 </li>
  132. <li> N(6) = 1 </li>
  133. </ol>
  134. </li>
  135. <li> This determines N(n) for 1 <= n <= 9. The first open case is N(10).
  136. </li>
  137. <li> It is known
  138. <ol>
  139. <li> n notin {1, 2, 6} -> N(n) >= 2 </li>
  140. <li> n >= 2: either N(n) = n - 1 or N(n) <= n - 4 </li>
  141. <li> N(10) <> 9 (computer experiments showed that there is no
  142. projective plane of order 10). </li>
  143. </ol>
  144. Thus 2 <= N(10) <= 6 (more recent results?). Can we improve this?! </li>
  145. <li> The next case is N(12). It is known that 5 <= N(12) <= 11 (more
  146. recent results?); can we improve this?! </li>
  147. <li> Apparently for all n >= 11 it is known N(n) >= 3 ?! </li>
  148. <li> Two approaches possible: starting from above,
  149. showing that the problem is unsatisfiable, or starting from below,
  150. showing that the problem is satisfiable.) </li>
  151. <li> In general we have:
  152. <ol>
  153. <li> N(n) = n - 1 iff an affine plane of order n exists iff a projective
  154. plane of order n exists. </li>
  155. <li> It is stated in [Beth, Jungnickel, Lenz] that the exact value of N(n)
  156. is only known for n = p^k, p prime number, k >= 0, and for n = 6. </li>
  157. </ol>
  158. </li>
  159. </ul>
  160. \todo Experiments
  161. <ul>
  162. <li> So we could try decide MOLS(10,3) or MOLS(10,6) --- in both cases any
  163. result SAT/UNSAT would yield a new bound (most interesting:
  164. MOLS(10,3) in UNSAT => N(10) = 3, MOLS(10,6) in SAT => N(10) = 6). </li>
  165. <li> Not a new result, but still interesting (and publishable) would be,
  166. if a generalised SAT solver could show the unsatisfiability of some
  167. MOLS(10,k) for 7 <= k <= 9. </li>
  168. </ul>
  169. \todo Pairs of orthogonal latin squares
  170. <ul>
  171. <li> MOLS(n,2) in SAT for all n notin {1,2,6} yields interesting
  172. satisfiable problems. </li>
  173. </ul>
  174. \todo The upper bounds for N(k)
  175. <ul>
  176. <li> MOLS(n,n) in UNSAT for all n yields unsatisfiable problems, which
  177. could also be interesting (at least for active clause-sets; real clause-sets
  178. get very soon very big). </li>
  179. </ul>
  180. */
  181. /*!
  182. \namespace OKlib::LatinSquares
  183. \brief Tools for latin squares and generalisations and refinements.
  184. */
  185. namespace OKlib {
  186. namespace LatinSquares {
  187. }
  188. }