luna-bench 0.1.0__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 (289) hide show
  1. luna_bench-0.1.0/LICENSE +202 -0
  2. luna_bench-0.1.0/PKG-INFO +203 -0
  3. luna_bench-0.1.0/README.md +175 -0
  4. luna_bench-0.1.0/luna_bench/__init__.py +86 -0
  5. luna_bench-0.1.0/luna_bench/_internal/__init__.py +3 -0
  6. luna_bench-0.1.0/luna_bench/_internal/background_tasks/__init__.py +4 -0
  7. luna_bench-0.1.0/luna_bench/_internal/background_tasks/background_task_container.py +21 -0
  8. luna_bench-0.1.0/luna_bench/_internal/background_tasks/huey/__init__.py +0 -0
  9. luna_bench-0.1.0/luna_bench/_internal/background_tasks/huey/huey_algorithm_runner.py +131 -0
  10. luna_bench-0.1.0/luna_bench/_internal/background_tasks/huey/huey_background_task_client.py +177 -0
  11. luna_bench-0.1.0/luna_bench/_internal/background_tasks/protocols.py +36 -0
  12. luna_bench-0.1.0/luna_bench/_internal/dao/__init__.py +4 -0
  13. luna_bench-0.1.0/luna_bench/_internal/dao/algorithm_sql_dao.py +207 -0
  14. luna_bench-0.1.0/luna_bench/_internal/dao/benchmark_sql_dao.py +114 -0
  15. luna_bench-0.1.0/luna_bench/_internal/dao/dao_container.py +83 -0
  16. luna_bench-0.1.0/luna_bench/_internal/dao/database/__init__.py +0 -0
  17. luna_bench-0.1.0/luna_bench/_internal/dao/database/peewee_transaction.py +81 -0
  18. luna_bench-0.1.0/luna_bench/_internal/dao/feature_sql_dao.py +180 -0
  19. luna_bench-0.1.0/luna_bench/_internal/dao/metric_sql_dao.py +186 -0
  20. luna_bench-0.1.0/luna_bench/_internal/dao/model_sql_dao.py +149 -0
  21. luna_bench-0.1.0/luna_bench/_internal/dao/modelset_sql_dao.py +141 -0
  22. luna_bench-0.1.0/luna_bench/_internal/dao/plot_sql_dao.py +124 -0
  23. luna_bench-0.1.0/luna_bench/_internal/dao/protocols.py +266 -0
  24. luna_bench-0.1.0/luna_bench/_internal/dao/tables/__init__.py +25 -0
  25. luna_bench-0.1.0/luna_bench/_internal/dao/tables/algorithm_result_table.py +36 -0
  26. luna_bench-0.1.0/luna_bench/_internal/dao/tables/algorithm_table.py +37 -0
  27. luna_bench-0.1.0/luna_bench/_internal/dao/tables/base_table.py +45 -0
  28. luna_bench-0.1.0/luna_bench/_internal/dao/tables/benchmark_table.py +23 -0
  29. luna_bench-0.1.0/luna_bench/_internal/dao/tables/feature_result_table.py +30 -0
  30. luna_bench-0.1.0/luna_bench/_internal/dao/tables/feature_table.py +36 -0
  31. luna_bench-0.1.0/luna_bench/_internal/dao/tables/metric_result_table.py +37 -0
  32. luna_bench-0.1.0/luna_bench/_internal/dao/tables/metric_table.py +36 -0
  33. luna_bench-0.1.0/luna_bench/_internal/dao/tables/model_metadata_table.py +14 -0
  34. luna_bench-0.1.0/luna_bench/_internal/dao/tables/model_table.py +9 -0
  35. luna_bench-0.1.0/luna_bench/_internal/dao/tables/modelset_table.py +11 -0
  36. luna_bench-0.1.0/luna_bench/_internal/dao/tables/plot_config_table.py +30 -0
  37. luna_bench-0.1.0/luna_bench/_internal/domain_models/__init__.py +27 -0
  38. luna_bench-0.1.0/luna_bench/_internal/domain_models/algorithm_domain.py +19 -0
  39. luna_bench-0.1.0/luna_bench/_internal/domain_models/algorithm_result_domain.py +43 -0
  40. luna_bench-0.1.0/luna_bench/_internal/domain_models/algorithm_type_enum.py +8 -0
  41. luna_bench-0.1.0/luna_bench/_internal/domain_models/arbitrary_data_domain.py +5 -0
  42. luna_bench-0.1.0/luna_bench/_internal/domain_models/base_domain.py +5 -0
  43. luna_bench-0.1.0/luna_bench/_internal/domain_models/benchmark_domain.py +23 -0
  44. luna_bench-0.1.0/luna_bench/_internal/domain_models/benchmark_status_enum.py +12 -0
  45. luna_bench-0.1.0/luna_bench/_internal/domain_models/feature_domain.py +14 -0
  46. luna_bench-0.1.0/luna_bench/_internal/domain_models/feature_result_domain.py +13 -0
  47. luna_bench-0.1.0/luna_bench/_internal/domain_models/metric_domain.py +15 -0
  48. luna_bench-0.1.0/luna_bench/_internal/domain_models/metric_result_domain.py +14 -0
  49. luna_bench-0.1.0/luna_bench/_internal/domain_models/model_metadata_domain.py +30 -0
  50. luna_bench-0.1.0/luna_bench/_internal/domain_models/modelset_domain.py +26 -0
  51. luna_bench-0.1.0/luna_bench/_internal/domain_models/plot_config_domain.py +12 -0
  52. luna_bench-0.1.0/luna_bench/_internal/domain_models/registered_data_domain.py +8 -0
  53. luna_bench-0.1.0/luna_bench/_internal/mappers/__init__.py +13 -0
  54. luna_bench-0.1.0/luna_bench/_internal/mappers/algorithm_mapper.py +90 -0
  55. luna_bench-0.1.0/luna_bench/_internal/mappers/base_mapper.py +34 -0
  56. luna_bench-0.1.0/luna_bench/_internal/mappers/benchmark_mapper.py +93 -0
  57. luna_bench-0.1.0/luna_bench/_internal/mappers/container.py +64 -0
  58. luna_bench-0.1.0/luna_bench/_internal/mappers/feature_mapper.py +67 -0
  59. luna_bench-0.1.0/luna_bench/_internal/mappers/metric_mapper.py +75 -0
  60. luna_bench-0.1.0/luna_bench/_internal/mappers/mixins/__init__.py +0 -0
  61. luna_bench-0.1.0/luna_bench/_internal/mappers/mixins/model_list_mixin.py +33 -0
  62. luna_bench-0.1.0/luna_bench/_internal/mappers/plot_mapper.py +51 -0
  63. luna_bench-0.1.0/luna_bench/_internal/registries/__init__.py +3 -0
  64. luna_bench-0.1.0/luna_bench/_internal/registries/arbitrary_data_registry.py +43 -0
  65. luna_bench-0.1.0/luna_bench/_internal/registries/base_registry.py +87 -0
  66. luna_bench-0.1.0/luna_bench/_internal/registries/protocols.py +38 -0
  67. luna_bench-0.1.0/luna_bench/_internal/registries/registry_container.py +42 -0
  68. luna_bench-0.1.0/luna_bench/_internal/usecases/__init__.py +53 -0
  69. luna_bench-0.1.0/luna_bench/_internal/usecases/background_tasks/__init__.py +11 -0
  70. luna_bench-0.1.0/luna_bench/_internal/usecases/background_tasks/background_retrieve_algorithm_async.py +50 -0
  71. luna_bench-0.1.0/luna_bench/_internal/usecases/background_tasks/background_retrieve_algorithm_sync.py +49 -0
  72. luna_bench-0.1.0/luna_bench/_internal/usecases/background_tasks/background_run_algorithm_async.py +29 -0
  73. luna_bench-0.1.0/luna_bench/_internal/usecases/background_tasks/background_run_algorithm_sync.py +27 -0
  74. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/__init__.py +44 -0
  75. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/algorithm/__init__.py +20 -0
  76. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/algorithm/algorithm_add.py +106 -0
  77. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/algorithm/algorithm_filter.py +37 -0
  78. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/algorithm/algorithm_remove.py +32 -0
  79. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/algorithm/algorithm_retrieve_async_retrival_data.py +133 -0
  80. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/algorithm/algorithm_retrieve_async_solutions.py +75 -0
  81. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/algorithm/algorithm_retrieve_sync_solutions.py +123 -0
  82. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/algorithm/algorithm_run.py +93 -0
  83. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/algorithm/algorithm_run_as_background_tasks.py +77 -0
  84. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/benchmark_create.py +49 -0
  85. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/benchmark_delete.py +28 -0
  86. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/benchmark_load.py +51 -0
  87. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/benchmark_load_all.py +59 -0
  88. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/benchmark_remove_modelset.py +28 -0
  89. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/benchmark_set_modelset.py +30 -0
  90. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/enums.py +6 -0
  91. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/feature/__init__.py +5 -0
  92. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/feature/feature_add.py +71 -0
  93. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/feature/feature_remove.py +32 -0
  94. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/feature/feature_run.py +132 -0
  95. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/helper/__init__.py +4 -0
  96. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/helper/feature_result_builder.py +94 -0
  97. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/helper/metric_result_builder.py +102 -0
  98. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/metric/__init__.py +7 -0
  99. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/metric/metric_add.py +80 -0
  100. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/metric/metric_remove.py +32 -0
  101. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/metric/metric_run.py +152 -0
  102. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/plot/__init__.py +7 -0
  103. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/plot/plot_add.py +79 -0
  104. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/plot/plot_remove.py +30 -0
  105. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/plot/plot_run.py +129 -0
  106. luna_bench-0.1.0/luna_bench/_internal/usecases/benchmark/protocols.py +230 -0
  107. luna_bench-0.1.0/luna_bench/_internal/usecases/modelset/__init__.py +16 -0
  108. luna_bench-0.1.0/luna_bench/_internal/usecases/modelset/model/__init__.py +6 -0
  109. luna_bench-0.1.0/luna_bench/_internal/usecases/modelset/model/model_add.py +80 -0
  110. luna_bench-0.1.0/luna_bench/_internal/usecases/modelset/model/model_fetch.py +49 -0
  111. luna_bench-0.1.0/luna_bench/_internal/usecases/modelset/model/model_load_all.py +47 -0
  112. luna_bench-0.1.0/luna_bench/_internal/usecases/modelset/model/model_remove.py +82 -0
  113. luna_bench-0.1.0/luna_bench/_internal/usecases/modelset/modelset_create.py +68 -0
  114. luna_bench-0.1.0/luna_bench/_internal/usecases/modelset/modelset_delete.py +46 -0
  115. luna_bench-0.1.0/luna_bench/_internal/usecases/modelset/modelset_load.py +68 -0
  116. luna_bench-0.1.0/luna_bench/_internal/usecases/modelset/modelset_load_all.py +64 -0
  117. luna_bench-0.1.0/luna_bench/_internal/usecases/modelset/protocols.py +177 -0
  118. luna_bench-0.1.0/luna_bench/_internal/usecases/usecase_container.py +250 -0
  119. luna_bench-0.1.0/luna_bench/_internal/wrappers/__init__.py +3 -0
  120. luna_bench-0.1.0/luna_bench/_internal/wrappers/luna_quantum/__init__.py +3 -0
  121. luna_bench-0.1.0/luna_bench/_internal/wrappers/luna_quantum/algorithms/__init__.py +3 -0
  122. luna_bench-0.1.0/luna_bench/_internal/wrappers/luna_quantum/algorithms/luna_algorithm.py +104 -0
  123. luna_bench-0.1.0/luna_bench/_internal/wrappers/luna_quantum/luna_algorithm_wrapper.py +97 -0
  124. luna_bench-0.1.0/luna_bench/algorithms/__init__.py +4 -0
  125. luna_bench-0.1.0/luna_bench/algorithms/fake_algorithm.py +32 -0
  126. luna_bench-0.1.0/luna_bench/algorithms/scip.py +125 -0
  127. luna_bench-0.1.0/luna_bench/benchmark.py +1059 -0
  128. luna_bench-0.1.0/luna_bench/configs/__init__.py +3 -0
  129. luna_bench-0.1.0/luna_bench/configs/config.py +31 -0
  130. luna_bench-0.1.0/luna_bench/custom/__init__.py +56 -0
  131. luna_bench-0.1.0/luna_bench/custom/base_components/__init__.py +0 -0
  132. luna_bench-0.1.0/luna_bench/custom/base_components/base_algorithm_async.py +71 -0
  133. luna_bench-0.1.0/luna_bench/custom/base_components/base_algorithm_sync.py +31 -0
  134. luna_bench-0.1.0/luna_bench/custom/base_components/base_feature.py +39 -0
  135. luna_bench-0.1.0/luna_bench/custom/base_components/base_metric.py +44 -0
  136. luna_bench-0.1.0/luna_bench/custom/base_components/base_plot.py +30 -0
  137. luna_bench-0.1.0/luna_bench/custom/base_components/meta_classes/__init__.py +0 -0
  138. luna_bench-0.1.0/luna_bench/custom/base_components/meta_classes/metric_class_meta.py +18 -0
  139. luna_bench-0.1.0/luna_bench/custom/base_components/meta_classes/registered_class_meta.py +13 -0
  140. luna_bench-0.1.0/luna_bench/custom/base_components/meta_classes/write_once_meta.py +47 -0
  141. luna_bench-0.1.0/luna_bench/custom/base_components/registerable_component.py +9 -0
  142. luna_bench-0.1.0/luna_bench/custom/base_results/__init__.py +0 -0
  143. luna_bench-0.1.0/luna_bench/custom/base_results/arbitrary_data.py +10 -0
  144. luna_bench-0.1.0/luna_bench/custom/base_results/feature_result.py +5 -0
  145. luna_bench-0.1.0/luna_bench/custom/base_results/feature_result_enum.py +56 -0
  146. luna_bench-0.1.0/luna_bench/custom/base_results/metric_result.py +5 -0
  147. luna_bench-0.1.0/luna_bench/custom/decorators/__init__.py +0 -0
  148. luna_bench-0.1.0/luna_bench/custom/decorators/algorithm.py +183 -0
  149. luna_bench-0.1.0/luna_bench/custom/decorators/decorator_utilities.py +145 -0
  150. luna_bench-0.1.0/luna_bench/custom/decorators/feature.py +159 -0
  151. luna_bench-0.1.0/luna_bench/custom/decorators/metric.py +260 -0
  152. luna_bench-0.1.0/luna_bench/custom/decorators/plot.py +215 -0
  153. luna_bench-0.1.0/luna_bench/custom/registry_info.py +153 -0
  154. luna_bench-0.1.0/luna_bench/custom/result_containers/__init__.py +0 -0
  155. luna_bench-0.1.0/luna_bench/custom/result_containers/benchmark_result_container.py +51 -0
  156. luna_bench-0.1.0/luna_bench/custom/result_containers/feature_result_container.py +170 -0
  157. luna_bench-0.1.0/luna_bench/custom/result_containers/metric_result_container.py +186 -0
  158. luna_bench-0.1.0/luna_bench/custom/types.py +30 -0
  159. luna_bench-0.1.0/luna_bench/entities/__init__.py +26 -0
  160. luna_bench-0.1.0/luna_bench/entities/algorithm_entity.py +23 -0
  161. luna_bench-0.1.0/luna_bench/entities/algorithm_result_entity.py +36 -0
  162. luna_bench-0.1.0/luna_bench/entities/benchmark_entity.py +23 -0
  163. luna_bench-0.1.0/luna_bench/entities/enums/__init__.py +7 -0
  164. luna_bench-0.1.0/luna_bench/entities/enums/error_handling_mode_enum.py +13 -0
  165. luna_bench-0.1.0/luna_bench/entities/enums/job_status_enum.py +11 -0
  166. luna_bench-0.1.0/luna_bench/entities/feature_entity.py +20 -0
  167. luna_bench-0.1.0/luna_bench/entities/feature_result_entity.py +19 -0
  168. luna_bench-0.1.0/luna_bench/entities/metric_entity.py +19 -0
  169. luna_bench-0.1.0/luna_bench/entities/metric_result_entity.py +19 -0
  170. luna_bench-0.1.0/luna_bench/entities/model_metadata_entity.py +27 -0
  171. luna_bench-0.1.0/luna_bench/entities/model_set_entity.py +29 -0
  172. luna_bench-0.1.0/luna_bench/entities/plot_entity.py +17 -0
  173. luna_bench-0.1.0/luna_bench/errors/__init__.py +0 -0
  174. luna_bench-0.1.0/luna_bench/errors/base_error.py +2 -0
  175. luna_bench-0.1.0/luna_bench/errors/bench_type_errors/__init__.py +0 -0
  176. luna_bench-0.1.0/luna_bench/errors/bench_type_errors/algorithm_sub_type_error.py +8 -0
  177. luna_bench-0.1.0/luna_bench/errors/bench_type_errors/bench_type_error.py +5 -0
  178. luna_bench-0.1.0/luna_bench/errors/components/__init__.py +0 -0
  179. luna_bench-0.1.0/luna_bench/errors/components/component_error.py +5 -0
  180. luna_bench-0.1.0/luna_bench/errors/components/features/__init__.py +0 -0
  181. luna_bench-0.1.0/luna_bench/errors/components/features/feature_error.py +5 -0
  182. luna_bench-0.1.0/luna_bench/errors/components/features/feature_result_unknown_name_error.py +18 -0
  183. luna_bench-0.1.0/luna_bench/errors/components/features/feature_result_wrong_class_error.py +14 -0
  184. luna_bench-0.1.0/luna_bench/errors/components/metrics/__init__.py +5 -0
  185. luna_bench-0.1.0/luna_bench/errors/components/metrics/metric_error.py +5 -0
  186. luna_bench-0.1.0/luna_bench/errors/components/metrics/metric_result_unknown_name_error.py +18 -0
  187. luna_bench-0.1.0/luna_bench/errors/components/metrics/metric_result_wrong_class_error.py +14 -0
  188. luna_bench-0.1.0/luna_bench/errors/dao/__init__.py +0 -0
  189. luna_bench-0.1.0/luna_bench/errors/dao/dao_error.py +5 -0
  190. luna_bench-0.1.0/luna_bench/errors/dao/data_not_exist_error.py +8 -0
  191. luna_bench-0.1.0/luna_bench/errors/dao/data_not_unique_error.py +8 -0
  192. luna_bench-0.1.0/luna_bench/errors/decorators/__init__.py +11 -0
  193. luna_bench-0.1.0/luna_bench/errors/decorators/decorator_error.py +5 -0
  194. luna_bench-0.1.0/luna_bench/errors/decorators/invalid_parameter_type_error.py +26 -0
  195. luna_bench-0.1.0/luna_bench/errors/decorators/invalid_return_type_error.py +23 -0
  196. luna_bench-0.1.0/luna_bench/errors/decorators/invalid_signature_error.py +23 -0
  197. luna_bench-0.1.0/luna_bench/errors/incompatible_class_error.py +13 -0
  198. luna_bench-0.1.0/luna_bench/errors/infeasible_model_error.py +12 -0
  199. luna_bench-0.1.0/luna_bench/errors/invalid_worker_type_error.py +11 -0
  200. luna_bench-0.1.0/luna_bench/errors/missing_optional_dependency_error.py +14 -0
  201. luna_bench-0.1.0/luna_bench/errors/model_decoding_error.py +18 -0
  202. luna_bench-0.1.0/luna_bench/errors/registry/__init__.py +0 -0
  203. luna_bench-0.1.0/luna_bench/errors/registry/already_registerd_id_error.py +9 -0
  204. luna_bench-0.1.0/luna_bench/errors/registry/base_registry_error.py +5 -0
  205. luna_bench-0.1.0/luna_bench/errors/registry/unknown_component_error.py +10 -0
  206. luna_bench-0.1.0/luna_bench/errors/registry/unknown_id_error.py +10 -0
  207. luna_bench-0.1.0/luna_bench/errors/run_errors/__init__.py +0 -0
  208. luna_bench-0.1.0/luna_bench/errors/run_errors/algorithm_not_done.py +10 -0
  209. luna_bench-0.1.0/luna_bench/errors/run_errors/plots_errors/__init__.py +0 -0
  210. luna_bench-0.1.0/luna_bench/errors/run_errors/plots_errors/features_missing_error.py +31 -0
  211. luna_bench-0.1.0/luna_bench/errors/run_errors/plots_errors/metrics_missing_error.py +31 -0
  212. luna_bench-0.1.0/luna_bench/errors/run_errors/plots_errors/plot_exectuion_error.py +11 -0
  213. luna_bench-0.1.0/luna_bench/errors/run_errors/plots_errors/plot_run_error.py +10 -0
  214. luna_bench-0.1.0/luna_bench/errors/run_errors/run_algorithm_missing_error.py +13 -0
  215. luna_bench-0.1.0/luna_bench/errors/run_errors/run_algorithm_runtime_error.py +13 -0
  216. luna_bench-0.1.0/luna_bench/errors/run_errors/run_error.py +5 -0
  217. luna_bench-0.1.0/luna_bench/errors/run_errors/run_feature_missing_error.py +13 -0
  218. luna_bench-0.1.0/luna_bench/errors/run_errors/run_metric_missing_error.py +13 -0
  219. luna_bench-0.1.0/luna_bench/errors/run_errors/run_modelset_missing_error.py +12 -0
  220. luna_bench-0.1.0/luna_bench/errors/run_errors/run_plot_missing_error.py +13 -0
  221. luna_bench-0.1.0/luna_bench/errors/unknown_error.py +15 -0
  222. luna_bench-0.1.0/luna_bench/errors/validation_errors/__init__.py +0 -0
  223. luna_bench-0.1.0/luna_bench/errors/validation_errors/validation_error.py +5 -0
  224. luna_bench-0.1.0/luna_bench/errors/validation_errors/validation_solution_error.py +8 -0
  225. luna_bench-0.1.0/luna_bench/errors/write_once_error.py +8 -0
  226. luna_bench-0.1.0/luna_bench/features/__init__.py +11 -0
  227. luna_bench-0.1.0/luna_bench/features/fake_feature.py +36 -0
  228. luna_bench-0.1.0/luna_bench/features/mip/__init__.py +63 -0
  229. luna_bench-0.1.0/luna_bench/features/mip/linear_constraint_matrix.py +213 -0
  230. luna_bench-0.1.0/luna_bench/features/mip/objective_function_features.py +230 -0
  231. luna_bench-0.1.0/luna_bench/features/mip/problem_size_feature.py +285 -0
  232. luna_bench-0.1.0/luna_bench/features/mip/right_hand_side_feature.py +140 -0
  233. luna_bench-0.1.0/luna_bench/features/mip/variable_constraint_graph_feature.py +168 -0
  234. luna_bench-0.1.0/luna_bench/features/optsol_feature.py +141 -0
  235. luna_bench-0.1.0/luna_bench/features/qubo/__init__.py +6 -0
  236. luna_bench-0.1.0/luna_bench/features/qubo/get_qubo.py +47 -0
  237. luna_bench-0.1.0/luna_bench/features/qubo/graph_features.py +136 -0
  238. luna_bench-0.1.0/luna_bench/features/qubo/matrix_features.py +105 -0
  239. luna_bench-0.1.0/luna_bench/features/qubo/sparsity_density_features.py +80 -0
  240. luna_bench-0.1.0/luna_bench/features/qubo/spectral_analysis_features.py +146 -0
  241. luna_bench-0.1.0/luna_bench/features/var_num_feature.py +31 -0
  242. luna_bench-0.1.0/luna_bench/helpers/__init__.py +7 -0
  243. luna_bench-0.1.0/luna_bench/helpers/degree.py +8 -0
  244. luna_bench-0.1.0/luna_bench/helpers/divider_helper.py +29 -0
  245. luna_bench-0.1.0/luna_bench/helpers/model_matrix_extraction.py +134 -0
  246. luna_bench-0.1.0/luna_bench/helpers/numpy_stats_helper.py +107 -0
  247. luna_bench-0.1.0/luna_bench/helpers/optional_dependencies.py +19 -0
  248. luna_bench-0.1.0/luna_bench/helpers/var_scope.py +11 -0
  249. luna_bench-0.1.0/luna_bench/metrics/__init__.py +30 -0
  250. luna_bench-0.1.0/luna_bench/metrics/approximation_ratio.py +105 -0
  251. luna_bench-0.1.0/luna_bench/metrics/best_solution_found.py +89 -0
  252. luna_bench-0.1.0/luna_bench/metrics/best_solution_found_ratio.py +125 -0
  253. luna_bench-0.1.0/luna_bench/metrics/fake_metric.py +24 -0
  254. luna_bench-0.1.0/luna_bench/metrics/feasbility_ratio.py +65 -0
  255. luna_bench-0.1.0/luna_bench/metrics/fraction_of_overall_best_solution.py +110 -0
  256. luna_bench-0.1.0/luna_bench/metrics/runtime.py +55 -0
  257. luna_bench-0.1.0/luna_bench/metrics/time_to_solution.py +148 -0
  258. luna_bench-0.1.0/luna_bench/model_metadata.py +79 -0
  259. luna_bench-0.1.0/luna_bench/model_set.py +305 -0
  260. luna_bench-0.1.0/luna_bench/plots/__init__.py +32 -0
  261. luna_bench-0.1.0/luna_bench/plots/analysis/__init__.py +11 -0
  262. luna_bench-0.1.0/luna_bench/plots/analysis/approximation_ratio_vs_var_number_plot.py +52 -0
  263. luna_bench-0.1.0/luna_bench/plots/analysis/feasibility_ratio_vs_var_number_plot.py +52 -0
  264. luna_bench-0.1.0/luna_bench/plots/analysis/runtime_vs_var_number_plot.py +57 -0
  265. luna_bench-0.1.0/luna_bench/plots/fake_plot.py +59 -0
  266. luna_bench-0.1.0/luna_bench/plots/generics/__init__.py +0 -0
  267. luna_bench-0.1.0/luna_bench/plots/generics/bar_plot.py +108 -0
  268. luna_bench-0.1.0/luna_bench/plots/generics/scatter_plot.py +93 -0
  269. luna_bench-0.1.0/luna_bench/plots/generics/seaborn_plot.py +71 -0
  270. luna_bench-0.1.0/luna_bench/plots/performance/__init__.py +17 -0
  271. luna_bench-0.1.0/luna_bench/plots/performance/average_approximation_ratio_plot.py +53 -0
  272. luna_bench-0.1.0/luna_bench/plots/performance/average_best_solution_found_plot.py +53 -0
  273. luna_bench-0.1.0/luna_bench/plots/performance/average_feasibility_ratio_plot.py +52 -0
  274. luna_bench-0.1.0/luna_bench/plots/performance/average_fob_ratio_plot.py +53 -0
  275. luna_bench-0.1.0/luna_bench/plots/performance/average_runtime_plot.py +49 -0
  276. luna_bench-0.1.0/luna_bench/plots/performance/runtime_per_model_plot.py +51 -0
  277. luna_bench-0.1.0/luna_bench/plots/properties/__init__.py +7 -0
  278. luna_bench-0.1.0/luna_bench/plots/properties/var_number_bar_chart_plot.py +48 -0
  279. luna_bench-0.1.0/luna_bench/plots/utils/__init__.py +4 -0
  280. luna_bench-0.1.0/luna_bench/plots/utils/aggregation_enum.py +30 -0
  281. luna_bench-0.1.0/luna_bench/plots/utils/style.py +33 -0
  282. luna_bench-0.1.0/luna_bench/py.typed +0 -0
  283. luna_bench-0.1.0/luna_bench.egg-info/PKG-INFO +203 -0
  284. luna_bench-0.1.0/luna_bench.egg-info/SOURCES.txt +287 -0
  285. luna_bench-0.1.0/luna_bench.egg-info/dependency_links.txt +1 -0
  286. luna_bench-0.1.0/luna_bench.egg-info/requires.txt +15 -0
  287. luna_bench-0.1.0/luna_bench.egg-info/top_level.txt +1 -0
  288. luna_bench-0.1.0/pyproject.toml +74 -0
  289. luna_bench-0.1.0/setup.cfg +4 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,203 @@
1
+ Metadata-Version: 2.4
2
+ Name: luna-bench
3
+ Version: 0.1.0
4
+ Summary: Benchmarking framework for classical, hybrid and quantum optimization algorithms
5
+ Author-email: Aqarios GmbH <support@aqarios.com>, Llewellyn Hochhauser <llewellyn.hochhauser@aqarios.com>, Maximilian Janetschek <maximilian.janetschek@aqarios.com>, Jonas Blenninger <jonas.blenninger@aqarios.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://aqarios.com
8
+ Project-URL: Documentation, https://docs.aqarios.com/luna-bench/intro
9
+ Keywords: aqarios,luna,quantum computing,quantum optimization,optimization,benchmarking
10
+ Requires-Python: >=3.13
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: dependency-injector>=4.48.2
14
+ Requires-Dist: huey>=3.0.0
15
+ Requires-Dist: luna-model>=0.6.0
16
+ Requires-Dist: luna-quantum>=1.2.1
17
+ Requires-Dist: peewee>=4.0.0
18
+ Requires-Dist: pydantic-settings>=2.11.0
19
+ Requires-Dist: returns[compatible-mypy]>=0.27.0
20
+ Requires-Dist: rich>=14.1.0
21
+ Provides-Extra: pre-defined
22
+ Requires-Dist: networkx>=3.6.1; extra == "pre-defined"
23
+ Requires-Dist: scipy>=1.17.0; extra == "pre-defined"
24
+ Requires-Dist: pyscipopt>=6.0.1; extra == "pre-defined"
25
+ Requires-Dist: matplotlib>=3.10.8; extra == "pre-defined"
26
+ Requires-Dist: seaborn>=0.13.0; extra == "pre-defined"
27
+ Dynamic: license-file
28
+
29
+ <div align="center">
30
+ <img src="./assets/luna_bench_logo.svg" alt="Luna-Bench" width="300">
31
+ </div>
32
+
33
+ # Luna-Bench
34
+
35
+ A framework for benchmarking optimization algorithms across quantum and classical domains. Define your models, plug
36
+ in solvers, and compare results with predefined features and metrics. Add plots to visualize your benchmark results.
37
+
38
+ > **Alpha Notice:** Luna-Bench is still in alpha. Many things are not final — for example, how metrics and features are
39
+ > accessed in plots is something we are still actively experimenting with to find the best approach. We highly welcome
40
+ > any user input and feedback! Feel free to open an issue or start a discussion.
41
+
42
+ ## Why
43
+
44
+ Benchmarking optimization algorithms is tedious. You end up writing the same infrastructure over and over: result
45
+ storage, metric computation, plotting, managing model sets. Luna-Bench handles all of that so you can focus on the
46
+ algorithms themselves. Features and metrics are tested and reused across benchmarks, which means fewer bugs and more
47
+ consistent results.
48
+
49
+ - Compare quantum and classical solvers by adding algorithms easily from luna_quantum or add your own
50
+ - Persistent storage for results and configurations via SQLite
51
+ - Built-in metrics like approximation ratio, time to solution, and fraction of best solution
52
+ - Extensible through custom algorithms, metrics, features, and plots if desired
53
+ - Full type safety with Pydantic validation
54
+ - Reproducible benchmarks with database-backed result tracking
55
+
56
+ <div align="center">
57
+ <img src="./assets/luna_bench_dark.svg" alt="Luna-Bench Overview" width="600">
58
+ </div>
59
+
60
+ ## Installation
61
+
62
+ Requires Python 3.13+.
63
+
64
+ ```bash
65
+ pip install luna-bench
66
+ ```
67
+
68
+ ## Quick Start
69
+
70
+ ### Define your models
71
+
72
+ ```python
73
+ from luna_model import Model, Variable
74
+ from luna_bench.components import ModelSet
75
+
76
+ # Build a simple optimization model
77
+ model = Model("example")
78
+ with model.environment:
79
+ x = Variable("x")
80
+ y = Variable("y")
81
+ model.objective = x * y + x
82
+ model.constraints += x >= 0
83
+ model.constraints += y <= 5
84
+
85
+ # Group models into a set
86
+ modelset = ModelSet.create("my_models")
87
+ modelset.add(model)
88
+ ```
89
+
90
+ ### Run a benchmark
91
+
92
+ ```python
93
+ from luna_bench import Benchmark
94
+ from luna_bench.algorithms import ScipAlgorithm
95
+ from luna_bench.features import OptSolFeature
96
+ from luna_bench.metrics import ApproximationRatio
97
+ from luna_bench.plots import AverageFeasibilityRatioPlot
98
+ from luna_quantum.algorithms import FlexQAOA
99
+
100
+ benchmark = Benchmark.create("my_benchmark")
101
+ benchmark.set_modelset(modelset)
102
+
103
+ # Add a solver
104
+ benchmark.add_algorithm("scip", ScipAlgorithm(max_runtime=60))
105
+
106
+ # Add any luna_quantum algorithm directly
107
+ benchmark.add_algorithm("flexqaoa", FlexQAOA())
108
+
109
+ # Add a feature that computes the optimal solution (used by metrics)
110
+ benchmark.add_feature("optimal_solution", OptSolFeature())
111
+
112
+ # Add a metric to evaluate solution quality
113
+ benchmark.add_metric("approx_ratio", ApproximationRatio())
114
+
115
+ # Add a plot to visualize metric results
116
+ benchmark.add_plot("approx_plot", AverageFeasibilityRatioPlot())
117
+
118
+ # Run everything: features, algorithms, metrics, plots
119
+ benchmark.run()
120
+ ```
121
+
122
+ That's it. Luna-Bench runs your solvers against every model in the set, computes features, evaluates metrics, and stores the results.
123
+
124
+ ### Write your own algorithm
125
+
126
+ Subclass `BaseAlgorithmSync` and register it with the `@algorithm` decorator.
127
+
128
+ ```python
129
+ from luna_bench.custom import BaseAlgorithmSync
130
+ from luna_bench.custom import algorithm
131
+ from luna_model import Model, Solution
132
+
133
+
134
+ @algorithm()
135
+ class MyAlgorithm(BaseAlgorithmSync):
136
+ max_iterations: int = 1000
137
+
138
+ def run(self, model: Model) -> Solution:
139
+ # Your solver logic here
140
+ ...
141
+ ```
142
+
143
+ ### Write your own feature
144
+
145
+ Features extract properties from models. They run before algorithms and metrics.
146
+
147
+ ```python
148
+ from luna_bench.custom import BaseFeature
149
+ from luna_bench.custom import feature
150
+ from luna_bench.types import FeatureResult
151
+ from luna_model import Model
152
+
153
+
154
+ class MyFeatureResult(FeatureResult):
155
+ num_variables: int
156
+
157
+
158
+ @feature
159
+ class MyFeature(BaseFeature):
160
+ def run(self, model: Model) -> MyFeatureResult:
161
+ return MyFeatureResult(num_variables=model.num_variables)
162
+ ```
163
+
164
+ ### Write your own metric
165
+
166
+ Metrics evaluate solutions. They can depend on features for reference data like optimal solutions.
167
+
168
+ ```python
169
+ from luna_bench.custom import BaseMetric
170
+ from luna_bench.custom.data_types.feature_result_container import FeatureResultContainer
171
+ from luna_bench.custom import metric
172
+ from luna_bench.types import MetricResult
173
+ from luna_model import Solution
174
+
175
+
176
+ class MyMetricResult(MetricResult):
177
+ score: float
178
+
179
+
180
+ @metric()
181
+ class MyMetric(BaseMetric):
182
+ def run(self, solution: Solution, feature_results: FeatureResultContainer) -> MyMetricResult:
183
+ score = solution.expectation_value()
184
+ return MyMetricResult(score=score)
185
+ ```
186
+
187
+ ## Development
188
+
189
+ ```bash
190
+ # Install dependencies
191
+ uv sync
192
+
193
+ # Install pre-commit hooks (runs linting, formatting, type checking, and tests on each commit)
194
+ pre-commit run . --all-files
195
+ ```
196
+
197
+ ## License
198
+
199
+ This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
200
+
201
+ ## Acknowledgments
202
+
203
+ Built by the Aqarios team.
@@ -0,0 +1,175 @@
1
+ <div align="center">
2
+ <img src="./assets/luna_bench_logo.svg" alt="Luna-Bench" width="300">
3
+ </div>
4
+
5
+ # Luna-Bench
6
+
7
+ A framework for benchmarking optimization algorithms across quantum and classical domains. Define your models, plug
8
+ in solvers, and compare results with predefined features and metrics. Add plots to visualize your benchmark results.
9
+
10
+ > **Alpha Notice:** Luna-Bench is still in alpha. Many things are not final — for example, how metrics and features are
11
+ > accessed in plots is something we are still actively experimenting with to find the best approach. We highly welcome
12
+ > any user input and feedback! Feel free to open an issue or start a discussion.
13
+
14
+ ## Why
15
+
16
+ Benchmarking optimization algorithms is tedious. You end up writing the same infrastructure over and over: result
17
+ storage, metric computation, plotting, managing model sets. Luna-Bench handles all of that so you can focus on the
18
+ algorithms themselves. Features and metrics are tested and reused across benchmarks, which means fewer bugs and more
19
+ consistent results.
20
+
21
+ - Compare quantum and classical solvers by adding algorithms easily from luna_quantum or add your own
22
+ - Persistent storage for results and configurations via SQLite
23
+ - Built-in metrics like approximation ratio, time to solution, and fraction of best solution
24
+ - Extensible through custom algorithms, metrics, features, and plots if desired
25
+ - Full type safety with Pydantic validation
26
+ - Reproducible benchmarks with database-backed result tracking
27
+
28
+ <div align="center">
29
+ <img src="./assets/luna_bench_dark.svg" alt="Luna-Bench Overview" width="600">
30
+ </div>
31
+
32
+ ## Installation
33
+
34
+ Requires Python 3.13+.
35
+
36
+ ```bash
37
+ pip install luna-bench
38
+ ```
39
+
40
+ ## Quick Start
41
+
42
+ ### Define your models
43
+
44
+ ```python
45
+ from luna_model import Model, Variable
46
+ from luna_bench.components import ModelSet
47
+
48
+ # Build a simple optimization model
49
+ model = Model("example")
50
+ with model.environment:
51
+ x = Variable("x")
52
+ y = Variable("y")
53
+ model.objective = x * y + x
54
+ model.constraints += x >= 0
55
+ model.constraints += y <= 5
56
+
57
+ # Group models into a set
58
+ modelset = ModelSet.create("my_models")
59
+ modelset.add(model)
60
+ ```
61
+
62
+ ### Run a benchmark
63
+
64
+ ```python
65
+ from luna_bench import Benchmark
66
+ from luna_bench.algorithms import ScipAlgorithm
67
+ from luna_bench.features import OptSolFeature
68
+ from luna_bench.metrics import ApproximationRatio
69
+ from luna_bench.plots import AverageFeasibilityRatioPlot
70
+ from luna_quantum.algorithms import FlexQAOA
71
+
72
+ benchmark = Benchmark.create("my_benchmark")
73
+ benchmark.set_modelset(modelset)
74
+
75
+ # Add a solver
76
+ benchmark.add_algorithm("scip", ScipAlgorithm(max_runtime=60))
77
+
78
+ # Add any luna_quantum algorithm directly
79
+ benchmark.add_algorithm("flexqaoa", FlexQAOA())
80
+
81
+ # Add a feature that computes the optimal solution (used by metrics)
82
+ benchmark.add_feature("optimal_solution", OptSolFeature())
83
+
84
+ # Add a metric to evaluate solution quality
85
+ benchmark.add_metric("approx_ratio", ApproximationRatio())
86
+
87
+ # Add a plot to visualize metric results
88
+ benchmark.add_plot("approx_plot", AverageFeasibilityRatioPlot())
89
+
90
+ # Run everything: features, algorithms, metrics, plots
91
+ benchmark.run()
92
+ ```
93
+
94
+ That's it. Luna-Bench runs your solvers against every model in the set, computes features, evaluates metrics, and stores the results.
95
+
96
+ ### Write your own algorithm
97
+
98
+ Subclass `BaseAlgorithmSync` and register it with the `@algorithm` decorator.
99
+
100
+ ```python
101
+ from luna_bench.custom import BaseAlgorithmSync
102
+ from luna_bench.custom import algorithm
103
+ from luna_model import Model, Solution
104
+
105
+
106
+ @algorithm()
107
+ class MyAlgorithm(BaseAlgorithmSync):
108
+ max_iterations: int = 1000
109
+
110
+ def run(self, model: Model) -> Solution:
111
+ # Your solver logic here
112
+ ...
113
+ ```
114
+
115
+ ### Write your own feature
116
+
117
+ Features extract properties from models. They run before algorithms and metrics.
118
+
119
+ ```python
120
+ from luna_bench.custom import BaseFeature
121
+ from luna_bench.custom import feature
122
+ from luna_bench.types import FeatureResult
123
+ from luna_model import Model
124
+
125
+
126
+ class MyFeatureResult(FeatureResult):
127
+ num_variables: int
128
+
129
+
130
+ @feature
131
+ class MyFeature(BaseFeature):
132
+ def run(self, model: Model) -> MyFeatureResult:
133
+ return MyFeatureResult(num_variables=model.num_variables)
134
+ ```
135
+
136
+ ### Write your own metric
137
+
138
+ Metrics evaluate solutions. They can depend on features for reference data like optimal solutions.
139
+
140
+ ```python
141
+ from luna_bench.custom import BaseMetric
142
+ from luna_bench.custom.data_types.feature_result_container import FeatureResultContainer
143
+ from luna_bench.custom import metric
144
+ from luna_bench.types import MetricResult
145
+ from luna_model import Solution
146
+
147
+
148
+ class MyMetricResult(MetricResult):
149
+ score: float
150
+
151
+
152
+ @metric()
153
+ class MyMetric(BaseMetric):
154
+ def run(self, solution: Solution, feature_results: FeatureResultContainer) -> MyMetricResult:
155
+ score = solution.expectation_value()
156
+ return MyMetricResult(score=score)
157
+ ```
158
+
159
+ ## Development
160
+
161
+ ```bash
162
+ # Install dependencies
163
+ uv sync
164
+
165
+ # Install pre-commit hooks (runs linting, formatting, type checking, and tests on each commit)
166
+ pre-commit run . --all-files
167
+ ```
168
+
169
+ ## License
170
+
171
+ This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
172
+
173
+ ## Acknowledgments
174
+
175
+ Built by the Aqarios team.
@@ -0,0 +1,86 @@
1
+ from luna_bench._internal.background_tasks.background_task_container import BackgroundTaskContainer
2
+ from luna_bench._internal.dao.dao_container import DaoContainer
3
+ from luna_bench._internal.mappers.container import MapperContainer
4
+ from luna_bench._internal.registries.registry_container import RegistryContainer
5
+ from luna_bench._internal.usecases import UsecaseContainer
6
+ from luna_bench.configs.config import config
7
+
8
+ _usecase_container = UsecaseContainer()
9
+ _registry_container = RegistryContainer()
10
+ _mapper_container = MapperContainer()
11
+ _dao_container = DaoContainer()
12
+ _bg_task_container = BackgroundTaskContainer()
13
+
14
+ _mapper_container.registry_container.override(_registry_container)
15
+ _usecase_container.mapper_container.override(_mapper_container)
16
+ _usecase_container.dao_container.override(_dao_container)
17
+ _usecase_container.bg_task_container.override(_bg_task_container)
18
+
19
+ _dao_container.config.from_pydantic(config)
20
+ _usecase_container.config.from_pydantic(config)
21
+
22
+ _registry_container.wire(
23
+ modules=[
24
+ "luna_bench.custom.decorators.algorithm",
25
+ "luna_bench.custom.decorators.feature",
26
+ "luna_bench.custom.decorators.metric",
27
+ "luna_bench.custom.decorators.plot",
28
+ "luna_bench.custom.registry_info",
29
+ "luna_bench.custom",
30
+ "luna_bench._internal.usecases.modelset",
31
+ "luna_bench._internal.usecases.benchmark",
32
+ "luna_bench._internal.wrappers",
33
+ ],
34
+ )
35
+ _bg_task_container.wire(
36
+ modules=[
37
+ "luna_bench._internal.usecases.background_tasks",
38
+ "luna_bench._internal.usecases.benchmark",
39
+ ]
40
+ )
41
+
42
+ _usecase_container.wire(
43
+ modules=[
44
+ "luna_bench.algorithms",
45
+ "luna_bench.features",
46
+ "luna_bench.metrics",
47
+ "luna_bench.plots",
48
+ "luna_bench.benchmark",
49
+ "luna_bench.model_set",
50
+ "luna_bench.model_metadata",
51
+ ]
52
+ )
53
+
54
+ _dao_container.wire(
55
+ modules=[
56
+ "luna_bench._internal.usecases.modelset",
57
+ "luna_bench._internal.usecases.benchmark",
58
+ "luna_bench._internal.background_tasks.huey.huey_algorithm_runner",
59
+ ]
60
+ )
61
+
62
+
63
+ _mapper_container.wire(
64
+ modules=[
65
+ "luna_bench._internal.usecases.modelset",
66
+ "luna_bench._internal.usecases.benchmark",
67
+ ]
68
+ )
69
+
70
+ # Import components AFTER wiring to ensure decorators have access to injected registries
71
+
72
+ from luna_bench.benchmark import Benchmark # noqa: E402
73
+ from luna_bench.model_metadata import ModelMetadata # noqa: E402
74
+ from luna_bench.model_set import ModelSet # noqa: E402
75
+
76
+ __all__ = (
77
+ "Benchmark",
78
+ "ModelMetadata",
79
+ "ModelSet",
80
+ )
81
+
82
+ # Import and wrapping after the wiring is done,
83
+ # to ensure the wrappers and decorators have access to the injected registries
84
+ from luna_bench._internal.wrappers import LunaAlgorithmWrapper # noqa: E402
85
+
86
+ LunaAlgorithmWrapper.wrap_all_algorithms()
@@ -0,0 +1,3 @@
1
+ from .usecases import UsecaseContainer
2
+
3
+ __all__ = ["UsecaseContainer"]
@@ -0,0 +1,4 @@
1
+ from .background_task_container import BackgroundTaskContainer
2
+ from .protocols import BackgroundAlgorithmRunner, BackgroundTaskClient
3
+
4
+ __all__ = ["BackgroundAlgorithmRunner", "BackgroundTaskClient", "BackgroundTaskContainer"]