{"id":17293406,"url":"https://github.com/ghackebeil/pybnb","last_synced_at":"2025-04-14T10:21:26.080Z","repository":{"id":62579024,"uuid":"130922413","full_name":"ghackebeil/pybnb","owner":"ghackebeil","description":"A parallel branch-and-bound engine for Python. (https://pybnb.readthedocs.io/)","archived":false,"fork":false,"pushed_at":"2021-07-08T16:33:09.000Z","size":823,"stargazers_count":69,"open_issues_count":3,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T23:33:01.355Z","etag":null,"topics":["branch-and-bound","optimization","optimization-algorithms","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ghackebeil.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-24T22:54:21.000Z","updated_at":"2025-03-12T12:00:17.000Z","dependencies_parsed_at":"2022-11-03T21:02:50.982Z","dependency_job_id":null,"html_url":"https://github.com/ghackebeil/pybnb","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghackebeil%2Fpybnb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghackebeil%2Fpybnb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghackebeil%2Fpybnb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghackebeil%2Fpybnb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ghackebeil","download_url":"https://codeload.github.com/ghackebeil/pybnb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248860006,"owners_count":21173344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["branch-and-bound","optimization","optimization-algorithms","python"],"created_at":"2024-10-15T10:48:02.477Z","updated_at":"2025-04-14T10:21:26.058Z","avatar_url":"https://github.com/ghackebeil.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"pybnb\n=====\n\n|PyPI-Status| |PyPI-Versions| |PyPI-Downloads|\n\n|Testing-Status| |Coverage-Status| |Documentation-Status|\n\n|Codacy-Grade| |Mypy| |Black|\n\nA parallel branch-and-bound engine for Python. (https://pybnb.readthedocs.io)\n\nThis software is copyright (c) by Gabriel A. Hackebeil (gabe.hackebeil@gmail.com).\n\nThis software is released under the MIT software license.\nThis license, including disclaimer, is available in the 'LICENSE' file.\n\nQuick Start\n-----------\n\n**Define a problem:**\n\n.. code:: python\n\n  # simple.py\n\n  import pybnb\n  class Simple(pybnb.Problem):\n      def __init__(self):\n          self.bounds = [0.0,1.0]\n      def sense(self):\n          return pybnb.minimize\n      def objective(self):\n          return round(self.bounds[1] - self.bounds[0], 3)\n      def bound(self):\n          return -(self.bounds[1] - self.bounds[0])**2\n      def save_state(self, node):\n          node.state = self.bounds\n      def load_state(self, node):\n          self.bounds = node.state\n      def branch(self):\n          L, U = self.bounds\n          mid = 0.5 * (L + U)\n          for l,u in [(L,mid), (mid,U)]:\n              child = pybnb.Node()\n              child.state = (l,u)\n              yield child\n\n**Write a solve script:**\n\n.. code:: python\n\n  # solve_simple.py\n\n  import simple\n  problem = simple.Simple()\n  results = pybnb.solve(problem,\n                        absolute_gap=1e-9)\n\n**Run the script:**\n\n.. code:: bash\n\n  $ mpirun -np 4 python solve_simple.py\n\n  Using non-default solver options:\n   - absolute_gap: 1e-09 (default: 0)\n\n  Starting branch \u0026 bound solve:\n   - dispatcher pid: 34902 (Ozymandias.local)\n   - worker processes: 3\n  ---------------------------------------------------------------------------------------------------------------------------\n           Nodes        |                      Objective Bounds                        |              Work              \n        Expl    Unexpl  |      Incumbent           Bound     Rel. Gap         Abs. Gap | Time (s)  Nodes/Sec Imbalance   Idle\n           0         1  |            inf            -inf          inf%             inf |      0.0       0.00     0.00%      0\n  *        1         2  |              1              -1  200.0000000%               2 |      0.0    1226.99   300.00%      1\n  *        2         3  |            0.5              -1  150.0000000%             1.5 |      0.0    2966.04   150.00%      0\n  *        4         5  |           0.25           -0.25   50.0000000%             0.5 |      0.0    8081.95    75.00%      0\n  *        8         9  |          0.125         -0.0625   18.7500000%          0.1875 |      0.0   12566.90    37.50%      0\n        Expl    Unexpl  |      Incumbent           Bound     Rel. Gap         Abs. Gap | Time (s)  Nodes/Sec Imbalance   Idle\n  *       16        17  |          0.062       -0.015625    7.7625000%        0.077625 |      0.0   15352.74    18.75%      0\n  *       32        33  |          0.031     -0.00390625    3.4906250%      0.03490625 |      0.0   15981.49    18.75%      0\n  *       64        65  |          0.016   -0.0009765625    1.6976563%    0.0169765625 |      0.0   18740.68    18.75%      0\n  *      128       129  |          0.008   -0.0002441406    0.8244141%  0.008244140625 |      0.0   21573.51    11.72%      0\n  *      256       257  |          0.004   -6.103516e-05    0.4061035%  0.004061035156 |      0.0   22166.96     8.20%      0\n        Expl    Unexpl  |      Incumbent           Bound     Rel. Gap         Abs. Gap | Time (s)  Nodes/Sec Imbalance   Idle\n  *      512       513  |          0.002   -1.525879e-05    0.2015259%  0.002015258789 |      0.0   21177.00     5.86%      0\n  *     1024      1025  |          0.001   -3.814697e-06    0.1003815%  0.001003814697 |      0.1   19978.42     9.38%      0\n  *     2048      2049  |              0   -9.536743e-07    0.0000954% 9.536743164e-07 |      0.1   21606.45     5.42%      0\n       24029     24030  |              0   -1.490116e-08    0.0000015% 1.490116119e-08 |      1.1   21961.03     5.98%      0\n       46159     46160  |              0    -3.72529e-09    0.0000004% 3.725290298e-09 |      2.1   22120.75     5.73%      0\n        Expl    Unexpl  |      Incumbent           Bound     Rel. Gap         Abs. Gap | Time (s)  Nodes/Sec Imbalance   Idle\n       65537     65538  |              0   -9.313226e-10    0.0000001% 9.313225746e-10 |      3.0   22459.50     6.20%      0\n  ---------------------------------------------------------------------------------------------------------------------------\n  \n  Absolute optimality tolerance met\n  Optimal solution found!\n  \n  solver results:\n   - solution_status: optimal\n   - termination_condition: optimality\n   - objective: 0\n   - bound: -9.313226e-10\n   - absolute_gap: 9.313226e-10\n   - relative_gap: 9.313226e-10\n   - nodes: 65537\n   - wall_time: 2.96 s\n   - best_node: Node(objective=0)\n  \n  Number of Workers:        3\n  Load Imbalance:       6.20%\n   - min: 21355 (proc rank=3)\n   - max: 22710 (proc rank=1)\n  Average Worker Timing:\n   - queue:      80.78% [avg time: 109.6 us, count: 65537]\n   - load_state:  0.44% [avg time: 596.1 ns, count: 65537]\n   - bound:       0.59% [avg time: 796.1 ns, count: 65537]\n   - objective:   3.52% [avg time:   4.7 us, count: 65537]\n   - branch:      3.36% [avg time:   4.6 us, count: 65537]\n   - other:      11.31% [avg time:  15.3 us, count: 65537]\n\n\n.. |Testing-Status| image:: https://github.com/ghackebeil/pybnb/actions/workflows/ci.yml/badge.svg\n  :target: https://github.com/ghackebeil/pybnb/actions/workflows/ci.yml\n.. |Coverage-Status| image:: https://codecov.io/gh/ghackebeil/pybnb/branch/master/graph/badge.svg\n  :target: https://codecov.io/gh/ghackebeil/pybnb\n.. |Documentation-Status| image:: https://readthedocs.org/projects/pybnb/badge/?version=latest\n  :target: http://pybnb.readthedocs.io/en/latest/?badge=latest\n.. |PyPI-Status| image:: https://img.shields.io/pypi/v/pybnb.svg\n  :target: https://pypi.python.org/pypi/pybnb\n.. |PyPI-Versions| image:: https://img.shields.io/pypi/pyversions/pybnb.svg\n  :target: https://pypi.org/project/pybnb\n.. |Codacy-Grade| image:: https://img.shields.io/lgtm/grade/python/g/ghackebeil/pybnb.svg?logo=lgtm\u0026logoWidth=18\n  :target: https://lgtm.com/projects/g/ghackebeil/pybnb/context:python\n.. |PyPI-Downloads| image:: https://img.shields.io/pypi/dm/pybnb.svg\n  :target: https://pypistats.org/packages/pybnb\n.. |Black| image:: https://img.shields.io/badge/code%20style-black-000000.svg\n  :target: https://github.com/psf/black\n.. |Mypy| image:: http://www.mypy-lang.org/static/mypy_badge.svg\n  :target: http://mypy-lang.org\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghackebeil%2Fpybnb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghackebeil%2Fpybnb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghackebeil%2Fpybnb/lists"}