pymodrev 0.5.4__tar.gz → 0.5.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (248) hide show
  1. {pymodrev-0.5.4/src/pymodrev.egg-info → pymodrev-0.5.6}/PKG-INFO +1 -1
  2. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/__init__.py +2 -4
  3. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/api.py +69 -75
  4. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/asp_rules/async.lp +5 -0
  5. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/asp_rules/reach.lp +4 -3
  6. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/cli.py +7 -7
  7. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/configuration.py +1 -1
  8. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/network/function.py +5 -5
  9. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/network/inconsistency_solution.py +2 -1
  10. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/network/model.py +13 -10
  11. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/network/observation.py +10 -4
  12. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/parsers/parser_observation.py +6 -5
  13. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/repair/consistency.py +7 -6
  14. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/repair/engine.py +0 -1
  15. pymodrev-0.5.6/src/pymodrev/repair/function_search.py +536 -0
  16. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/repair/topology.py +69 -45
  17. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/updaters/updater.py +113 -28
  18. {pymodrev-0.5.4 → pymodrev-0.5.6/src/pymodrev.egg-info}/PKG-INFO +1 -1
  19. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev.egg-info/SOURCES.txt +2 -0
  20. pymodrev-0.5.6/src/pymodrev.egg-info/scm_file_list.json +240 -0
  21. pymodrev-0.5.6/src/pymodrev.egg-info/scm_version.json +8 -0
  22. {pymodrev-0.5.4 → pymodrev-0.5.6}/tests/conftest.py +8 -0
  23. pymodrev-0.5.6/tests/test_api.py +152 -0
  24. pymodrev-0.5.4/src/pymodrev/repair/function_search.py +0 -269
  25. pymodrev-0.5.4/tests/test_api.py +0 -80
  26. {pymodrev-0.5.4 → pymodrev-0.5.6}/.github/workflows/python-publish.yml +0 -0
  27. {pymodrev-0.5.4 → pymodrev-0.5.6}/.gitignore +0 -0
  28. {pymodrev-0.5.4 → pymodrev-0.5.6}/CHANGELOG.md +0 -0
  29. {pymodrev-0.5.4 → pymodrev-0.5.6}/README.md +0 -0
  30. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/00/README +0 -0
  31. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/00/model.bnet +0 -0
  32. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/00/model.lp +0 -0
  33. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/00/model.zginml +0 -0
  34. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/00/output.txt +0 -0
  35. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/00/steady.csv +0 -0
  36. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/00/steady.lp +0 -0
  37. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/01/README +0 -0
  38. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/01/model.bnet +0 -0
  39. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/01/model.lp +0 -0
  40. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/01/model.zginml +0 -0
  41. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/01/output.txt +0 -0
  42. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/01/steady.csv +0 -0
  43. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/01/steady.lp +0 -0
  44. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/02/README +0 -0
  45. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/02/model.bnet +0 -0
  46. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/02/model.lp +0 -0
  47. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/02/model.zginml +0 -0
  48. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/02/output.txt +0 -0
  49. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/02/steady.csv +0 -0
  50. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/02/steady.lp +0 -0
  51. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/03/README +0 -0
  52. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/03/model.bnet +0 -0
  53. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/03/model.lp +0 -0
  54. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/03/model.zginml +0 -0
  55. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/03/output.txt +0 -0
  56. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/03/steady.csv +0 -0
  57. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/03/steady.lp +0 -0
  58. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/04/README +0 -0
  59. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/04/async.csv +0 -0
  60. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/04/async.lp +0 -0
  61. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/04/model.bnet +0 -0
  62. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/04/model.lp +0 -0
  63. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/04/model.zginml +0 -0
  64. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/04/output.txt +0 -0
  65. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/05/README +0 -0
  66. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/05/async.csv +0 -0
  67. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/05/async.lp +0 -0
  68. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/05/model.bnet +0 -0
  69. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/05/model.lp +0 -0
  70. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/05/model.zginml +0 -0
  71. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/05/output.txt +0 -0
  72. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/06/README +0 -0
  73. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/06/async.csv +0 -0
  74. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/06/async.lp +0 -0
  75. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/06/model.bnet +0 -0
  76. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/06/model.lp +0 -0
  77. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/06/model.zginml +0 -0
  78. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/06/output.txt +0 -0
  79. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/07/README +0 -0
  80. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/07/async.csv +0 -0
  81. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/07/async.lp +0 -0
  82. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/07/model.bnet +0 -0
  83. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/07/model.lp +0 -0
  84. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/07/model.zginml +0 -0
  85. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/07/output.txt +0 -0
  86. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/08/README +0 -0
  87. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/08/model.bnet +0 -0
  88. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/08/model.lp +0 -0
  89. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/08/model.zginml +0 -0
  90. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/08/output.txt +0 -0
  91. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/08/sync.csv +0 -0
  92. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/08/sync.lp +0 -0
  93. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/09/README +0 -0
  94. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/09/model.bnet +0 -0
  95. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/09/model.lp +0 -0
  96. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/09/model.zginml +0 -0
  97. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/09/output.txt +0 -0
  98. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/09/sync.csv +0 -0
  99. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/09/sync.lp +0 -0
  100. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/10/README +0 -0
  101. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/10/async.csv +0 -0
  102. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/10/async.lp +0 -0
  103. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/10/model.lp +0 -0
  104. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/10/output.txt +0 -0
  105. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/10/sync.csv +0 -0
  106. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/10/sync.lp +0 -0
  107. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/11/README +0 -0
  108. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/11/model.bnet +0 -0
  109. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/11/model.lp +0 -0
  110. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/11/model.zginml +0 -0
  111. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/11/notsteady.lp +0 -0
  112. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/11/output.txt +0 -0
  113. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/12/README +0 -0
  114. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/12/model.bnet +0 -0
  115. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/12/model.lp +0 -0
  116. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/12/model.zginml +0 -0
  117. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/12/notsteady.lpdev +0 -0
  118. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/boolean_cell_cycle/12/output.txt +0 -0
  119. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/00/README +0 -0
  120. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/00/model.bnet +0 -0
  121. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/00/model.lp +0 -0
  122. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/00/model.zginml +0 -0
  123. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/00/output.txt +0 -0
  124. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/00/steady.csv +0 -0
  125. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/00/steady.lp +0 -0
  126. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/01/README +0 -0
  127. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/01/async.csv +0 -0
  128. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/01/async.lp +0 -0
  129. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/01/model.bnet +0 -0
  130. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/01/model.lp +0 -0
  131. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/01/model.zginml +0 -0
  132. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/01/output.txt +0 -0
  133. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/02/async.csv +0 -0
  134. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/02/async.lp +0 -0
  135. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/02/model.bnet +0 -0
  136. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/02/model.lp +0 -0
  137. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/02/model.zginml +0 -0
  138. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/02/output.txt +0 -0
  139. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/02/steady.csv +0 -0
  140. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/02/steady.lp +0 -0
  141. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/README +0 -0
  142. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/model.bnet +0 -0
  143. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/model.lp +0 -0
  144. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/model.zginml +0 -0
  145. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/output.txt +0 -0
  146. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/steady_01.csv +0 -0
  147. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/steady_01.lp +0 -0
  148. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/steady_02.csv +0 -0
  149. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/steady_02.lp +0 -0
  150. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/steady_03.csv +0 -0
  151. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/steady_03.lp +0 -0
  152. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/steady_04.csv +0 -0
  153. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/steady_04.lp +0 -0
  154. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/steady_05.csv +0 -0
  155. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/steady_05.lp +0 -0
  156. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/steady_06.csv +0 -0
  157. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/steady_06.lp +0 -0
  158. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/steady_07.csv +0 -0
  159. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/steady_07.lp +0 -0
  160. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/steady_08.csv +0 -0
  161. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/steady_08.lp +0 -0
  162. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/steady_09.csv +0 -0
  163. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/steady_09.lp +0 -0
  164. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/steady_10.csv +0 -0
  165. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/steady_10.lp +0 -0
  166. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/steady_11.csv +0 -0
  167. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/steady_11.lp +0 -0
  168. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/steady_12.csv +0 -0
  169. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/03/steady_12.lp +0 -0
  170. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/04/README +0 -0
  171. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/04/model.bnet +0 -0
  172. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/04/model.lp +0 -0
  173. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/04/notsteady.csv +0 -0
  174. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/04/notsteady.lp +0 -0
  175. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/fissionYeastDavidich2008/04/output.txt +0 -0
  176. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/toy/00/README +0 -0
  177. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/toy/00/model.bnet +0 -0
  178. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/toy/00/model.lp +0 -0
  179. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/toy/00/output.txt +0 -0
  180. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/toy/00/sync.csv +0 -0
  181. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/toy/00/sync.lp +0 -0
  182. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/toy/01/README +0 -0
  183. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/toy/01/model.bnet +0 -0
  184. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/toy/01/model.lp +0 -0
  185. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/toy/01/output.txt +0 -0
  186. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/toy/01/reachasync_01.csv +0 -0
  187. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/toy/01/reachasync_02.csv +0 -0
  188. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/toy/02/README +0 -0
  189. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/toy/02/model.bnet +0 -0
  190. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/toy/02/model.lp +0 -0
  191. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/toy/02/output.txt +0 -0
  192. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/toy/02/reachsync_01.csv +0 -0
  193. {pymodrev-0.5.4 → pymodrev-0.5.6}/examples/toy/02/reachsync_02.csv +0 -0
  194. {pymodrev-0.5.4 → pymodrev-0.5.6}/pyproject.toml +0 -0
  195. {pymodrev-0.5.4 → pymodrev-0.5.6}/requirements.txt +0 -0
  196. {pymodrev-0.5.4 → pymodrev-0.5.6}/setup.cfg +0 -0
  197. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/__main__.py +0 -0
  198. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/asp_rules/base.lp +0 -0
  199. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/asp_rules/complete.lp +0 -0
  200. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/asp_rules/notsteady_state.lp +0 -0
  201. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/asp_rules/steady.lp +0 -0
  202. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/asp_rules/sync.lp +0 -0
  203. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/asp_rules/time_series.lp +0 -0
  204. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/network/__init__.py +0 -0
  205. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/network/edge.py +0 -0
  206. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/network/exceptions.py +0 -0
  207. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/network/inconsistent_node.py +0 -0
  208. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/network/node.py +0 -0
  209. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/network/observation_set.py +0 -0
  210. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/network/repair_set.py +0 -0
  211. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/parsers/__init__.py +0 -0
  212. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/parsers/asp_utils.py +0 -0
  213. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/parsers/boolean_expression.py +0 -0
  214. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/parsers/network_parser.py +0 -0
  215. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/parsers/parser_asp.py +0 -0
  216. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/parsers/parser_bnet.py +0 -0
  217. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/parsers/parser_factory.py +0 -0
  218. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/parsers/parser_ginml.py +0 -0
  219. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/repair/__init__.py +0 -0
  220. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/repair/repair.py +0 -0
  221. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/updaters/__init__.py +0 -0
  222. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/updaters/async_updater.py +0 -0
  223. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/updaters/complete_updater.py +0 -0
  224. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/updaters/factory.py +0 -0
  225. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/updaters/notsteady_updater.py +0 -0
  226. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/updaters/reachasync_updater.py +0 -0
  227. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/updaters/reachsync_updater.py +0 -0
  228. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/updaters/steady_updater.py +0 -0
  229. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/updaters/sync_updater.py +0 -0
  230. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev/updaters/time_series_updater.py +0 -0
  231. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev.egg-info/dependency_links.txt +0 -0
  232. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev.egg-info/entry_points.txt +0 -0
  233. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev.egg-info/requires.txt +0 -0
  234. {pymodrev-0.5.4 → pymodrev-0.5.6}/src/pymodrev.egg-info/top_level.txt +0 -0
  235. {pymodrev-0.5.4 → pymodrev-0.5.6}/tests/compare_outputs.py +0 -0
  236. {pymodrev-0.5.4 → pymodrev-0.5.6}/tests/test_apply_repair.py +0 -0
  237. {pymodrev-0.5.4 → pymodrev-0.5.6}/tests/test_bnet_parser.py +0 -0
  238. {pymodrev-0.5.4 → pymodrev-0.5.6}/tests/test_edge.py +0 -0
  239. {pymodrev-0.5.4 → pymodrev-0.5.6}/tests/test_function.py +0 -0
  240. {pymodrev-0.5.4 → pymodrev-0.5.6}/tests/test_inconsistency_solution.py +0 -0
  241. {pymodrev-0.5.4 → pymodrev-0.5.6}/tests/test_inconsistent_node.py +0 -0
  242. {pymodrev-0.5.4 → pymodrev-0.5.6}/tests/test_model.py +0 -0
  243. {pymodrev-0.5.4 → pymodrev-0.5.6}/tests/test_model_files.py +0 -0
  244. {pymodrev-0.5.4 → pymodrev-0.5.6}/tests/test_node.py +0 -0
  245. {pymodrev-0.5.4 → pymodrev-0.5.6}/tests/test_observation_parsers.py +0 -0
  246. {pymodrev-0.5.4 → pymodrev-0.5.6}/tests/test_observation_set.py +0 -0
  247. {pymodrev-0.5.4 → pymodrev-0.5.6}/tests/test_repair_set.py +0 -0
  248. {pymodrev-0.5.4 → pymodrev-0.5.6}/tests/test_updater_factory.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pymodrev
3
- Version: 0.5.4
3
+ Version: 0.5.6
4
4
  Summary: Model Revision tool for computing Boolean network repair operations.
5
5
  Author-email: "Pedro T. Monteiro" <Pedro.Tiago.Monteiro@tecnico.ulisboa.pt>
6
6
  License: MIT
@@ -11,8 +11,7 @@ from pymodrev.api import (
11
11
  model_from_dict,
12
12
  model_from_file,
13
13
  is_consistent,
14
- get_repairs,
15
- apply_repairs,
14
+ repair,
16
15
  model_to_file,
17
16
  )
18
17
  from pymodrev.network.edge import Edge
@@ -33,8 +32,7 @@ __all__ = [
33
32
  "model_from_dict",
34
33
  "model_from_file",
35
34
  "is_consistent",
36
- "get_repairs",
37
- "apply_repairs",
35
+ "repair",
38
36
  "model_to_file",
39
37
 
40
38
  "Edge",
@@ -7,7 +7,7 @@ import itertools
7
7
  import os
8
8
  import json
9
9
  from pathlib import Path
10
- from typing import Mapping, List
10
+ from typing import Mapping, List, Tuple
11
11
 
12
12
  from pymodrev.configuration import config
13
13
  from pymodrev.network.model import Model
@@ -23,29 +23,23 @@ from pymodrev.updaters.factory import get_updater
23
23
 
24
24
  # This keeps the state between function calls between API function calls
25
25
  _OBSERVATION_SET = ObservationSet()
26
- _LAST_REPAIRS: List[InconsistencySolution] | None = None
27
26
  _LAST_USED_OBSERVATION_NAMES: List[str] | None = None
28
27
  _LAST_OPTIMIZATION: int | None = None
29
28
  _LAST_INCONSISTENCIES: List[InconsistencySolution] | None = None
30
29
 
31
30
  def clear_obs() -> None:
32
31
  """Remove all observations stored in the module-level registry."""
33
- global _OBSERVATION_SET, _LAST_REPAIRS, _LAST_USED_OBSERVATION_NAMES, _LAST_OPTIMIZATION, _LAST_INCONSISTENCIES
32
+ global _OBSERVATION_SET, _LAST_USED_OBSERVATION_NAMES, _LAST_OPTIMIZATION, _LAST_INCONSISTENCIES
34
33
  _OBSERVATION_SET = ObservationSet()
35
- _LAST_REPAIRS = None
36
34
  _LAST_USED_OBSERVATION_NAMES = None
37
35
  _LAST_OPTIMIZATION = None
38
36
  _LAST_INCONSISTENCIES = None
39
37
 
40
38
 
41
39
  def _coerce_expression(expression) -> str:
42
- if isinstance(expression, str):
43
- return expression
44
- if isinstance(expression, bool):
40
+ if isinstance(expression, (bool, int)):
45
41
  return "1" if expression else "0"
46
- if isinstance(expression, int):
47
- return "1" if expression else "0"
48
- return str(expression)
42
+ return expression if isinstance(expression, str) else str(expression)
49
43
 
50
44
 
51
45
  def model_from_dict(model_definition: Mapping[str, object]) -> Model:
@@ -86,83 +80,89 @@ def model_from_file(filepath: os.PathLike[str] | str) -> Model:
86
80
  return network
87
81
 
88
82
 
89
- def _build_observation_from_data(name: str, data: Mapping, updater_type: str) -> Observation:
83
+ def _add_observation_value(observation: Observation, obs_id: str,
84
+ time, node_id: str, value: str | int) -> None:
85
+ if value is None:
86
+ return
87
+ if isinstance(value, str):
88
+ normalized = value.strip().lower()
89
+ if normalized in ("", "na", "n/a", "nan", "*", "-"):
90
+ return # ignore: no restriction on this (obs_id,node_id)
91
+ elif normalized in ("1", "true", "t", "yes", "y"):
92
+ value = 1
93
+ elif normalized in ("0", "false", "f", "no", "n"):
94
+ value = 0
95
+ else:
96
+ raise ValueError(f"Invalid observation '{obs_id}' value: '{node_id}' = '{value}'")
97
+ observation.add_data(obs_id, time, node_id, value)
98
+
99
+ def _add_single_state_obs(obs_id: str, data: Mapping[str, str | int], updater_type: str) -> Observation:
100
+ updater = get_updater(updater_type)
101
+ observation = Observation(updater)
102
+ for node_id, value in data.items():
103
+ _add_observation_value(observation, obs_id, None, node_id, value)
104
+ return observation
105
+
106
+ def _add_multiple_state_obs(obs_id: str, data: Mapping, updater_type: str) -> Observation:
90
107
  updater = get_updater(updater_type)
91
108
  observation = Observation(updater)
92
109
 
93
110
  if data and all(isinstance(value, Mapping) for value in data.values()):
94
111
  for time, values in data.items():
95
- try:
96
- time_value = int(time)
97
- except (TypeError, ValueError):
98
- raise ValueError(f"Invalid observation time '{time}' for '{name}'")
112
+ if not isinstance(time, int) and (not isinstance(time, str) or time not in {"init", "final"}):
113
+ raise ValueError(f"Invalid observation time '{time}' for '{obs_id}'")
99
114
  for node_id, value in values.items():
100
- _add_observation_value(observation, name, time_value, str(node_id), value)
115
+ _add_observation_value(observation, obs_id, time, node_id, value)
101
116
  else:
102
117
  for node_id, value in data.items():
103
- _add_observation_value(observation, name, None, str(node_id), value)
118
+ _add_observation_value(observation, obs_id, None, node_id, value)
104
119
 
105
120
  return observation
106
121
 
107
122
 
108
- def _add_observation_value(
109
- observation: Observation,
110
- exp_id: str,
111
- time,
112
- node_id: str,
113
- value,
114
- ) -> None:
115
- if value is None:
116
- return
117
- if isinstance(value, str):
118
- normalized = value.strip().lower()
119
- if normalized in {"", "na", "n/a", "nan", "*", "-"}:
120
- return
121
- observation.add_data(exp_id, time, node_id, int(value))
122
-
123
-
124
- def obs_steady(name: str, data: Mapping[str, int]) -> None:
123
+ def obs_steady(obs_id: str, state: Mapping[str, str | int]) -> None:
125
124
  """Register a named steady-state observation from a dictionary of nodes and their values."""
126
- observation = _build_observation_from_data(name, data, "steady")
125
+ observation = _add_single_state_obs(obs_id, state, "steady")
127
126
  global _OBSERVATION_SET
128
127
  _OBSERVATION_SET.add_observation(observation)
129
128
 
130
- def obs_notsteady(name: str, data: Mapping[str, int]) -> None:
129
+ def obs_notsteady(obs_id: str, state: Mapping[str, int]) -> None:
131
130
  """Register a named notsteady-state observation from a dictionary of nodes and their values."""
132
- observation = _build_observation_from_data(name, data, "notsteady")
131
+ observation = _add_single_state_obs(obs_id, state, "notsteady")
133
132
  global _OBSERVATION_SET
134
133
  _OBSERVATION_SET.add_observation(observation)
135
134
 
136
135
 
137
- def obs_sync_ts(name: str, data: Mapping[str|int, Mapping[str, int]], updater_type: str) -> None:
136
+ def obs_sync_ts(obs_id: str, data: Mapping[str|int, Mapping[str, int]]) -> None:
138
137
  """Register a named synchronous time-series observation from a dictionary of time points to node-value mappings."""
139
- observation = _build_observation_from_data(name, data, "sync")
138
+ observation = _add_multiple_state_obs(obs_id, data, "sync")
140
139
  global _OBSERVATION_SET
141
140
  _OBSERVATION_SET.add_observation(observation)
142
141
 
143
- def obs_async_ts(name: str, data: Mapping[str|int, Mapping[str, int]], updater_type: str) -> None:
142
+ def obs_async_ts(obs_id: str, data: Mapping[str|int, Mapping[str, int]]) -> None:
144
143
  """Register a named asynchronous time-series observation from a dictionary of time points to node-value mappings."""
145
- observation = _build_observation_from_data(name, data, "async")
144
+ observation = _add_multiple_state_obs(obs_id, data, "async")
146
145
  global _OBSERVATION_SET
147
146
  _OBSERVATION_SET.add_observation(observation)
148
147
 
149
148
 
150
- def obs_sync_reach(name: str, data_init: Mapping[str, int], data_final: Mapping[str, int], updater_type: str) -> None:
149
+ def obs_sync_reach(obs_id: str, data_init: Mapping[str, int], data_final: Mapping[str, int]) -> None:
151
150
  """Register a named synchronous reachability observation from two dictionaries of nodes and their values."""
152
151
  data = {"init": data_init, "final": data_final}
153
- observation = _build_observation_from_data(name, data, "reachsync")
152
+ observation = _add_multiple_state_obs(obs_id, data, "reachsync")
154
153
  global _OBSERVATION_SET
155
154
  _OBSERVATION_SET.add_observation(observation)
156
155
 
157
- def obs_async_reach(name: str, data_init: Mapping[str, int], data_final: Mapping[str, int], updater_type: str) -> None:
156
+ def obs_async_reach(obs_id: str, data_init: Mapping[str, int], data_final: Mapping[str, int]) -> None:
158
157
  """Register a named asynchronous reachability observation from two dictionaries of nodes and their values."""
159
158
  data = {"init": data_init, "final": data_final}
160
- observation = _build_observation_from_data(name, data, "reachasync")
159
+ observation = _add_multiple_state_obs(obs_id, data, "reachasync")
161
160
  global _OBSERVATION_SET
162
161
  _OBSERVATION_SET.add_observation(observation)
163
162
 
164
163
 
165
164
  def _subset_observations(observation_names: List[str] | None) -> ObservationSet:
165
+ global _OBSERVATION_SET
166
166
  if observation_names is None:
167
167
  return _OBSERVATION_SET
168
168
 
@@ -175,8 +175,8 @@ def _subset_observations(observation_names: List[str] | None) -> ObservationSet:
175
175
  return subset
176
176
 
177
177
 
178
- def is_consistent(model: Model, observation_names: List[str],
179
- sol: int = 1) -> str:
178
+ def is_consistent(model: Model, observation_names: List[str] | str,
179
+ sol: int = 1) -> dict:
180
180
  """Check whether a model is consistent with the selected observations."""
181
181
  if sol not in (1, 2, 3, 4):
182
182
  raise ValueError("sol must be one of: 1, 2, 3, 4")
@@ -192,45 +192,39 @@ def is_consistent(model: Model, observation_names: List[str],
192
192
  observation_set = _subset_observations(observation_names)
193
193
 
194
194
  inconsistencies, optimization = check_consistency(model, observation_set)
195
- global _LAST_USED_OBSERVATION_NAMES, _LAST_INCONSISTENCIES, _LAST_OPTIMIZATION, _LAST_REPAIRS
195
+ global _LAST_USED_OBSERVATION_NAMES, _LAST_INCONSISTENCIES, _LAST_OPTIMIZATION
196
196
  _LAST_USED_OBSERVATION_NAMES = observation_names
197
197
  _LAST_INCONSISTENCIES = inconsistencies
198
198
  _LAST_OPTIMIZATION = optimization
199
- _LAST_REPAIRS = None
200
-
201
199
  return json.loads(consistency_to_str(inconsistencies, optimization))
202
200
 
203
201
 
204
- def get_repairs(model: Model) -> dict:
205
- """Compute repair solutions from the previous is_consistent() call."""
206
- if not _LAST_USED_OBSERVATION_NAMES or not _LAST_INCONSISTENCIES or _LAST_OPTIMIZATION is None:
207
- raise ValueError("is_consistent() method must be run before")
208
- if _LAST_OPTIMIZATION == 0:
209
- raise ValueError("Model is already consistent; no repairs to return")
202
+ def repair(model: Model, obs_names: List[str] | str | None = None) -> Tuple[List[Model], dict]:
203
+ """Computes all possible repair solutions from the previous is_consistent()
204
+ call, applies the repairs, and returns the repaired model(s)."""
205
+ global _LAST_USED_OBSERVATION_NAMES, _LAST_INCONSISTENCIES, _LAST_OPTIMIZATION
206
+ if not obs_names: # default behavior. user called is_consistent() before
207
+ if not _LAST_USED_OBSERVATION_NAMES or not _LAST_INCONSISTENCIES or _LAST_OPTIMIZATION is None:
208
+ raise ValueError("is_consistent() method must be run before")
209
+ if _LAST_OPTIMIZATION == 0:
210
+ return [], {}
211
+ observation_set = _subset_observations(_LAST_USED_OBSERVATION_NAMES)
212
+ else: # user called repair() directly with explicit observation names
213
+ if isinstance(obs_names, str):
214
+ obs_names = [obs_names]
215
+ _LAST_USED_OBSERVATION_NAMES = obs_names
216
+ observation_set = _subset_observations(_LAST_USED_OBSERVATION_NAMES)
217
+ _LAST_INCONSISTENCIES, _LAST_OPTIMIZATION = check_consistency(model, observation_set)
218
+ if _LAST_OPTIMIZATION == 0:
219
+ return [], {}
210
220
 
211
- observation_set = _subset_observations(_LAST_USED_OBSERVATION_NAMES)
212
221
  config.task = 'r'
213
222
  config.format = 'j'
214
- global _LAST_REPAIRS
215
- _LAST_REPAIRS, s = model_revision(model, observation_set, _LAST_INCONSISTENCIES, _LAST_OPTIMIZATION)
216
- return json.loads(s)
217
-
223
+ repairs, s = model_revision(model, observation_set, _LAST_INCONSISTENCIES, _LAST_OPTIMIZATION)
218
224
 
219
- def apply_repairs(model: Model) -> list[Model]:
220
- """Apply one or more repair solutions and return repaired model variants.
221
-
222
- For each inconsistency solution, this enumerates the Cartesian product of
223
- per-node repair sets, mirroring the CLI `-t m` workflow.
224
- """
225
- if not _LAST_USED_OBSERVATION_NAMES or not _LAST_INCONSISTENCIES or _LAST_OPTIMIZATION is None:
226
- raise ValueError("is_consistent() method must be run before")
227
- if _LAST_OPTIMIZATION == 0:
228
- raise ValueError("Model is already consistent; no repairs to return")
229
- if _LAST_REPAIRS is None:
230
- raise ValueError("get_repairs() must be run before")
231
225
 
232
226
  repaired_models: list[Model] = []
233
- for repair_solution in _LAST_REPAIRS:
227
+ for repair_solution in repairs:
234
228
  nodes_with_repairs = []
235
229
  for node_id in sorted(repair_solution.inconsistent_nodes.keys()):
236
230
  i_node = repair_solution.inconsistent_nodes[node_id]
@@ -246,7 +240,7 @@ def apply_repairs(model: Model) -> list[Model]:
246
240
  _apply_repair_in_place(repaired_model, repair_solution, node_repair_map)
247
241
  repaired_models.append(repaired_model)
248
242
 
249
- return repaired_models
243
+ return repaired_models, json.loads(s)
250
244
 
251
245
 
252
246
  def model_to_file(model: Model, filepath: os.PathLike[str] | str) -> None:
@@ -16,6 +16,11 @@ vlabel(P,T+1,V,S) :- not update(P,T,V), vlabel(P,T,V,S), time(P,T+1), exp(P,asyn
16
16
  topologicalerror(V) :- time(P1,T1), time(P2,T2), T1 != T2, time(P1,T1+1), time(P2,T2+1), exp(P1,async), exp(P2,async), update(P1, T1, V), update(P2, T2, V), {vlabel(P1,T1,V1,S1) : vlabel(P2,T2,V1,S2), functionAnd(V,Id, V1), S1!=S2}0, vlabel(P1,T1+1,V,S3), vlabel(P2,T2+1,V,S4), S3 != S4, not input(V).
17
17
  topologicalerror(V) :- time(P1,T), time(P2,T), time(P1,T+1), time(P2,T+1), update(P1, T, V), update(P2, T, V), exp(P1,async), exp(P2,async), P1 != P2, {vlabel(P1,T,V1,S1) : vlabel(P2,T,V1,S2), S1!=S2, functionAnd(V,Id, V1)}0, vlabel(P1,T+1,V,S3), vlabel(P2,T+1,V,S4), S3 != S4, not input(V).
18
18
 
19
+ % to avoid symmetries, if there are two consecutive updated nodes such that no one is a regulator of the other
20
+ % then we say that the smallest one (or the one that comes first alphaetically) must be updated first
21
+ :- update(P,T,V1), update(P,T+1,V2), not edge(V1,V2,_), not edge(V2,V1,_), V1 > V2, not repair(V1), not repair(V2).
22
+
23
+
19
24
  repair(V) :- topologicalerror(V).
20
25
 
21
26
  #minimize {1@2,top,V : topologicalerror(V)}.
@@ -2,10 +2,11 @@
2
2
  % obs_named_vlabel(Exp,Name,Node,Value) define the final state observed
3
3
  % max_time(Exp, Time) defines the maximum time step
4
4
 
5
- 1{finalStateTime(P,T): T = 1..T2, max_time(P,T2)}1 :- obs_named_vlabel(P,final,_,_).
6
- obs_vlabel(P,T,V,S) :- obs_named_vlabel(P,final,V,S), finalStateTime(P,T).
5
+ % Optional fixed bound injected from Python for iterative deepening.
6
+ 1{finalStateTime(P,T): T = 1..T2}1 :- reach_bound(P,T2), obs_named_vlabel(P,final,_,_).
7
7
 
8
- #minimize{T@0,finalState,P : finalStateTime(P,T)}.
8
+ 1{finalStateTime(P,T): T = 1..T2, max_time(P,T2)}1 :- obs_named_vlabel(P,final,_,_), not reach_bound(P,_).
9
+ obs_vlabel(P,T,V,S) :- obs_named_vlabel(P,final,V,S), finalStateTime(P,T).
9
10
 
10
11
  #show finalStateTime/2.
11
12
  %#show obs_vlabel/4.
@@ -52,13 +52,13 @@ Or: -obs obs1.lp async -obs obs2.lp sync""")
52
52
  m - get repaired models""")
53
53
  arg_parser.add_argument("--exhaustive-search", action="store_true",
54
54
  help="Force exhaustive search of function repair operations (default=false)")
55
- arg_parser.add_argument("-s", "--solutions", type=int, choices=[1,2,3,4], default=3,
55
+ arg_parser.add_argument("-s", "--solutions", type=int, choices=[1,2,3,4], default=1,
56
56
  help="""All solutions are optimal w.r.t. number of nodes needing repairs.
57
57
  But a solution may be sub-optimal w.r.t. number of repair operations.
58
58
  1 - Show only the first ASP optimal solution, which may be
59
- sup-optimal in terms of repairs (fastest)
59
+ sup-optimal in terms of repairs (fastest & default)
60
60
  2 - Show only the first ASP&repairs optimal solution
61
- 3 - Show all optimal solutions (default)
61
+ 3 - Show all optimal solutions
62
62
  4 - Show all optimal solutions, including sub-optimal repairs (slowest)
63
63
  """)
64
64
  arg_parser.add_argument("-f", "--format", type=str, choices=['c', 'j', 'h'], default='h',
@@ -77,7 +77,7 @@ Example: --fixed-edges A,B C;D E:F"""),
77
77
  args = arg_parser.parse_args()
78
78
 
79
79
  # Apply arguments to config and network
80
- network.input_file_network = args.model
80
+ config.input_filename = args.model
81
81
  config.task = args.task
82
82
  config.force_optimum = args.exhaustive_search
83
83
  config.solutions = args.solutions
@@ -116,8 +116,8 @@ def main():
116
116
 
117
117
  # Delegate parsing to the correct reader based on file extension
118
118
  try:
119
- parser = get_parser(network.input_file_network)
120
- parse = parser.read(network, network.input_file_network)
119
+ parser = get_parser(config.input_filename)
120
+ parse = parser.read(network, config.input_filename)
121
121
  # Mark nodes and edges as fixed (not to be repaired)
122
122
  if config.fixed_nodes:
123
123
  for node_id in config.fixed_nodes:
@@ -176,7 +176,7 @@ def main():
176
176
  logger.info("No repaired models to generate.")
177
177
  else:
178
178
  padding = len(str(total_models))
179
- prefix, ext = os.path.splitext(network.input_file_network)
179
+ prefix, ext = os.path.splitext(config.input_filename)
180
180
  for i, (repair_sol, node_repair_map) in enumerate(all_models_to_save):
181
181
  newNetwork = copy.deepcopy(network)
182
182
  apply_repair(newNetwork, repair_sol, node_repair_map)
@@ -43,7 +43,6 @@ class Configuration:
43
43
  task: str = 'r' # default is show the repairs
44
44
  format: str = 'h' # default is human-readable format
45
45
  debug: bool = False
46
- check_asp: bool = True # Use ASP consistency check program
47
46
  function_asp: bool = True # Use ASP function program
48
47
  solutions: int = 3 # Number/Type of solutions presented (default=3)
49
48
  labelling: bool = False
@@ -55,6 +54,7 @@ class Configuration:
55
54
  check_consistency: bool = False # Just check the consistency of the model and return
56
55
  fixed_nodes = "" # List of node ids not to repair
57
56
  fixed_edges = "" # List of edge ids not to repair
57
+ input_filename: str = "" # Input file for the model
58
58
 
59
59
  def __getitem__(self, key):
60
60
  return getattr(self, key)
@@ -34,7 +34,7 @@ class Function:
34
34
  self._regulators = []
35
35
  # {1: ['node_1', 'node_2'], 2: ['node_1', 'node_3'], 3: ['node_3']}
36
36
  self._regulators_by_term = {}
37
- self._pfh_function = None
37
+ self._pfh_function: PFHFunction | None = None
38
38
 
39
39
  @property
40
40
  def node_id(self) -> str:
@@ -78,7 +78,7 @@ class Function:
78
78
  self._regulators_by_term = value
79
79
 
80
80
  @property
81
- def pfh_function(self) -> PFHFunction:
81
+ def pfh_function(self) -> PFHFunction | None:
82
82
  """Returns the PyFunctionhood function representation."""
83
83
  return self._pfh_function
84
84
 
@@ -390,7 +390,7 @@ class Function:
390
390
  """
391
391
  return self.pfh_function.level_cmp_list(other)
392
392
 
393
- def pfh_get_replacements(self, generalize: bool) -> List:
393
+ def pfh_get_replacements(self, generalize: bool) -> List[PFHFunction]:
394
394
  """
395
395
  Gets replacement functions by generalizing or specializing.
396
396
  """
@@ -399,7 +399,7 @@ class Function:
399
399
  return self.pfh_get_parents() if generalize \
400
400
  else self.pfh_get_children()
401
401
 
402
- def get_hasse_relationships(self, relationship_type: str) -> List:
402
+ def get_hasse_relationships(self, relationship_type: str) -> set[PFHFunction]:
403
403
  """
404
404
  Helper function to get parent/child relationships from Hasse diagram.
405
405
  """
@@ -439,7 +439,7 @@ class Function:
439
439
  for parent in self.get_hasse_relationships('parents')
440
440
  ]
441
441
 
442
- def pfh_get_children(self) -> List:
442
+ def pfh_get_children(self) -> List[PFHFunction]:
443
443
  """
444
444
  Get child functions in the Hasse diagram.
445
445
  """
@@ -5,6 +5,7 @@ The class provides methods to manage and analyze inconsistent nodes, repair
5
5
  sets, and other related properties.
6
6
  """
7
7
 
8
+ from __future__ import annotations
8
9
  import json
9
10
  from typing import Dict
10
11
  from pymodrev.network.model import Model
@@ -118,7 +119,7 @@ class InconsistencySolution:
118
119
  """
119
120
  return self.inconsistent_nodes[node_id]
120
121
 
121
- def compare_repairs(self, solution: "InconsistencySolution") -> int:
122
+ def compare_repairs(self, solution: InconsistencySolution) -> int:
122
123
  """
123
124
  Compares the current solution with another solution to determine which
124
125
  is better.
@@ -24,7 +24,6 @@ class Model:
24
24
  self._nodes: Dict[str, Node] = {} # {'node_id': node, ...}
25
25
  self._graph = {} # {'node_id': [edge_1, edge_2, ...], ...}
26
26
  self._regulators = {} # Reverse of graph: {'node_id': ['reg_id', ...], ...}
27
- self._input_file_network = ''
28
27
 
29
28
  @property
30
29
  def nodes(self) -> Dict[str, Node]:
@@ -46,15 +45,6 @@ class Model:
46
45
  """Returns the regulators of each node in the model."""
47
46
  return self._regulators
48
47
 
49
- @property
50
- def input_file_network(self) -> str:
51
- """Returns the input file associated with the model."""
52
- return self._input_file_network
53
-
54
- @input_file_network.setter
55
- def input_file_network(self, value: str):
56
- self._input_file_network = value
57
-
58
48
  def get_node(self, node_id: str) -> Node | None:
59
49
  """
60
50
  Retrieves a node from the model by its identifier.
@@ -118,3 +108,16 @@ class Model:
118
108
  """
119
109
  from pymodrev.parsers.parser_asp import ASPParser
120
110
  return ASPParser.to_asp_facts(self)
111
+
112
+ def __eq__(self, other: object) -> bool:
113
+ """
114
+ Checks if two models are equal based on their nodes and edges.
115
+ """
116
+ return isinstance(other, Model) and self.nodes == other.nodes and \
117
+ self.graph == other.graph and self.regulators == other.regulators
118
+
119
+ def __hash__(self) -> int:
120
+ """Hash function for the Model based on its nodes and edges."""
121
+ return hash((len(self.nodes),
122
+ sum(len(edges) for edges in self.graph.values()),
123
+ len(self.regulators)))
@@ -5,8 +5,6 @@ via the command line. It also performs a basic check to ensure the provided
5
5
  observation file exists.
6
6
  """
7
7
 
8
- import os
9
- from pymodrev.updaters.async_updater import AsyncUpdater
10
8
  from pymodrev.updaters.reachsync_updater import ReachsyncUpdater
11
9
  from pymodrev.updaters.reachasync_updater import ReachasyncUpdater
12
10
  from pymodrev.updaters.updater import Updater
@@ -40,7 +38,13 @@ class Observation:
40
38
  self.experiments.add(exp_id)
41
39
  self.data.append((exp_id, time, node_id, value))
42
40
 
43
- def to_asp_facts(self, dimension: int) -> str:
41
+ def get_nodes(self) -> Set[str]:
42
+ """
43
+ Returns the set of nodes observed in this observation.
44
+ """
45
+ return set(node_id for _, _, node_id, _ in self.data)
46
+
47
+ def to_asp_facts(self, dimension: int, reach_bound: Optional[int] = None) -> str:
44
48
  """
45
49
  Generates ASP facts from the internal observation data.
46
50
  """
@@ -63,7 +67,9 @@ class Observation:
63
67
 
64
68
  if self.updater.get_type() in [ReachasyncUpdater.get_type(), ReachsyncUpdater.get_type()]:
65
69
  for exp_id in self.experiments:
66
- facts.append(f"max_time({asp_quote(exp_id)},{2**dimension - 1}).")
70
+ facts.append(f"max_time({asp_quote(exp_id)},{2*dimension}).")
71
+ if reach_bound is not None:
72
+ facts.append(f"reach_bound({asp_quote(exp_id)},{reach_bound}).")
67
73
 
68
74
  return "\n".join(facts) + "\n"
69
75
 
@@ -17,8 +17,7 @@ class ObservationParser(ABC):
17
17
  """
18
18
  pass
19
19
 
20
- def read_table(self, table: List, updater: Updater):
21
- obs = Observation(updater)
20
+ def read_table(self, table: List, obs: Observation) -> Observation:
22
21
  header = table[0]
23
22
 
24
23
  # Detect type:
@@ -34,6 +33,9 @@ class ObservationParser(ABC):
34
33
  if is_ts:
35
34
  time = str(row[1])
36
35
  values = row[2:]
36
+ if obs.updater.get_type() in ('reachasync', 'reachsync') and time not in ('init','final') \
37
+ or (obs.updater.get_type() in ('async', 'sync', 'complete') and not time.isdigit()):
38
+ raise ValueError(f"Updater '{obs.updater.get_type()}' with invalid time value.")
37
39
  else:
38
40
  time = None
39
41
  values = row[1:]
@@ -91,7 +93,7 @@ class CSVObservationParser(ObservationParser):
91
93
  with open(filepath, 'r', encoding='utf-8') as f:
92
94
  reader = csv.reader(f)
93
95
 
94
- return self.read_table(list(reader), updater)
96
+ return self.read_table(list(reader), obs)
95
97
  except Exception as e:
96
98
  raise ValueError(f"Error parsing CSV observation file {filepath}: {e}")
97
99
  return obs
@@ -104,7 +106,6 @@ class ExcelObservationParser(ObservationParser):
104
106
  def read(self, filepath: str, updater: Updater) -> Observation:
105
107
  obs = Observation(updater)
106
108
  ext = os.path.splitext(filepath)[1].lower()
107
-
108
109
  try:
109
110
  rows = []
110
111
  if ext == '.xlsx':
@@ -120,7 +121,7 @@ class ExcelObservationParser(ObservationParser):
120
121
  for i in range(ws.nrows):
121
122
  rows.append(ws.row_values(i))
122
123
 
123
- return self.read_table(rows, updater)
124
+ return self.read_table(rows, obs)
124
125
  except Exception as e:
125
126
  raise ValueError(f"Error parsing Excel observation file {filepath}: {e}")
126
127
  return obs
@@ -7,6 +7,7 @@ is consistent with a given labeling/profile.
7
7
 
8
8
  import logging
9
9
  import math
10
+ import sys
10
11
  from bitarray import bitarray
11
12
  from typing import List, Dict, Tuple
12
13
 
@@ -25,12 +26,12 @@ def check_consistency(network: Model, observation_set: ObservationSet) -> Tuple[
25
26
  """
26
27
  Check network consistency using ASP solver or alternative method.
27
28
  """
28
- result = []
29
- optimization = -2
30
- if config.check_asp:
31
- result, optimization = Updater.check_consistency(network, observation_set)
32
- else:
33
- pass
29
+ for name,observation in observation_set.observations_dictionary.items():
30
+ for node in observation.get_nodes():
31
+ if node not in network.nodes:
32
+ logger.warning(f"Observation {name} contains node {node} which is not in the model.")
33
+ sys.exit(-1)
34
+ result, optimization = Updater.check_consistency(network, observation_set)
34
35
  return result, optimization
35
36
 
36
37
 
@@ -11,7 +11,6 @@ from typing import List, Tuple
11
11
  from pymodrev.network.inconsistency_solution import InconsistencySolution
12
12
  from pymodrev.network.model import Model
13
13
  from pymodrev.network.observation_set import ObservationSet
14
- from pymodrev.repair.consistency import check_consistency
15
14
  from pymodrev.repair.topology import repair_inconsistencies
16
15
  from pymodrev.configuration import config
17
16