All Projects → ghackebeil → pybnb

ghackebeil / pybnb

Licence: MIT license
A parallel branch-and-bound engine for Python. (https://pybnb.readthedocs.io/)

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to pybnb

Cilib
Typesafe, purely functional Computational Intelligence
Stars: ✭ 114 (+115.09%)
Mutual labels:  optimization-algorithms
Nmflibrary
MATLAB library for non-negative matrix factorization (NMF): Version 1.8.1
Stars: ✭ 153 (+188.68%)
Mutual labels:  optimization-algorithms
Fewshotlearning
Pytorch implementation of the paper "Optimization as a Model for Few-Shot Learning"
Stars: ✭ 223 (+320.75%)
Mutual labels:  optimization-algorithms
Swarmlib
This repository implements several swarm optimization algorithms and visualizes them. Implemented algorithms: Particle Swarm Optimization (PSO), Firefly Algorithm (FA), Cuckoo Search (CS), Ant Colony Optimization (ACO), Artificial Bee Colony (ABC), Grey Wolf Optimizer (GWO) and Whale Optimization Algorithm (WOA)
Stars: ✭ 121 (+128.3%)
Mutual labels:  optimization-algorithms
Proxtv
Matlab and Python toolbox for fast Total Variation proximity operators
Stars: ✭ 140 (+164.15%)
Mutual labels:  optimization-algorithms
Sporco
Sparse Optimisation Research Code
Stars: ✭ 164 (+209.43%)
Mutual labels:  optimization-algorithms
Viz torch optim
Videos of deep learning optimizers moving on 3D problem-landscapes
Stars: ✭ 86 (+62.26%)
Mutual labels:  optimization-algorithms
Aleph star
Reinforcement learning with A* and a deep heuristic
Stars: ✭ 235 (+343.4%)
Mutual labels:  optimization-algorithms
Niapy
Python microframework for building nature-inspired algorithms. Official docs: http://niapy.readthedocs.io/en/stable/
Stars: ✭ 148 (+179.25%)
Mutual labels:  optimization-algorithms
Relion
Image-processing software for cryo-electron microscopy
Stars: ✭ 219 (+313.21%)
Mutual labels:  optimization-algorithms
Raven
RAVEN is a flexible and multi-purpose probabilistic risk analysis, uncertainty quantification, parameter optimization and data knowledge-discovering framework.
Stars: ✭ 122 (+130.19%)
Mutual labels:  optimization-algorithms
Deeplearning.ai
Stars: ✭ 139 (+162.26%)
Mutual labels:  optimization-algorithms
Optimizer Visualization
Visualize Tensorflow's optimizers.
Stars: ✭ 178 (+235.85%)
Mutual labels:  optimization-algorithms
Tradingstrategies
Algorithmic trading strategies
Stars: ✭ 120 (+126.42%)
Mutual labels:  optimization-algorithms
Abagail
The library contains a number of interconnected Java packages that implement machine learning and artificial intelligence algorithms. These are artificial intelligence algorithms implemented for the kind of people that like to implement algorithms themselves.
Stars: ✭ 225 (+324.53%)
Mutual labels:  optimization-algorithms
Optimviz
Visualize optimization algorithms in MATLAB.
Stars: ✭ 106 (+100%)
Mutual labels:  optimization-algorithms
Bads
Bayesian Adaptive Direct Search (BADS) optimization algorithm for model fitting in MATLAB
Stars: ✭ 159 (+200%)
Mutual labels:  optimization-algorithms
pallas-solver
Global optimization algorithms written in C++
Stars: ✭ 43 (-18.87%)
Mutual labels:  optimization-algorithms
Argmin
Mathematical optimization in pure Rust
Stars: ✭ 234 (+341.51%)
Mutual labels:  optimization-algorithms
Python Mip
Collection of Python tools for the modeling and solution of Mixed-Integer Linear programs
Stars: ✭ 202 (+281.13%)
Mutual labels:  optimization-algorithms

pybnb

PyPI-Status PyPI-Versions PyPI-Downloads

Testing-Status Coverage-Status Documentation-Status

Codacy-Grade Mypy Black

A parallel branch-and-bound engine for Python. (https://pybnb.readthedocs.io)

This software is copyright (c) by Gabriel A. Hackebeil ([email protected]).

This software is released under the MIT software license. This license, including disclaimer, is available in the 'LICENSE' file.

Quick Start

Define a problem:

# simple.py

import pybnb
class Simple(pybnb.Problem):
    def __init__(self):
        self.bounds = [0.0,1.0]
    def sense(self):
        return pybnb.minimize
    def objective(self):
        return round(self.bounds[1] - self.bounds[0], 3)
    def bound(self):
        return -(self.bounds[1] - self.bounds[0])**2
    def save_state(self, node):
        node.state = self.bounds
    def load_state(self, node):
        self.bounds = node.state
    def branch(self):
        L, U = self.bounds
        mid = 0.5 * (L + U)
        for l,u in [(L,mid), (mid,U)]:
            child = pybnb.Node()
            child.state = (l,u)
            yield child

Write a solve script:

# solve_simple.py

import simple
problem = simple.Simple()
results = pybnb.solve(problem,
                      absolute_gap=1e-9)

Run the script:

$ mpirun -np 4 python solve_simple.py

Using non-default solver options:
 - absolute_gap: 1e-09 (default: 0)

Starting branch & bound solve:
 - dispatcher pid: 34902 (Ozymandias.local)
 - worker processes: 3
---------------------------------------------------------------------------------------------------------------------------
         Nodes        |                      Objective Bounds                        |              Work
      Expl    Unexpl  |      Incumbent           Bound     Rel. Gap         Abs. Gap | Time (s)  Nodes/Sec Imbalance   Idle
         0         1  |            inf            -inf          inf%             inf |      0.0       0.00     0.00%      0
*        1         2  |              1              -1  200.0000000%               2 |      0.0    1226.99   300.00%      1
*        2         3  |            0.5              -1  150.0000000%             1.5 |      0.0    2966.04   150.00%      0
*        4         5  |           0.25           -0.25   50.0000000%             0.5 |      0.0    8081.95    75.00%      0
*        8         9  |          0.125         -0.0625   18.7500000%          0.1875 |      0.0   12566.90    37.50%      0
      Expl    Unexpl  |      Incumbent           Bound     Rel. Gap         Abs. Gap | Time (s)  Nodes/Sec Imbalance   Idle
*       16        17  |          0.062       -0.015625    7.7625000%        0.077625 |      0.0   15352.74    18.75%      0
*       32        33  |          0.031     -0.00390625    3.4906250%      0.03490625 |      0.0   15981.49    18.75%      0
*       64        65  |          0.016   -0.0009765625    1.6976563%    0.0169765625 |      0.0   18740.68    18.75%      0
*      128       129  |          0.008   -0.0002441406    0.8244141%  0.008244140625 |      0.0   21573.51    11.72%      0
*      256       257  |          0.004   -6.103516e-05    0.4061035%  0.004061035156 |      0.0   22166.96     8.20%      0
      Expl    Unexpl  |      Incumbent           Bound     Rel. Gap         Abs. Gap | Time (s)  Nodes/Sec Imbalance   Idle
*      512       513  |          0.002   -1.525879e-05    0.2015259%  0.002015258789 |      0.0   21177.00     5.86%      0
*     1024      1025  |          0.001   -3.814697e-06    0.1003815%  0.001003814697 |      0.1   19978.42     9.38%      0
*     2048      2049  |              0   -9.536743e-07    0.0000954% 9.536743164e-07 |      0.1   21606.45     5.42%      0
     24029     24030  |              0   -1.490116e-08    0.0000015% 1.490116119e-08 |      1.1   21961.03     5.98%      0
     46159     46160  |              0    -3.72529e-09    0.0000004% 3.725290298e-09 |      2.1   22120.75     5.73%      0
      Expl    Unexpl  |      Incumbent           Bound     Rel. Gap         Abs. Gap | Time (s)  Nodes/Sec Imbalance   Idle
     65537     65538  |              0   -9.313226e-10    0.0000001% 9.313225746e-10 |      3.0   22459.50     6.20%      0
---------------------------------------------------------------------------------------------------------------------------

Absolute optimality tolerance met
Optimal solution found!

solver results:
 - solution_status: optimal
 - termination_condition: optimality
 - objective: 0
 - bound: -9.313226e-10
 - absolute_gap: 9.313226e-10
 - relative_gap: 9.313226e-10
 - nodes: 65537
 - wall_time: 2.96 s
 - best_node: Node(objective=0)

Number of Workers:        3
Load Imbalance:       6.20%
 - min: 21355 (proc rank=3)
 - max: 22710 (proc rank=1)
Average Worker Timing:
 - queue:      80.78% [avg time: 109.6 us, count: 65537]
 - load_state:  0.44% [avg time: 596.1 ns, count: 65537]
 - bound:       0.59% [avg time: 796.1 ns, count: 65537]
 - objective:   3.52% [avg time:   4.7 us, count: 65537]
 - branch:      3.36% [avg time:   4.6 us, count: 65537]
 - other:      11.31% [avg time:  15.3 us, count: 65537]
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].