jijmodeling 0.10.15__cp310-cp310-win_amd64.whl → 1.11.0__cp310-cp310-win_amd64.whl

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.

Potentially problematic release.


This version of jijmodeling might be problematic. Click here for more details.

Files changed (270) hide show
  1. jijmodeling/__init__.py +1 -146
  2. jijmodeling/__init__.pyi +5152 -0
  3. jijmodeling/_jijmodeling.cp310-win_amd64.pyd +0 -0
  4. jijmodeling/dataset.py +5 -0
  5. jijmodeling/dataset.pyi +106 -0
  6. jijmodeling/experimental.py +13 -0
  7. jijmodeling/experimental.pyi +302 -0
  8. jijmodeling/py.typed +0 -0
  9. jijmodeling/range/__init__.py +14 -0
  10. jijmodeling/range/__init__.pyi +56 -0
  11. jijmodeling/range/size.py +14 -0
  12. jijmodeling/range/size.pyi +54 -0
  13. jijmodeling/range/value.py +14 -0
  14. jijmodeling/range/value.pyi +54 -0
  15. jijmodeling-1.11.0.dist-info/METADATA +235 -0
  16. jijmodeling-1.11.0.dist-info/RECORD +18 -0
  17. {jijmodeling-0.10.15.dist-info → jijmodeling-1.11.0.dist-info}/WHEEL +1 -2
  18. {jijmodeling-0.10.15.dist-info → jijmodeling-1.11.0.dist-info/licenses}/LICENSE.txt +1 -1
  19. jijmodeling/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
  20. jijmodeling/__pycache__/__init__.cpython-310.pyc +0 -0
  21. jijmodeling/__pycache__/_version.cpython-310.opt-1.pyc +0 -0
  22. jijmodeling/__pycache__/_version.cpython-310.pyc +0 -0
  23. jijmodeling/_version.py +0 -4
  24. jijmodeling/exceptions/__init__.py +0 -26
  25. jijmodeling/exceptions/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
  26. jijmodeling/exceptions/__pycache__/__init__.cpython-310.pyc +0 -0
  27. jijmodeling/exceptions/__pycache__/exceptions.cpython-310.opt-1.pyc +0 -0
  28. jijmodeling/exceptions/__pycache__/exceptions.cpython-310.pyc +0 -0
  29. jijmodeling/exceptions/exceptions.py +0 -37
  30. jijmodeling/expression/__init__.py +0 -74
  31. jijmodeling/expression/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
  32. jijmodeling/expression/__pycache__/__init__.cpython-310.pyc +0 -0
  33. jijmodeling/expression/__pycache__/condition.cpython-310.opt-1.pyc +0 -0
  34. jijmodeling/expression/__pycache__/condition.cpython-310.pyc +0 -0
  35. jijmodeling/expression/__pycache__/constraint.cpython-310.opt-1.pyc +0 -0
  36. jijmodeling/expression/__pycache__/constraint.cpython-310.pyc +0 -0
  37. jijmodeling/expression/__pycache__/expression.cpython-310.opt-1.pyc +0 -0
  38. jijmodeling/expression/__pycache__/expression.cpython-310.pyc +0 -0
  39. jijmodeling/expression/__pycache__/extract.cpython-310.opt-1.pyc +0 -0
  40. jijmodeling/expression/__pycache__/extract.cpython-310.pyc +0 -0
  41. jijmodeling/expression/__pycache__/from_old_serializable.cpython-310.opt-1.pyc +0 -0
  42. jijmodeling/expression/__pycache__/from_old_serializable.cpython-310.pyc +0 -0
  43. jijmodeling/expression/__pycache__/mathfunc.cpython-310.opt-1.pyc +0 -0
  44. jijmodeling/expression/__pycache__/mathfunc.cpython-310.pyc +0 -0
  45. jijmodeling/expression/__pycache__/prod.cpython-310.opt-1.pyc +0 -0
  46. jijmodeling/expression/__pycache__/prod.cpython-310.pyc +0 -0
  47. jijmodeling/expression/__pycache__/serializable.cpython-310.opt-1.pyc +0 -0
  48. jijmodeling/expression/__pycache__/serializable.cpython-310.pyc +0 -0
  49. jijmodeling/expression/__pycache__/sum.cpython-310.opt-1.pyc +0 -0
  50. jijmodeling/expression/__pycache__/sum.cpython-310.pyc +0 -0
  51. jijmodeling/expression/__pycache__/type_annotations.cpython-310.opt-1.pyc +0 -0
  52. jijmodeling/expression/__pycache__/type_annotations.cpython-310.pyc +0 -0
  53. jijmodeling/expression/__pycache__/utils.cpython-310.opt-1.pyc +0 -0
  54. jijmodeling/expression/__pycache__/utils.cpython-310.pyc +0 -0
  55. jijmodeling/expression/condition.py +0 -362
  56. jijmodeling/expression/constraint.py +0 -340
  57. jijmodeling/expression/expression.py +0 -706
  58. jijmodeling/expression/extract.py +0 -139
  59. jijmodeling/expression/from_old_serializable.py +0 -133
  60. jijmodeling/expression/mathfunc.py +0 -269
  61. jijmodeling/expression/prod.py +0 -117
  62. jijmodeling/expression/serializable.py +0 -132
  63. jijmodeling/expression/sum.py +0 -197
  64. jijmodeling/expression/type_annotations.py +0 -50
  65. jijmodeling/expression/utils.py +0 -175
  66. jijmodeling/expression/variables/__init__.py +0 -35
  67. jijmodeling/expression/variables/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
  68. jijmodeling/expression/variables/__pycache__/__init__.cpython-310.pyc +0 -0
  69. jijmodeling/expression/variables/__pycache__/deci_vars.cpython-310.opt-1.pyc +0 -0
  70. jijmodeling/expression/variables/__pycache__/deci_vars.cpython-310.pyc +0 -0
  71. jijmodeling/expression/variables/__pycache__/jagged_array.cpython-310.opt-1.pyc +0 -0
  72. jijmodeling/expression/variables/__pycache__/jagged_array.cpython-310.pyc +0 -0
  73. jijmodeling/expression/variables/__pycache__/placeholders.cpython-310.opt-1.pyc +0 -0
  74. jijmodeling/expression/variables/__pycache__/placeholders.cpython-310.pyc +0 -0
  75. jijmodeling/expression/variables/__pycache__/variable.cpython-310.opt-1.pyc +0 -0
  76. jijmodeling/expression/variables/__pycache__/variable.cpython-310.pyc +0 -0
  77. jijmodeling/expression/variables/deci_vars.py +0 -136
  78. jijmodeling/expression/variables/jagged_array.py +0 -73
  79. jijmodeling/expression/variables/placeholders.py +0 -107
  80. jijmodeling/expression/variables/variable.py +0 -485
  81. jijmodeling/latex_repr/__init__.py +0 -11
  82. jijmodeling/latex_repr/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
  83. jijmodeling/latex_repr/__pycache__/__init__.cpython-310.pyc +0 -0
  84. jijmodeling/latex_repr/__pycache__/latex_repr.cpython-310.opt-1.pyc +0 -0
  85. jijmodeling/latex_repr/__pycache__/latex_repr.cpython-310.pyc +0 -0
  86. jijmodeling/latex_repr/__pycache__/problem_latex_repr.cpython-310.opt-1.pyc +0 -0
  87. jijmodeling/latex_repr/__pycache__/problem_latex_repr.cpython-310.pyc +0 -0
  88. jijmodeling/latex_repr/latex_repr.py +0 -243
  89. jijmodeling/latex_repr/problem_latex_repr.py +0 -209
  90. jijmodeling/marker/__marker__.cp310-win_amd64.pyd +0 -0
  91. jijmodeling/match/__init__.py +0 -19
  92. jijmodeling/match/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
  93. jijmodeling/match/__pycache__/__init__.cpython-310.pyc +0 -0
  94. jijmodeling/match/__pycache__/condition_same.cpython-310.opt-1.pyc +0 -0
  95. jijmodeling/match/__pycache__/condition_same.cpython-310.pyc +0 -0
  96. jijmodeling/match/__pycache__/constraint_same.cpython-310.opt-1.pyc +0 -0
  97. jijmodeling/match/__pycache__/constraint_same.cpython-310.pyc +0 -0
  98. jijmodeling/match/__pycache__/expr_same.cpython-310.opt-1.pyc +0 -0
  99. jijmodeling/match/__pycache__/expr_same.cpython-310.pyc +0 -0
  100. jijmodeling/match/__pycache__/is_same_expr.cpython-310.opt-1.pyc +0 -0
  101. jijmodeling/match/__pycache__/is_same_expr.cpython-310.pyc +0 -0
  102. jijmodeling/match/__pycache__/penalty_same.cpython-310.opt-1.pyc +0 -0
  103. jijmodeling/match/__pycache__/penalty_same.cpython-310.pyc +0 -0
  104. jijmodeling/match/__pycache__/problem_same.cpython-310.opt-1.pyc +0 -0
  105. jijmodeling/match/__pycache__/problem_same.cpython-310.pyc +0 -0
  106. jijmodeling/match/condition_same.py +0 -44
  107. jijmodeling/match/constraint_same.py +0 -53
  108. jijmodeling/match/expr_same.py +0 -23
  109. jijmodeling/match/is_same_expr.py +0 -288
  110. jijmodeling/match/penalty_same.py +0 -31
  111. jijmodeling/match/problem_same.py +0 -44
  112. jijmodeling/problem/__init__.py +0 -9
  113. jijmodeling/problem/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
  114. jijmodeling/problem/__pycache__/__init__.cpython-310.pyc +0 -0
  115. jijmodeling/problem/__pycache__/problem.cpython-310.opt-1.pyc +0 -0
  116. jijmodeling/problem/__pycache__/problem.cpython-310.pyc +0 -0
  117. jijmodeling/problem/problem.py +0 -166
  118. jijmodeling/protobuf/__init__.py +0 -8
  119. jijmodeling/protobuf/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
  120. jijmodeling/protobuf/__pycache__/__init__.cpython-310.pyc +0 -0
  121. jijmodeling/protobuf/from_protobuf/__init__.py +0 -47
  122. jijmodeling/protobuf/from_protobuf/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
  123. jijmodeling/protobuf/from_protobuf/__pycache__/__init__.cpython-310.pyc +0 -0
  124. jijmodeling/protobuf/from_protobuf/__pycache__/extract_attribute_value_from_header.cpython-310.opt-1.pyc +0 -0
  125. jijmodeling/protobuf/from_protobuf/__pycache__/extract_attribute_value_from_header.cpython-310.pyc +0 -0
  126. jijmodeling/protobuf/from_protobuf/__pycache__/from_protobuf.cpython-310.opt-1.pyc +0 -0
  127. jijmodeling/protobuf/from_protobuf/__pycache__/from_protobuf.cpython-310.pyc +0 -0
  128. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_array_shape.cpython-310.opt-1.pyc +0 -0
  129. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_array_shape.cpython-310.pyc +0 -0
  130. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_binary_op.cpython-310.opt-1.pyc +0 -0
  131. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_binary_op.cpython-310.pyc +0 -0
  132. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_binary_var.cpython-310.opt-1.pyc +0 -0
  133. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_binary_var.cpython-310.pyc +0 -0
  134. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_constraint.cpython-310.opt-1.pyc +0 -0
  135. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_constraint.cpython-310.pyc +0 -0
  136. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_element.cpython-310.opt-1.pyc +0 -0
  137. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_element.cpython-310.pyc +0 -0
  138. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_expression.cpython-310.opt-1.pyc +0 -0
  139. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_expression.cpython-310.pyc +0 -0
  140. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_forall.cpython-310.opt-1.pyc +0 -0
  141. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_forall.cpython-310.pyc +0 -0
  142. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_integer_var.cpython-310.opt-1.pyc +0 -0
  143. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_integer_var.cpython-310.pyc +0 -0
  144. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_jagged_array.cpython-310.opt-1.pyc +0 -0
  145. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_jagged_array.cpython-310.pyc +0 -0
  146. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_number_lit.cpython-310.opt-1.pyc +0 -0
  147. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_number_lit.cpython-310.pyc +0 -0
  148. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_penalty.cpython-310.opt-1.pyc +0 -0
  149. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_penalty.cpython-310.pyc +0 -0
  150. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_placeholder.cpython-310.opt-1.pyc +0 -0
  151. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_placeholder.cpython-310.pyc +0 -0
  152. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_problem.cpython-310.opt-1.pyc +0 -0
  153. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_problem.cpython-310.pyc +0 -0
  154. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_reduction_op.cpython-310.opt-1.pyc +0 -0
  155. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_reduction_op.cpython-310.pyc +0 -0
  156. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_subscript_op.cpython-310.opt-1.pyc +0 -0
  157. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_subscript_op.cpython-310.pyc +0 -0
  158. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_unary_op.cpython-310.opt-1.pyc +0 -0
  159. jijmodeling/protobuf/from_protobuf/__pycache__/message_to_unary_op.cpython-310.pyc +0 -0
  160. jijmodeling/protobuf/from_protobuf/extract_attribute_value_from_header.py +0 -26
  161. jijmodeling/protobuf/from_protobuf/from_protobuf.py +0 -38
  162. jijmodeling/protobuf/from_protobuf/message_to_array_shape.py +0 -35
  163. jijmodeling/protobuf/from_protobuf/message_to_binary_op.py +0 -83
  164. jijmodeling/protobuf/from_protobuf/message_to_binary_var.py +0 -46
  165. jijmodeling/protobuf/from_protobuf/message_to_constraint.py +0 -48
  166. jijmodeling/protobuf/from_protobuf/message_to_element.py +0 -30
  167. jijmodeling/protobuf/from_protobuf/message_to_expression.py +0 -92
  168. jijmodeling/protobuf/from_protobuf/message_to_forall.py +0 -33
  169. jijmodeling/protobuf/from_protobuf/message_to_integer_var.py +0 -54
  170. jijmodeling/protobuf/from_protobuf/message_to_jagged_array.py +0 -25
  171. jijmodeling/protobuf/from_protobuf/message_to_number_lit.py +0 -41
  172. jijmodeling/protobuf/from_protobuf/message_to_penalty.py +0 -36
  173. jijmodeling/protobuf/from_protobuf/message_to_placeholder.py +0 -47
  174. jijmodeling/protobuf/from_protobuf/message_to_problem.py +0 -51
  175. jijmodeling/protobuf/from_protobuf/message_to_reduction_op.py +0 -52
  176. jijmodeling/protobuf/from_protobuf/message_to_subscript_op.py +0 -46
  177. jijmodeling/protobuf/from_protobuf/message_to_unary_op.py +0 -47
  178. jijmodeling/protobuf/to_protobuf/__init__.py +0 -43
  179. jijmodeling/protobuf/to_protobuf/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
  180. jijmodeling/protobuf/to_protobuf/__pycache__/__init__.cpython-310.pyc +0 -0
  181. jijmodeling/protobuf/to_protobuf/__pycache__/add_header_to_message.cpython-310.opt-1.pyc +0 -0
  182. jijmodeling/protobuf/to_protobuf/__pycache__/add_header_to_message.cpython-310.pyc +0 -0
  183. jijmodeling/protobuf/to_protobuf/__pycache__/array_shape_to_message.cpython-310.opt-1.pyc +0 -0
  184. jijmodeling/protobuf/to_protobuf/__pycache__/array_shape_to_message.cpython-310.pyc +0 -0
  185. jijmodeling/protobuf/to_protobuf/__pycache__/binary_op_to_message.cpython-310.opt-1.pyc +0 -0
  186. jijmodeling/protobuf/to_protobuf/__pycache__/binary_op_to_message.cpython-310.pyc +0 -0
  187. jijmodeling/protobuf/to_protobuf/__pycache__/binary_var_to_message.cpython-310.opt-1.pyc +0 -0
  188. jijmodeling/protobuf/to_protobuf/__pycache__/binary_var_to_message.cpython-310.pyc +0 -0
  189. jijmodeling/protobuf/to_protobuf/__pycache__/constraint_to_message.cpython-310.opt-1.pyc +0 -0
  190. jijmodeling/protobuf/to_protobuf/__pycache__/constraint_to_message.cpython-310.pyc +0 -0
  191. jijmodeling/protobuf/to_protobuf/__pycache__/element_to_message.cpython-310.opt-1.pyc +0 -0
  192. jijmodeling/protobuf/to_protobuf/__pycache__/element_to_message.cpython-310.pyc +0 -0
  193. jijmodeling/protobuf/to_protobuf/__pycache__/expression_to_message.cpython-310.opt-1.pyc +0 -0
  194. jijmodeling/protobuf/to_protobuf/__pycache__/expression_to_message.cpython-310.pyc +0 -0
  195. jijmodeling/protobuf/to_protobuf/__pycache__/forall_to_message.cpython-310.opt-1.pyc +0 -0
  196. jijmodeling/protobuf/to_protobuf/__pycache__/forall_to_message.cpython-310.pyc +0 -0
  197. jijmodeling/protobuf/to_protobuf/__pycache__/integer_var_to_message.cpython-310.opt-1.pyc +0 -0
  198. jijmodeling/protobuf/to_protobuf/__pycache__/integer_var_to_message.cpython-310.pyc +0 -0
  199. jijmodeling/protobuf/to_protobuf/__pycache__/jagged_array_to_message.cpython-310.opt-1.pyc +0 -0
  200. jijmodeling/protobuf/to_protobuf/__pycache__/jagged_array_to_message.cpython-310.pyc +0 -0
  201. jijmodeling/protobuf/to_protobuf/__pycache__/number_lit_to_message.cpython-310.opt-1.pyc +0 -0
  202. jijmodeling/protobuf/to_protobuf/__pycache__/number_lit_to_message.cpython-310.pyc +0 -0
  203. jijmodeling/protobuf/to_protobuf/__pycache__/penalty_to_message.cpython-310.opt-1.pyc +0 -0
  204. jijmodeling/protobuf/to_protobuf/__pycache__/penalty_to_message.cpython-310.pyc +0 -0
  205. jijmodeling/protobuf/to_protobuf/__pycache__/placeholder_to_message.cpython-310.opt-1.pyc +0 -0
  206. jijmodeling/protobuf/to_protobuf/__pycache__/placeholder_to_message.cpython-310.pyc +0 -0
  207. jijmodeling/protobuf/to_protobuf/__pycache__/problem_to_message.cpython-310.opt-1.pyc +0 -0
  208. jijmodeling/protobuf/to_protobuf/__pycache__/problem_to_message.cpython-310.pyc +0 -0
  209. jijmodeling/protobuf/to_protobuf/__pycache__/reduction_op_to_message.cpython-310.opt-1.pyc +0 -0
  210. jijmodeling/protobuf/to_protobuf/__pycache__/reduction_op_to_message.cpython-310.pyc +0 -0
  211. jijmodeling/protobuf/to_protobuf/__pycache__/subscript_op_to_message.cpython-310.opt-1.pyc +0 -0
  212. jijmodeling/protobuf/to_protobuf/__pycache__/subscript_op_to_message.cpython-310.pyc +0 -0
  213. jijmodeling/protobuf/to_protobuf/__pycache__/to_protobuf.cpython-310.opt-1.pyc +0 -0
  214. jijmodeling/protobuf/to_protobuf/__pycache__/to_protobuf.cpython-310.pyc +0 -0
  215. jijmodeling/protobuf/to_protobuf/__pycache__/unary_op_to_message.cpython-310.opt-1.pyc +0 -0
  216. jijmodeling/protobuf/to_protobuf/__pycache__/unary_op_to_message.cpython-310.pyc +0 -0
  217. jijmodeling/protobuf/to_protobuf/add_header_to_message.py +0 -35
  218. jijmodeling/protobuf/to_protobuf/array_shape_to_message.py +0 -43
  219. jijmodeling/protobuf/to_protobuf/binary_op_to_message.py +0 -101
  220. jijmodeling/protobuf/to_protobuf/binary_var_to_message.py +0 -49
  221. jijmodeling/protobuf/to_protobuf/constraint_to_message.py +0 -52
  222. jijmodeling/protobuf/to_protobuf/element_to_message.py +0 -43
  223. jijmodeling/protobuf/to_protobuf/expression_to_message.py +0 -89
  224. jijmodeling/protobuf/to_protobuf/forall_to_message.py +0 -32
  225. jijmodeling/protobuf/to_protobuf/integer_var_to_message.py +0 -54
  226. jijmodeling/protobuf/to_protobuf/jagged_array_to_message.py +0 -37
  227. jijmodeling/protobuf/to_protobuf/number_lit_to_message.py +0 -52
  228. jijmodeling/protobuf/to_protobuf/penalty_to_message.py +0 -42
  229. jijmodeling/protobuf/to_protobuf/placeholder_to_message.py +0 -58
  230. jijmodeling/protobuf/to_protobuf/problem_to_message.py +0 -54
  231. jijmodeling/protobuf/to_protobuf/reduction_op_to_message.py +0 -64
  232. jijmodeling/protobuf/to_protobuf/subscript_op_to_message.py +0 -48
  233. jijmodeling/protobuf/to_protobuf/to_protobuf.py +0 -36
  234. jijmodeling/protobuf/to_protobuf/unary_op_to_message.py +0 -58
  235. jijmodeling/sampleset/__init__.py +0 -33
  236. jijmodeling/sampleset/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
  237. jijmodeling/sampleset/__pycache__/__init__.cpython-310.pyc +0 -0
  238. jijmodeling/sampleset/__pycache__/evaluation.cpython-310.opt-1.pyc +0 -0
  239. jijmodeling/sampleset/__pycache__/evaluation.cpython-310.pyc +0 -0
  240. jijmodeling/sampleset/__pycache__/measuring_time.cpython-310.opt-1.pyc +0 -0
  241. jijmodeling/sampleset/__pycache__/measuring_time.cpython-310.pyc +0 -0
  242. jijmodeling/sampleset/__pycache__/record.cpython-310.opt-1.pyc +0 -0
  243. jijmodeling/sampleset/__pycache__/record.cpython-310.pyc +0 -0
  244. jijmodeling/sampleset/__pycache__/sampleset.cpython-310.opt-1.pyc +0 -0
  245. jijmodeling/sampleset/__pycache__/sampleset.cpython-310.pyc +0 -0
  246. jijmodeling/sampleset/__pycache__/solving_time.cpython-310.opt-1.pyc +0 -0
  247. jijmodeling/sampleset/__pycache__/solving_time.cpython-310.pyc +0 -0
  248. jijmodeling/sampleset/__pycache__/system_time.cpython-310.opt-1.pyc +0 -0
  249. jijmodeling/sampleset/__pycache__/system_time.cpython-310.pyc +0 -0
  250. jijmodeling/sampleset/evaluation.py +0 -198
  251. jijmodeling/sampleset/measuring_time.py +0 -59
  252. jijmodeling/sampleset/record.py +0 -158
  253. jijmodeling/sampleset/sampleset.py +0 -381
  254. jijmodeling/sampleset/solving_time.py +0 -38
  255. jijmodeling/sampleset/system_time.py +0 -48
  256. jijmodeling/type_annotations/__init__.py +0 -38
  257. jijmodeling/type_annotations/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
  258. jijmodeling/type_annotations/__pycache__/__init__.cpython-310.pyc +0 -0
  259. jijmodeling/type_annotations/__pycache__/type_annotations.cpython-310.opt-1.pyc +0 -0
  260. jijmodeling/type_annotations/__pycache__/type_annotations.cpython-310.pyc +0 -0
  261. jijmodeling/type_annotations/type_annotations.py +0 -44
  262. jijmodeling/utils/__init__.py +0 -28
  263. jijmodeling/utils/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
  264. jijmodeling/utils/__pycache__/__init__.cpython-310.pyc +0 -0
  265. jijmodeling/utils/__pycache__/utils.cpython-310.opt-1.pyc +0 -0
  266. jijmodeling/utils/__pycache__/utils.cpython-310.pyc +0 -0
  267. jijmodeling/utils/utils.py +0 -146
  268. jijmodeling-0.10.15.dist-info/METADATA +0 -59
  269. jijmodeling-0.10.15.dist-info/RECORD +0 -255
  270. jijmodeling-0.10.15.dist-info/top_level.txt +0 -1
@@ -1,26 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from typing import Union
4
-
5
- import jijmodeling_schema as pb
6
-
7
-
8
- def extract_attribute_value_from_header(
9
- bytes: bytes,
10
- ) -> Union[pb.Problem, pb.Expression]:
11
- """
12
- Extract the attribute value from a header messsage.
13
-
14
- Args:
15
- bytes (bytes): a bytes object that can be decoded in the `Header` message
16
-
17
- Returns:
18
- Union[pb.Problem, pb.Expression]: an instance object of either `Problem` message class or `Expression` message class
19
- """
20
- # Convert the bytes object into the `Header` message object.
21
- header = pb.Header.FromString(bytes)
22
-
23
- # Extract the attribute value from the header message.
24
- attribute_value = pb.betterproto.which_one_of(header.value, "value")[1]
25
-
26
- return attribute_value
@@ -1,38 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from typing import Union
4
-
5
- import jijmodeling_schema as pb
6
-
7
- from jijmodeling.expression.expression import Expression
8
- from jijmodeling.problem.problem import Problem
9
- from jijmodeling.protobuf.from_protobuf.extract_attribute_value_from_header import (
10
- extract_attribute_value_from_header,
11
- )
12
- from jijmodeling.protobuf.from_protobuf.message_to_expression import (
13
- message_to_expression,
14
- )
15
- from jijmodeling.protobuf.from_protobuf.message_to_problem import message_to_problem
16
-
17
-
18
- def from_protobuf(bytes: bytes) -> Union[Problem, Expression]:
19
- """
20
- Convert a bytes object in protobuf to a JijModeling's object.
21
-
22
- Args:
23
- bytes (bytes): a bytes object in protobuf
24
-
25
- Returns:
26
- Expression: an expression
27
- """
28
- # Convert the bytes object into the message object.
29
- attribute_value = extract_attribute_value_from_header(bytes)
30
-
31
- if type(attribute_value) is pb.Problem:
32
- return message_to_problem(attribute_value)
33
- elif isinstance(attribute_value, pb.Expression):
34
- return message_to_expression(attribute_value)
35
- else:
36
- raise RuntimeError(
37
- f"cannot convert the bytes object into the instance object according to the class in JijModeling (bytes = {str(bytes)})"
38
- )
@@ -1,35 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import jijmodeling_schema as pb
4
-
5
- from jijmodeling.expression.variables.placeholders import ArrayShape
6
-
7
-
8
- def message_to_array_shape(
9
- id: str, message: pb.ArrayShape, array: pb.Expression
10
- ) -> ArrayShape:
11
- """
12
- Convert a message to a `ArrayShape` object.
13
-
14
- Args:
15
- id (str): the id of the `ArrayShape` object
16
- message (pb.ArrayShape): the `ArrayShape` message
17
- array (pb.Expression): the target array of the array shape
18
-
19
- Returns:
20
- ArrayShape: an `ArrayShape` object
21
- """
22
- # Set the number of axis.
23
- axis = message.axis
24
-
25
- # NOTE: Import a module within a local scope to fix a circular import.
26
- # - https://stackoverflow.com/questions/59462679/design-of-python-conditional-imports
27
- # - https://medium.com/@hamana.hadrien/so-you-got-a-circular-import-in-python-e9142fe10591
28
- from jijmodeling.protobuf.from_protobuf.message_to_expression import (
29
- message_to_expression,
30
- )
31
-
32
- # Set the target array of this array shape.
33
- array = message_to_expression(array)
34
-
35
- return ArrayShape(uuid=id, array=array, dimension=axis)
@@ -1,83 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from typing import Union
4
-
5
- import jijmodeling_schema as pb
6
-
7
- from jijmodeling.expression.condition import (
8
- AndOperator,
9
- Condition,
10
- Equal,
11
- LessThan,
12
- LessThanEqual,
13
- NotEqual,
14
- OrOperator,
15
- XorOperator,
16
- )
17
- from jijmodeling.expression.expression import Add, BinaryOperator, Div, Mod, Mul, Power
18
- from jijmodeling.expression.variables.variable import Range
19
-
20
-
21
- def message_to_binary_op(
22
- id: str, message: pb.BinaryOp, left: pb.Expression, right: pb.Expression
23
- ) -> Union[BinaryOperator, Range, Condition]:
24
- """
25
- Convert a message to a `BinaryOperator` object.
26
-
27
- Args:
28
- id (str): the id of the `BinaryOperator` object
29
- message (pb.BinaryOp): the `BinaryOp` message
30
- operand (pb.Expression): the operand node that the `BinaryOp` message has
31
-
32
- Raises:
33
- TypeError: the error happens if the message cannot be converted to a `BinaryOperator` object
34
-
35
- Returns:
36
- BinaryOperator: a `BinaryOperator` object
37
- """
38
- # NOTE: Import a module within a local scope to fix a circular import.
39
- # - https://stackoverflow.com/questions/59462679/design-of-python-conditional-imports
40
- # - https://medium.com/@hamana.hadrien/so-you-got-a-circular-import-in-python-e9142fe10591
41
- from jijmodeling.protobuf.from_protobuf.message_to_expression import (
42
- message_to_expression,
43
- )
44
-
45
- # Convert the children to the `Expression` objects.
46
- lhs = message_to_expression(left)
47
- rhs = message_to_expression(right)
48
-
49
- # BinaryOp
50
- if message.kind == pb.BinaryOpKind.ADD:
51
- return Add(uuid=id, left=lhs, right=rhs)
52
- elif message.kind == pb.BinaryOpKind.MUL:
53
- return Mul(uuid=id, left=lhs, right=rhs)
54
- elif message.kind == pb.BinaryOpKind.DIV:
55
- return Div(uuid=id, left=lhs, right=rhs)
56
- elif message.kind == pb.BinaryOpKind.POW:
57
- return Power(uuid=id, left=lhs, right=rhs)
58
- elif message.kind == pb.BinaryOpKind.MOD:
59
- return Mod(uuid=id, left=lhs, right=rhs)
60
- # Range
61
- elif message.kind == pb.BinaryOpKind.RANGE:
62
- return Range(start=lhs, last=rhs, uuid=id)
63
- # ComparisonOp
64
- elif message.kind == pb.BinaryOpKind.EQ:
65
- return Equal(uuid=id, left=lhs, right=rhs)
66
- elif message.kind == pb.BinaryOpKind.NOT_EQ:
67
- return NotEqual(uuid=id, left=lhs, right=rhs)
68
- elif message.kind == pb.BinaryOpKind.LESS_THAN:
69
- return LessThan(uuid=id, left=lhs, right=rhs)
70
- elif message.kind == pb.BinaryOpKind.LESS_THAN_EQ:
71
- return LessThanEqual(uuid=id, left=lhs, right=rhs)
72
- # Logicalop
73
- elif message.kind == pb.BinaryOpKind.AND:
74
- return AndOperator(uuid=id, left=lhs, right=rhs)
75
- elif message.kind == pb.BinaryOpKind.OR:
76
- return OrOperator(uuid=id, left=lhs, right=rhs)
77
- elif message.kind == pb.BinaryOpKind.XOR:
78
- return XorOperator(uuid=id, left=lhs, right=rhs)
79
- # Otherwise
80
- else:
81
- raise TypeError(
82
- f"cannot convert the binary operator (actual = {message}) to an expression."
83
- )
@@ -1,46 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from typing import List
4
-
5
- import jijmodeling_schema as pb
6
-
7
- from jijmodeling.expression.variables.deci_vars import Binary
8
-
9
-
10
- def message_to_binary_var(
11
- id: str, message: pb.BinaryVar, shape: List[pb.Expression]
12
- ) -> Binary:
13
- """
14
- Convert a message to a `Binary` object.
15
-
16
- Args:
17
- id (str): the id of the `Binary` object
18
- message (pb.BinaryVar): the `BinaryVar` message
19
- shape (List[pb.Expression]): the shape of the `Binary` object
20
-
21
- Raises:
22
- ValueError: the error occurs if `dim` is not equal to length of the shape
23
-
24
- Returns:
25
- Binary: a `Binary` object
26
- """
27
- # Validate length of the shape.
28
- if message.dim != len(shape):
29
- raise ValueError("invalid length of the shape")
30
-
31
- # Set the symbol.
32
- symbol = message.symbol
33
-
34
- # NOTE: Import a module within a local scope to fix a circular import.
35
- # - https://stackoverflow.com/questions/59462679/design-of-python-conditional-imports
36
- # - https://medium.com/@hamana.hadrien/so-you-got-a-circular-import-in-python-e9142fe10591
37
- from jijmodeling.protobuf.from_protobuf.message_to_expression import (
38
- message_to_expression,
39
- )
40
-
41
- # Set the shape.
42
- shape_element_list = [
43
- message_to_expression(shape_element) for shape_element in shape
44
- ]
45
-
46
- return Binary(label=symbol, shape=shape_element_list, uuid=id)
@@ -1,48 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import jijmodeling_schema as pb
4
-
5
- from jijmodeling.expression.constraint import Constraint
6
- from jijmodeling.protobuf.from_protobuf.message_to_expression import (
7
- message_to_expression,
8
- )
9
- from jijmodeling.protobuf.from_protobuf.message_to_forall import message_to_forall
10
-
11
-
12
- def message_to_constraint(constraint: pb.Constraint) -> Constraint:
13
- """
14
- Convert a `Constraint` message into a `Constraint` object.
15
-
16
- Args:
17
- constraint (pb.Constraint): a `Constraint` message
18
-
19
- Returns:
20
- Constraint: a `Constraint` object
21
- """
22
- # Set the name of the constraint.
23
- name = constraint.name
24
-
25
- # Set the condition expression.
26
- condition = message_to_expression(constraint.expression)
27
-
28
- # Set the list of forall.
29
- forall = [message_to_forall(forall) for forall in constraint.forall]
30
-
31
- # Set the left_lower.
32
- has_left_lower = (
33
- pb.betterproto.which_one_of(constraint.left_lower.kind, "kind")[1] is not None
34
- )
35
- if has_left_lower:
36
- left_lower = message_to_expression(constraint.left_lower)
37
- else:
38
- left_lower = None
39
-
40
- return Constraint(
41
- label=name,
42
- condition=condition,
43
- forall=forall,
44
- left_lower=left_lower,
45
- with_penalty=constraint.is_penalty,
46
- with_multiplier=constraint.needs_multiplier,
47
- auto_qubo=constraint.needs_square,
48
- )
@@ -1,30 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import jijmodeling_schema as pb
4
-
5
- from jijmodeling.expression.variables.variable import Element
6
-
7
-
8
- def message_to_element(id: str, message: pb.Element, parent: pb.Expression) -> Element:
9
- """
10
- Convert a message to a `Element` object.
11
-
12
- Args:
13
- id (str): the id of the `Element` object
14
- message (pb.Element): the `Element` message
15
- parent (pb.Expression): the parent node that the `Element` message has
16
-
17
- Returns:
18
- Element: an `Element` object
19
- """
20
- # Set the symbol
21
- symbol = message.symbol
22
-
23
- # NOTE: Import a module within a local scope to fix a circular import.
24
- # - https://stackoverflow.com/questions/59462679/design-of-python-conditional-imports
25
- # - https://medium.com/@hamana.hadrien/so-you-got-a-circular-import-in-python-e9142fe10591
26
- from jijmodeling.protobuf.from_protobuf.message_to_expression import (
27
- message_to_expression,
28
- )
29
-
30
- return Element(label=symbol, parent=message_to_expression(parent), uuid=id)
@@ -1,92 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from typing import Union
4
-
5
- import jijmodeling_schema as pb
6
-
7
- from jijmodeling.expression.condition import Condition
8
- from jijmodeling.expression.expression import Expression
9
- from jijmodeling.expression.variables.variable import Range
10
- from jijmodeling.protobuf.from_protobuf.message_to_array_shape import (
11
- message_to_array_shape,
12
- )
13
- from jijmodeling.protobuf.from_protobuf.message_to_binary_op import message_to_binary_op
14
- from jijmodeling.protobuf.from_protobuf.message_to_binary_var import (
15
- message_to_binary_var,
16
- )
17
- from jijmodeling.protobuf.from_protobuf.message_to_element import message_to_element
18
- from jijmodeling.protobuf.from_protobuf.message_to_integer_var import (
19
- message_to_integer_var,
20
- )
21
- from jijmodeling.protobuf.from_protobuf.message_to_jagged_array import (
22
- message_to_jagged_array,
23
- )
24
- from jijmodeling.protobuf.from_protobuf.message_to_number_lit import (
25
- message_to_number_lit,
26
- )
27
- from jijmodeling.protobuf.from_protobuf.message_to_placeholder import (
28
- message_to_placeholder,
29
- )
30
- from jijmodeling.protobuf.from_protobuf.message_to_reduction_op import (
31
- message_to_reduction_op,
32
- )
33
- from jijmodeling.protobuf.from_protobuf.message_to_subscript_op import (
34
- message_to_subscript_op,
35
- )
36
- from jijmodeling.protobuf.from_protobuf.message_to_unary_op import message_to_unary_op
37
-
38
-
39
- def message_to_expression(
40
- expression: pb.Expression,
41
- ) -> Union[Expression, Range, Condition]:
42
- """
43
- Convert a message object to a `Expression` object.
44
-
45
- Args:
46
- expression (pb.Expression): a `Expression` message
47
-
48
- Raises:
49
- RuntimeError: the error occurs if the massage cannot be converted to an object that is a subclass of the `Expression` class
50
-
51
- Returns:
52
- Expression: an instance object that is a subclass of the `Expression` class
53
- """
54
- # Get the id that the message has.
55
- id = expression.id
56
-
57
- # Get the `Expression` object from the field inside the oneof.
58
- expr_attr = pb.betterproto.which_one_of(expression.kind, "kind")[1]
59
-
60
- if type(expr_attr) is pb.NumberLit:
61
- return message_to_number_lit(id, expr_attr)
62
- elif type(expr_attr) is pb.Placeholder:
63
- shape = expression.children
64
- return message_to_placeholder(id, expr_attr, shape)
65
- elif type(expr_attr) is pb.ArrayShape:
66
- array = expression.children[0]
67
- return message_to_array_shape(id, expr_attr, array)
68
- elif type(expr_attr) is pb.Element:
69
- parent = expression.children[0]
70
- return message_to_element(id, expr_attr, parent)
71
- elif type(expr_attr) is pb.JaggedArray:
72
- return message_to_jagged_array(id, expr_attr)
73
- elif type(expr_attr) is pb.BinaryVar:
74
- shape = expression.children
75
- return message_to_binary_var(id, expr_attr, shape)
76
- elif type(expr_attr) is pb.IntegerVar:
77
- return message_to_integer_var(id, expr_attr, expression.children)
78
- elif type(expr_attr) is pb.UnaryOp:
79
- operand = expression.children[0]
80
- return message_to_unary_op(id, expr_attr, operand)
81
- elif type(expr_attr) is pb.BinaryOp:
82
- left = expression.children[0]
83
- right = expression.children[1]
84
- return message_to_binary_op(id, expr_attr, left, right)
85
- elif type(expr_attr) is pb.SubscriptOp:
86
- return message_to_subscript_op(id, expr_attr, expression.children)
87
- elif type(expr_attr) is pb.ReductionOp:
88
- return message_to_reduction_op(id, expr_attr, expression.children)
89
- else:
90
- raise RuntimeError(
91
- f"cannot convert the {expr_attr.__class__.__name__} object into the instance object according to the class in JijModeling"
92
- )
@@ -1,33 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from typing import Optional, Tuple
4
-
5
- import jijmodeling_schema as pb
6
-
7
- from jijmodeling.expression.condition import Condition
8
- from jijmodeling.expression.variables.variable import Element
9
- from jijmodeling.protobuf.from_protobuf.message_to_expression import (
10
- message_to_expression,
11
- )
12
-
13
-
14
- def message_to_forall(forall: pb.Forall) -> Tuple[Element, Optional[Condition]]:
15
- """
16
- Convert a `Forall` message into a `forall` object.
17
-
18
- Args:
19
- forall (pb.Forall): a `Forall` message
20
-
21
- Returns:
22
- Tuple[Element, Optional[Condition]]: objects to make the `forall` object
23
- """
24
- # Set the element.
25
- element = message_to_expression(forall.element)
26
-
27
- # Set the condition expression.
28
- is_none_condition = (
29
- pb.betterproto.which_one_of(forall.condition.kind, "kind")[1] is None
30
- )
31
- condition = None if is_none_condition else message_to_expression(forall.condition)
32
-
33
- return (element, condition)
@@ -1,54 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from typing import List
4
-
5
- import jijmodeling_schema as pb
6
-
7
- from jijmodeling.expression.variables.deci_vars import Integer
8
-
9
-
10
- def message_to_integer_var(
11
- id: str, message: pb.IntegerVar, children: List[pb.Expression]
12
- ) -> Integer:
13
- """
14
- Convert a message to an `Integer` object.
15
-
16
- Args:
17
- id (str): the id of the `Integer` object
18
- message (pb.IntegerVar): the `IntegerVar` message
19
- children (List[pb.Expression]): 0: lower bound, 1: upper bound, 2..: the shape of the `Integer` object
20
-
21
- Raises:
22
- ValueError: the error occurs if `dim` is not equal to length of the shape
23
-
24
- Returns:
25
- Integer: an `Integer` object
26
- """
27
- # Validate length of the shape.
28
- if message.dim + 2 != len(children):
29
- raise ValueError("invalid length of the shape")
30
-
31
- # Set the symbol.
32
- symbol = message.symbol
33
-
34
- # NOTE: Import a module within a local scope to fix a circular import.
35
- # - https://stackoverflow.com/questions/59462679/design-of-python-conditional-imports
36
- # - https://medium.com/@hamana.hadrien/so-you-got-a-circular-import-in-python-e9142fe10591
37
- from jijmodeling.protobuf.from_protobuf.message_to_expression import (
38
- message_to_expression,
39
- )
40
-
41
- # Set the lower.
42
- lower = message_to_expression(children[0])
43
-
44
- # Set the upper.
45
- upper = message_to_expression(children[1])
46
-
47
- # Set the shape.
48
- shape_element_list = [
49
- message_to_expression(shape_element) for shape_element in children[2:]
50
- ]
51
-
52
- return Integer(
53
- label=symbol, lower=lower, upper=upper, shape=shape_element_list, uuid=id
54
- )
@@ -1,25 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import jijmodeling_schema as pb
4
-
5
- from jijmodeling.expression.variables.jagged_array import JaggedArray
6
-
7
-
8
- def message_to_jagged_array(id: str, message: pb.JaggedArray) -> JaggedArray:
9
- """
10
- Convert a message to a `JaggedArray` object.
11
-
12
- Args:
13
- id (str): the id of the `JaggedArray` object
14
- message (pb.JaggedArray): the `JaggedArray` message
15
-
16
- Returns:
17
- JaggedArray: a `JaggedArray` object
18
- """
19
- # Set the symbol.
20
- symbol = message.symbol
21
-
22
- # Set the number of dimensions.
23
- dim = message.dim
24
-
25
- return JaggedArray(label=symbol, dim=dim, uuid=id)
@@ -1,41 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import struct
4
-
5
- import jijmodeling_schema as pb
6
-
7
- from jijmodeling.expression.expression import DataType, Number
8
-
9
-
10
- def message_to_number_lit(id: str, message: pb.NumberLit) -> Number:
11
- """
12
- Convert a message to a `Number` object.
13
-
14
- Args:
15
- message (pb.NumberLit): the `NumberLit` message
16
- id (str): the id of the `Number` object
17
-
18
- Returns:
19
- Number: a `Number` object
20
- """
21
- # Check the type that the number literal object has.
22
- # Case: integer
23
- if message.type == pb.NumberLitType.INTEGER:
24
- # Set the value type to `FLOAT`.
25
- dtype = DataType.INT
26
- # Set the integer value.
27
- value = struct.unpack(
28
- ">q",
29
- message.value.to_bytes(length=struct.calcsize(">q"), byteorder="big"),
30
- )[0]
31
- # Case: float
32
- elif message.type == pb.NumberLitType.FLOAT:
33
- # Set the value type to `FLOAT`.
34
- dtype = DataType.FLOAT
35
- # Convert the bits to a float value.
36
- value = struct.unpack(
37
- ">d",
38
- message.value.to_bytes(length=struct.calcsize(">d"), byteorder="big"),
39
- )[0]
40
-
41
- return Number(value=value, dtype=dtype, uuid=id)
@@ -1,36 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import jijmodeling_schema as pb
4
-
5
- from jijmodeling.expression.constraint import Penalty
6
- from jijmodeling.protobuf.from_protobuf.message_to_expression import (
7
- message_to_expression,
8
- )
9
- from jijmodeling.protobuf.from_protobuf.message_to_forall import message_to_forall
10
-
11
-
12
- def message_to_penalty(penalty: pb.Penalty) -> Penalty:
13
- """
14
- Convert a `Penalty` message into a `Penalty` object.
15
-
16
- Args:
17
- penalty (pb.Penalty): a `Penalty` message
18
-
19
- Returns:
20
- Penalty: a `Penalty` object
21
- """
22
- # Set the name of the penalty.
23
- name = penalty.name
24
-
25
- # Set the penalty term.
26
- expr = message_to_expression(penalty.expression)
27
-
28
- # Set the list of forall.
29
- forall = [message_to_forall(forall) for forall in penalty.forall]
30
-
31
- return Penalty(
32
- label=name,
33
- penalty_term=expr,
34
- forall=forall,
35
- with_multiplier=penalty.needs_multiplier,
36
- )
@@ -1,47 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from typing import List
4
-
5
- import jijmodeling_schema as pb
6
-
7
- from jijmodeling.expression.variables.placeholders import Placeholder
8
-
9
-
10
- def message_to_placeholder(
11
- id: str, message: pb.Placeholder, shape: List[pb.Expression]
12
- ) -> Placeholder:
13
- """
14
- Convert a message to a `Placeholder` object.
15
-
16
- Args:
17
- id (str): the id of the `Placeholder` object
18
- message (pb.Placeholder): the `Placeholder` message
19
- shape (List[pb.Expression]): the shape of the `Placeholder` object
20
-
21
- Returns:
22
- Placeholder: a `Placeholder` object
23
- """
24
- # Set the symbol.
25
- symbol = message.symbol
26
-
27
- # Set the number of dimensions.
28
- dim = message.dim
29
-
30
- # Set the shape.
31
- shape_list = []
32
- expr_idx = 0
33
- for shape_elt in message.shape:
34
- if shape_elt == pb.PlaceholderShapeElement.DYNAMIC:
35
- shape_list.append(None)
36
- else:
37
- # NOTE: Import a module within a local scope to fix a circular import.
38
- # - https://stackoverflow.com/questions/59462679/design-of-python-conditional-imports
39
- # - https://medium.com/@hamana.hadrien/so-you-got-a-circular-import-in-python-e9142fe10591
40
- from jijmodeling.protobuf.from_protobuf.message_to_expression import (
41
- message_to_expression,
42
- )
43
-
44
- shape_list.append(message_to_expression(shape[expr_idx]))
45
- expr_idx = expr_idx + 1
46
-
47
- return Placeholder(label=symbol, dim=dim, uuid=id, shape=shape_list)